mirror of https://github.com/apache/lucene.git
LUCENE-10331: don't emit the contents of the inputs file until we're actually running the task (#554)
This commit is contained in:
parent
92e5391f27
commit
e790125504
|
@ -61,24 +61,6 @@ allprojects {
|
|||
def tmpDst = getTemporaryDir()
|
||||
workingDir tmpDst
|
||||
|
||||
// Place input files in an external file to dodge command line argument
|
||||
// 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.
|
||||
def inputsFile = file("${tmpDst}/ecj-inputs.txt")
|
||||
// escape filename accoring to ECJ's rules:
|
||||
// https://github.com/eclipse/aspectj.eclipse.jdt.core/blob/a05312e746b9bc2b48b4b039f6e7b5e061b5b393/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java#L1533-L1537
|
||||
// Basically surround all whitespace by quotes:
|
||||
def escapeFileName = { String s -> s.replaceAll(/ +/, /"$0"/) }
|
||||
inputsFile.setText(
|
||||
srcDirs.collectMany { dir ->
|
||||
project.fileTree(dir: dir, include: "**/*.java" ).files
|
||||
}
|
||||
// Try to sort all input files; a side-effect of this should be that module-info.java
|
||||
// is placed first on the list, which works around ECJ bug:
|
||||
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=569833
|
||||
.sort()
|
||||
.collect {file -> escapeFileName(file.absolutePath.toString())}.join("\n"), "UTF-8")
|
||||
|
||||
args += [ "-d", "none" ]
|
||||
|
||||
// Compilation environment.
|
||||
|
@ -95,6 +77,11 @@ allprojects {
|
|||
def modularPaths = sourceSet.modularPaths
|
||||
dependsOn modularPaths.compileModulePathConfiguration
|
||||
|
||||
// Place input files in an external file to dodge command line argument
|
||||
// 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.
|
||||
def inputsFile = file("${tmpDst}/ecj-inputs.txt")
|
||||
|
||||
task.argumentProviders.add((CommandLineArgumentProvider) {
|
||||
// Add modular dependencies and their transitive dependencies to module path.
|
||||
def modularPathFiles = modularPaths.compileModulePathConfiguration.files
|
||||
|
@ -118,14 +105,26 @@ allprojects {
|
|||
extraArgs += ["-classpath", cpath.join(File.pathSeparator)]
|
||||
}
|
||||
|
||||
// Add source location(s) in an external file to avoid command line argument limits.
|
||||
extraArgs += ["@" + inputsFile.absolutePath]
|
||||
|
||||
return extraArgs
|
||||
})
|
||||
|
||||
doFirst {
|
||||
tmpDst.mkdirs()
|
||||
|
||||
// escape filename accoring to ECJ's rules:
|
||||
// https://github.com/eclipse/aspectj.eclipse.jdt.core/blob/a05312e746b9bc2b48b4b039f6e7b5e061b5b393/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java#L1533-L1537
|
||||
// Basically surround all whitespace by quotes:
|
||||
def escapeFileName = { String s -> s.replaceAll(/ +/, /"$0"/) }
|
||||
inputsFile.setText(
|
||||
srcDirs.collectMany { dir ->
|
||||
project.fileTree(dir: dir, include: "**/*.java" ).files
|
||||
}
|
||||
// Try to sort all input files; a side-effect of this should be that module-info.java
|
||||
// is placed first on the list, which works around ECJ bug:
|
||||
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=569833
|
||||
.sort()
|
||||
.collect {file -> escapeFileName(file.absolutePath.toString())}.join("\n"), "UTF-8")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue