github.com/apache/beam/sdks/v2@v2.48.2/java/io/hcatalog/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 java.util.stream.Collectors
    20  
    21  plugins { id 'org.apache.beam.module' }
    22  applyJavaNature(
    23    automaticModuleName: 'org.apache.beam.sdk.io.hcatalog',
    24    // TODO(BEAM-13430): Re-enable this once the dependency analysis plugin stops failing with:
    25    // Cannot accept visitor on URL: file:.../org.apache.curator/apache-curator/2.6.0/1bbbe3a8c191ec5a63ec2eaec7988d8292ea65d2/apache-curator-2.6.0.pom
    26    enableStrictDependencies: false,
    27  )
    28  
    29  description = "Apache Beam :: SDKs :: Java :: IO :: HCatalog"
    30  ext.summary = "IO to read and write for HCatalog source."
    31  
    32  def hadoopVersions = [
    33      "285": "2.8.5",
    34      "292": "2.9.2",
    35      "2102": "2.10.2",
    36  ]
    37  
    38  hadoopVersions.each {kv -> configurations.create("hadoopVersion$kv.key")}
    39  
    40  def hive_version = "3.1.3"
    41  
    42  /*
    43   * We need to rely on manually specifying these evaluationDependsOn to ensure that
    44   * the following projects are evaluated before we evaluate this project. This is because
    45   * we are attempting to reference the "sourceSets.test.output" directly.
    46   * TODO: use testTextures feature which is introduced in Gradle 5.6 instead of
    47   * the test outputs directly.
    48   */
    49  evaluationDependsOn(":sdks:java:io:common")
    50  
    51  dependencies {
    52    implementation library.java.vendored_guava_26_0_jre
    53    implementation project(path: ":sdks:java:core", configuration: "shadow")
    54    implementation project(":sdks:java:io:hadoop-common")
    55    implementation library.java.slf4j_api
    56    implementation library.java.joda_time
    57    // Hive bundles without repackaging Jackson which is why we redeclare it here so that it appears
    58    // on the compile/test/runtime classpath before Hive.
    59    provided library.java.jackson_annotations
    60    provided library.java.jackson_core
    61    provided library.java.jackson_databind
    62    // Calcite (a dependency of Hive) bundles without repackaging Guava which is why we redeclare it
    63    // here so that it appears on the compile/test/runtime classpath before Calcite.
    64    provided library.java.hadoop_common
    65    provided "org.apache.hive:hive-exec:$hive_version"
    66    provided(group: "org.apache.hive.hcatalog", name: "hive-hcatalog-core", version: hive_version) {
    67      exclude group: "org.apache.hive", module: "hive-exec"
    68      exclude group: "com.google.protobuf", module: "protobuf-java"
    69    }
    70    testImplementation project(":sdks:java:io:common").sourceSets.test.output
    71    testImplementation library.java.commons_io
    72    testImplementation library.java.junit
    73    testImplementation library.java.hamcrest
    74    testImplementation "org.apache.hive.hcatalog:hive-hcatalog-core:$hive_version:tests"
    75    testImplementation "org.apache.hive:hive-exec:$hive_version"
    76    testImplementation "org.apache.hive:hive-common:$hive_version"
    77    testImplementation "org.apache.hive:hive-cli:$hive_version"
    78    testImplementation "org.apache.hive.hcatalog:hive-hcatalog-core:$hive_version"
    79    testRuntimeOnly project(path: ":runners:direct-java", configuration: "shadow")
    80    hadoopVersions.each {kv ->
    81      "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-common:$kv.value"
    82    }
    83  }
    84  
    85  hadoopVersions.each {kv ->
    86    configurations."hadoopVersion$kv.key" {
    87      resolutionStrategy {
    88        force "org.apache.hadoop:hadoop-common:$kv.value"
    89      }
    90    }
    91  }
    92  
    93  task hadoopVersionsTest(group: "Verification") {
    94    description = "Runs HCatalog tests with different Hadoop versions"
    95    def taskNames = hadoopVersions.keySet().stream()
    96        .map{num -> "hadoopVersion${num}Test"}
    97        .collect(Collectors.toList())
    98    dependsOn taskNames
    99  }
   100  
   101  hadoopVersions.each { kv ->
   102    task "hadoopVersion${kv.key}Test"(type: Test, group: "Verification") {
   103      description = "Runs HCatalog tests with Hadoop version $kv.value"
   104      classpath = configurations."hadoopVersion$kv.key" + sourceSets.test.runtimeClasspath
   105      include '**/*Test.class'
   106    }
   107  }