github.com/apache/beam/sdks/v2@v2.48.2/java/extensions/sql/datacatalog/build.gradle (about)

     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one
     3   * or more contributor license agreements.  See the NOTICE file
     4   * distributed with this work for additional information
     5   * regarding copyright ownership.  The ASF licenses this file
     6   * to you under the Apache License, Version 2.0 (the
     7   * License); you may not use this file except in compliance
     8   * with the License.  You may obtain a copy of the License at
     9   *
    10   *     http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing, software
    13   * distributed under the License is distributed on an AS IS BASIS,
    14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15   * See the License for the specific language governing permissions and
    16   * limitations under the License.
    17   */
    18  
    19  import groovy.json.JsonOutput
    20  
    21  plugins { id 'org.apache.beam.module' }
    22  
    23  applyJavaNature(
    24    automaticModuleName: 'org.apache.beam.sdk.extensions.sql.datacatalog')
    25  
    26  dependencies {
    27    implementation enforcedPlatform(library.java.google_cloud_platform_libraries_bom)
    28    implementation(library.java.google_cloud_datacatalog_v1beta1) {
    29      exclude group: 'io.grpc', module: 'grpc-core' // Use Beam's version
    30    }
    31    implementation library.java.gax
    32    implementation library.java.google_auth_library_credentials
    33    implementation library.java.proto_google_cloud_datacatalog_v1beta1
    34    implementation library.java.protobuf_java
    35    implementation library.java.slf4j_api
    36    implementation library.java.vendored_guava_26_0_jre
    37    implementation "com.alibaba:fastjson:1.2.69"
    38    implementation project(path: ":sdks:java:core", configuration: "shadow")
    39    implementation "org.threeten:threetenbp:1.4.5"
    40    provided project(":sdks:java:extensions:sql")
    41  
    42    // Dependencies for the example
    43    implementation project(":sdks:java:extensions:google-cloud-platform-core")
    44    provided project(":sdks:java:io:google-cloud-platform")
    45    permitUnusedDeclared project(":sdks:java:io:google-cloud-platform")
    46    implementation library.java.slf4j_api
    47  
    48    testImplementation project(":sdks:java:extensions:sql")
    49    testImplementation project(":sdks:java:extensions:sql:zetasql")
    50    testImplementation project(":runners:direct-java")
    51    testImplementation project(":sdks:java:io:google-cloud-platform")
    52    testImplementation library.java.google_api_services_bigquery
    53    testImplementation library.java.junit
    54    testRuntimeOnly library.java.slf4j_simple
    55  }
    56  
    57  task runDataCatalogExample(type: JavaExec) {
    58    description = "Run SQL example of how to use Data Catalog table provider"
    59    mainClass = "org.apache.beam.sdk.extensions.sql.example.BeamSqlDataCatalogExample"
    60    classpath = sourceSets.main.runtimeClasspath
    61  
    62    def runner = project.findProperty('runner') ?: 'DirectRunner'
    63    def queryString = project.findProperty('queryString') ?: ''
    64    def outputFilePrefix = project.findProperty('outputFilePrefix') ?: ''
    65    def gcpProject = project.findProperty('gcpProject') ?: 'apache-beam-testing'
    66    def gcpRegion = project.findProperty('gcpRegion') ?: 'us-central1'
    67    def gcsTempRoot = project.findProperty('gcsTempRoot') ?: 'gs://temp-storage-for-end-to-end-tests/'
    68  
    69    args = [
    70      "--runner=${runner}",
    71      "--queryString=${queryString}",
    72      "--outputFilePrefix=${outputFilePrefix}",
    73      "--project=${gcpProject}",
    74      "--region=${gcpRegion}",
    75      "--tempLocation=${gcsTempRoot}",
    76    ]
    77  }
    78  
    79  task integrationTest(type: Test) {
    80    group = "Verification"
    81    def gcpProject = project.findProperty('gcpProject') ?: 'apache-beam-testing'
    82    def gcsTempRoot = project.findProperty('gcsTempRoot') ?: 'gs://temp-storage-for-end-to-end-tests/'
    83  
    84    // Disable Gradle cache (it should not be used because the IT's won't run).
    85    outputs.upToDateWhen { false }
    86  
    87    def pipelineOptions = [
    88            "--project=${gcpProject}",
    89            "--tempLocation=${gcsTempRoot}",
    90            "--blockOnRun=false"]
    91  
    92    systemProperty "beamTestPipelineOptions", JsonOutput.toJson(pipelineOptions)
    93  
    94    include '**/*IT.class'
    95    maxParallelForks 4
    96    classpath = project(":sdks:java:extensions:sql:datacatalog")
    97            .sourceSets
    98            .test
    99            .runtimeClasspath
   100    testClassesDirs = files(project(":sdks:java:extensions:sql:datacatalog").sourceSets.test.output.classesDirs)
   101    useJUnit {}
   102  }
   103  
   104  task postCommit {
   105    group = "Verification"
   106    description = "Various integration tests"
   107    dependsOn integrationTest
   108  }