diff --git a/.github/trigger_files/beam_PreCommit_Java_IOs_Direct.json b/.github/trigger_files/beam_PreCommit_Java_IOs_Direct.json new file mode 100644 index 000000000000..5abe02fc09c7 --- /dev/null +++ b/.github/trigger_files/beam_PreCommit_Java_IOs_Direct.json @@ -0,0 +1,4 @@ +{ + "comment": "Modify this file in a trivial way to cause this test suite to run.", + "modification": 1 +} diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index 6550dbd843b4..fd67d8f955d6 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -482,19 +482,32 @@ class BeamModulePlugin implements Plugin { /* * Set compile args for compiling and running in different java version by modifying the compiler args in place. * - * Replace `--release X` option if already existed in compilerArgs. + * Replace `-source X` and `-target X` or `--release X` options if already existed in compilerArgs. */ static def setCompileAndRuntimeJavaVersion(List compilerArgs, String ver) { - boolean foundR = false + boolean foundS = false, foundT = false + int foundR = -1 logger.fine("set java ver ${ver} to compiler args") for (int i = 0; i < compilerArgs.size() - 1; ++i) { - if (compilerArgs.get(i) == '--release') { - foundR = true + if (compilerArgs.get(i) == '-source') { + foundS = true compilerArgs.set(i + 1, ver) + } else if (compilerArgs.get(i) == '-target') { + foundT = true + compilerArgs.set(i + 1, ver) + } else if (compilerArgs.get(i) == '--release') { + foundR = i } } - if (!foundR) { - compilerArgs.addAll('--release', ver) + if (foundR != -1) { + compilerArgs.removeAt(foundR + 1) + compilerArgs.removeAt(foundR) + } + if (!foundS) { + compilerArgs.addAll('-source', ver) + } + if (!foundT) { + compilerArgs.addAll('-target', ver) } }