github.com/apache/beam/sdks/v2@v2.48.2/java/testing/watermarks/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 plugins { id 'org.apache.beam.module' } 20 applyJavaNature( 21 publish: false, 22 archivesBaseName: 'beam-sdks-java-watermark-latency', 23 exportJavadoc: false 24 ) 25 26 description = "Apache Beam :: SDKs :: Java :: Watermark Latency Benchmark" 27 28 29 def mainClassProperty = "loadTest.mainClass" 30 def mainClass = project.findProperty(mainClassProperty) 31 32 // When running via Gradle, this property can be used to pass commandline arguments 33 // to the load-tests launch 34 def loadTestArgsProperty = "loadTest.args" 35 36 // When running via Gradle, this property sets the runner dependency 37 def runnerProperty = "runner" 38 def runnerDependency = (project.hasProperty(runnerProperty) 39 ? project.getProperty(runnerProperty) 40 : ":runners:direct-java") 41 42 def isDataflowRunner = ":runners:google-cloud-dataflow-java".equals(runnerDependency) 43 def runnerConfiguration = ":runners:direct-java".equals(runnerDependency) ? "shadow" : null 44 45 if (isDataflowRunner) { 46 /* 47 * We need to rely on manually specifying these evaluationDependsOn to ensure that 48 * the following projects are evaluated before we evaluate this project. This is because 49 * we are attempting to reference a property from the project directly. 50 */ 51 evaluationDependsOn(":runners:google-cloud-dataflow-java:worker") 52 } 53 54 configurations { 55 // A configuration for running the Load testlauncher directly from Gradle, which 56 // uses Gradle to put the appropriate dependencies on the Classpath rather than 57 // bundling them into a fat jar 58 gradleRun 59 } 60 61 dependencies { 62 implementation library.java.joda_time 63 runtimeOnly library.java.kafka_clients 64 implementation library.java.slf4j_api 65 66 implementation project(path: ":sdks:java:core", configuration: "shadow") 67 runtimeOnly project(path: ":runners:direct-java", configuration: "shadow") 68 runtimeOnly project(":sdks:java:io:synthetic") 69 runtimeOnly project(":sdks:java:testing:test-utils") 70 runtimeOnly project(":sdks:java:io:google-cloud-platform") 71 runtimeOnly project(":sdks:java:io:kafka") 72 runtimeOnly project(":sdks:java:io:kinesis") 73 74 gradleRun project(project.path) 75 gradleRun project(path: runnerDependency, configuration: runnerConfiguration) 76 } 77 78 task run(type: JavaExec) { 79 def loadTestArgs = project.findProperty(loadTestArgsProperty) ?: "" 80 81 if (isDataflowRunner) { 82 dependsOn ":runners:google-cloud-dataflow-java:worker:shadowJar" 83 84 def dataflowWorkerJar = project.findProperty('dataflowWorkerJar') ?: project(":runners:google-cloud-dataflow-java:worker").shadowJar.archivePath 85 // Provide job with a customizable worker jar. 86 // With legacy worker jar, containerImage is set to empty (i.e. to use the internal build). 87 // More context and discussions can be found in PR#6694. 88 loadTestArgs = loadTestArgs + 89 " --dataflowWorkerJar=${dataflowWorkerJar} " + 90 " --workerHarnessContainerImage=" 91 } 92 93 mainClass = mainClass 94 classpath = configurations.gradleRun 95 args loadTestArgs.split() 96 } 97