Escape the options in ECJ's options file

This commit is contained in:
Uwe Schindler 2021-12-17 11:37:27 +01:00
parent ae92e96481
commit 6941701c6d
1 changed files with 2 additions and 1 deletions

View File

@ -65,11 +65,12 @@ allprojects {
// limits. We could pass a directory but ecj seems to be buggy: when it // limits. We could pass a directory but ecj seems to be buggy: when it
// encounters a module-info.java file it no longer compiles other source files. // encounters a module-info.java file it no longer compiles other source files.
def inputsFile = file("${tmpDst}/ecj-inputs.txt") def inputsFile = file("${tmpDst}/ecj-inputs.txt")
def escapeOption = { String s -> (s =~ /[ '"]/) ? ('"' + s.replaceAll(/[\\'"]/, /\\$0/) + '"') : s }
inputsFile.setText( inputsFile.setText(
srcDirs.collectMany { dir -> srcDirs.collectMany { dir ->
project.fileTree(dir: dir, include: "**/*.java" ).files project.fileTree(dir: dir, include: "**/*.java" ).files
} }
.collect {file -> file.absolutePath.toString()}.join("\n"), "UTF-8") .collect {file -> escapeOption(file.absolutePath.toString())}.join("\n"), "UTF-8")
args += [ "-d", "none" ] args += [ "-d", "none" ]