| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * License); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an AS IS BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| import groovy.json.JsonOutput |
| |
| plugins { id 'org.apache.beam.module' } |
| applyJavaNature(automaticModuleName: 'org.apache.beam.runners.apex') |
| |
| description = "Apache Beam :: Runners :: Apex" |
| |
| /* |
| * We need to rely on manually specifying these evaluationDependsOn to ensure that |
| * the following projects are evaluated before we evaluate this project. This is because |
| * we are attempting to reference the "sourceSets.test.output" directly. |
| */ |
| evaluationDependsOn(":sdks:java:core") |
| |
| configurations { |
| validatesRunner |
| } |
| |
| dependencies { |
| compile project(path: ":model:pipeline", configuration: "shadow") |
| compile project(path: ":sdks:java:core", configuration: "shadow") |
| compile project(":runners:core-construction-java") |
| compile project(":runners:core-java") |
| compile library.java.apex_common |
| compile library.java.malhar_library |
| compile library.java.apex_engine |
| compile library.java.commons_lang3 |
| compile library.java.apex_engine |
| testCompile project(path: ":sdks:java:core", configuration: "shadowTest") |
| // ApexStateInternalsTest extends abstract StateInternalsTest |
| testCompile project(path: ":runners:core-java", configuration: "testRuntime") |
| testCompile library.java.hamcrest_core |
| testCompile library.java.junit |
| testCompile library.java.mockito_core |
| testCompile library.java.jackson_dataformat_yaml |
| validatesRunner project(path: ":sdks:java:core", configuration: "shadowTest") |
| validatesRunner project(path: ":runners:core-java", configuration: "testRuntime") |
| validatesRunner project(project.path) |
| } |
| |
| // TODO: Update this so that the generated file is added to the explicitly added instead of |
| // just outputting the file in the correct path. |
| task buildDependencyTree(type: DependencyReportTask) { |
| configurations = [project.configurations.testRuntimeClasspath] |
| outputFile = new File(buildDir, "classes/java/main/org/apache/beam/runners/apex/dependency-tree") |
| // TODO: Migrate ApexYarnLauncher to use the Gradles dependency tree output instead of Mavens |
| // so we don't have to try to replace the format of the file on the fly |
| doLast { |
| // Filter out lines which don't have any dependencies by looking for lines with "--- " |
| ant.replaceregexp(file: outputFile, match: "^((?!--- ).)*\$", replace: "", byline: true) |
| // Remove empty lines |
| ant.replaceregexp(file: outputFile, match: "\\n\\n", replace: "", flags: "gm") |
| // Replace strings with ":a.b.c -> x.y.z" to just be ":x.y.z" getting the used version of the dependency. |
| ant.replaceregexp(file: outputFile, match: ":([^:]*) -> (.*)", replace: ":\\2", byline: true) |
| // Remove a trailing " (*)" off the end to so there is nothing after the version identifier. |
| ant.replaceregexp(file: outputFile, match: " \\(\\*\\)", replace: "", byline: true) |
| // Add ":jar" to the maven dependency string assuming that all resource types are jars. |
| ant.replaceregexp(file: outputFile, match: "[^:]*:[^:]*", replace: "\\0:jar", byline: true) |
| } |
| } |
| compileJava.dependsOn buildDependencyTree |
| |
| task validatesRunnerBatch(type: Test) { |
| group = "Verification" |
| systemProperty "beamTestPipelineOptions", JsonOutput.toJson([ |
| "--runner=TestApexRunner", |
| ]) |
| |
| classpath = configurations.validatesRunner |
| testClassesDirs = files(project(":sdks:java:core").sourceSets.test.output.classesDirs) |
| useJUnit { |
| includeCategories 'org.apache.beam.sdk.testing.ValidatesRunner' |
| excludeCategories 'org.apache.beam.sdk.testing.FlattenWithHeterogeneousCoders' |
| excludeCategories 'org.apache.beam.sdk.testing.UsesAttemptedMetrics' |
| excludeCategories 'org.apache.beam.sdk.testing.UsesCommittedMetrics' |
| excludeCategories 'org.apache.beam.sdk.testing.UsesImpulse' |
| excludeCategories 'org.apache.beam.sdk.testing.UsesParDoLifecycle' |
| excludeCategories 'org.apache.beam.sdk.testing.UsesTestStream' |
| excludeCategories 'org.apache.beam.sdk.testing.UsesTimersInParDo' |
| excludeCategories 'org.apache.beam.sdk.testing.UsesMetricsPusher' |
| excludeCategories 'org.apache.beam.sdk.testing.UsesUnboundedSplittableParDo' |
| excludeCategories 'org.apache.beam.sdk.testing.UsesUnboundedPCollections' |
| // TODO[BEAM-8304]: Support multiple side inputs with different coders. |
| excludeCategories 'org.apache.beam.sdk.testing.UsesSideInputsWithDifferentCoders' |
| } |
| |
| // apex runner is run in embedded mode. Increase default HeapSize |
| maxHeapSize = '4g' |
| } |
| |
| task validatesRunner { |
| group = "Verification" |
| description "Validates Apex runner" |
| dependsOn validatesRunnerBatch |
| } |
| |
| // Generates :runners:apex:runQuickstartJavaApex |
| createJavaExamplesArchetypeValidationTask(type: 'Quickstart', runner:'Apex') |