github.com/apache/beam/sdks/v2@v2.48.2/java/extensions/sorter/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(automaticModuleName: 'org.apache.beam.sdk.extensions.sorter')
    23  
    24  description = "Apache Beam :: SDKs :: Java :: Extensions :: Sorter"
    25  
    26  def hadoopVersions = [
    27      "285": "2.8.5",
    28      "292": "2.9.2",
    29      "2102": "2.10.2",
    30      "324": "3.2.4",
    31  ]
    32  
    33  hadoopVersions.each {kv -> configurations.create("hadoopVersion$kv.key")}
    34  
    35  dependencies {
    36    implementation project(path: ":sdks:java:core", configuration: "shadow")
    37    implementation library.java.vendored_guava_26_0_jre
    38    implementation library.java.slf4j_api
    39    provided library.java.hadoop_mapreduce_client_core
    40    provided library.java.hadoop_common
    41    testImplementation library.java.mockito_core
    42    testImplementation library.java.junit
    43    testImplementation library.java.hamcrest
    44    testRuntimeOnly project(path: ":runners:direct-java", configuration: "shadow")
    45    hadoopVersions.each{kv ->
    46      "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-common:$kv.value"
    47      "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-mapreduce-client-core:$kv.value"
    48    }
    49  }
    50  
    51  hadoopVersions.each {kv ->
    52    configurations."hadoopVersion$kv.key" {
    53      resolutionStrategy {
    54        force "org.apache.hadoop:hadoop-common:$kv.value"
    55        force "org.apache.hadoop:hadoop-mapreduce-client-core:$kv.value"
    56      }
    57    }
    58  }
    59  
    60  task hadoopVersionsTest(group: "Verification") {
    61    description = "Runs Sorter tests with different Hadoop versions"
    62    def taskNames = hadoopVersions.keySet().stream()
    63        .map{num -> "hadoopVersion${num}Test"}
    64        .collect(Collectors.toList())
    65    dependsOn taskNames
    66  }
    67  
    68  hadoopVersions.each {kv ->
    69    task "hadoopVersion${kv.key}Test"(type: Test, group: 'Verification') {
    70      description = "Runs Sorter tests with Hadoop version $kv.value"
    71      classpath = configurations."hadoopVersion$kv.key" + sourceSets.test.runtimeClasspath
    72      include '**/*Test.class'
    73    }
    74  }