pawelpasterz commented on a change in pull request #10878: Implement precommit 
portability test to run on java 11
URL: https://github.com/apache/beam/pull/10878#discussion_r384837638
 
 

 ##########
 File path: runners/google-cloud-dataflow-java/examples/build.gradle
 ##########
 @@ -97,6 +97,42 @@ task verifyPortabilityApi() {
   dependsOn verifyFnApiWorker
 }
 
+def passedDockerImageName = project.findProperty('passedDockerImageName')
+def java8Home = project.findProperty('java8Home')
+def java11Home = project.findProperty('java11Home')
+
+task runFnApiTest(type: Test) {
+    def dataflowWorkerJar = project.findProperty('dataflowWorkerJar') ?: 
project(":runners:google-cloud-dataflow-java:worker").shadowJar.archivePath
+    with commonConfig(dataflowWorkerJar, passedDockerImageName, 
["--experiments=${fnapiExperiments}"])
+    useJUnit {
+        excludeCategories 'org.apache.beam.sdk.testing.StreamingIT'
+    }
+}
+
+task verifyFnApiWorkerJava11(type: Test) {
+    dependsOn ":runners:google-cloud-dataflow-java:worker:shadowJar"
+    dependsOn ":runners:google-cloud-dataflow-java:buildAndPushDockerContainer"
+    doLast {
+        exec {
+            workingDir "${rootProject.projectDir}"
+            commandLine "./gradlew", "${project.path}:runFnApiTest", 
"-Pjava8Home=${java8Home}", "-PcompileWithJava8", 
"-PpassedDockerImageName=${dockerImageName}", "-x shadowJar", "-x 
shadowTestJar", "-x jar", "-x testJar", "-x classes", "-x testClasses", 
"-PdisableSpotlessCheck=true", "-Dorg.gradle.java.home=${java11Home}"
 
 Review comment:
   > @Ardagan can you please help out?
   > 
   > If you want to use a single gradle command, you typically need to build 
different variants as separate artifacts. e.g. produce Java 11 classes/jar and 
Java 8 classes/jar and use the correct JVM when doing so in the compileJava and 
compileTestJava tasks (and ensure that the 
[JavaCompile](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.compile.JavaCompile.html)
 task is configured to use the correct JVM). For running tests, you have to 
configure the 
[Test](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html)
 to use the correct JVM.
   > 
   > Anything that relies on independent gradle executions needs to perform all 
the artifact copying/moving between executions to ensure that output isn't 
overwritten/corrupted between Gradle runs.
   
   At line L123 I set javaHome for `AbstractCompile` tasks. 
   I forgot to add link jenkins job that tested this solution 
[JOB](https://builds.apache.org/job/beam_PreCommit_JavaPortabilityApiJava11_Commit/20/)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to