Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/trigger_files/beam_PreCommit_Java_IOs_Direct.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"comment": "Modify this file in a trivial way to cause this test suite to run.",
"modification": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -482,19 +482,32 @@ class BeamModulePlugin implements Plugin<Project> {
/*
* 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<String> 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)
}
}

Expand Down
Loading