LUCENE-9474: Make external tools configurable like in ant through those sysprops: perl.exe, python3.exe, python2.exe

This commit is contained in:
Uwe Schindler 2020-08-23 20:16:22 +02:00
parent ee6cf4c418
commit 494a8a8e04
8 changed files with 15 additions and 8 deletions

View File

@ -89,6 +89,13 @@ ext {
"jgit": "5.3.0.201903130848-r",
"flexmark": "0.61.24",
]
// read some external tool locations from system props
externalToolExecutables = [
"python3": propertyOrDefault('python3.exe', 'python3'),
"python2": propertyOrDefault('python2.exe', 'python2'),
"perl": propertyOrDefault('perl.exe', 'perl'),
]
}
// Include smaller chunks configuring dedicated build areas.

View File

@ -54,7 +54,7 @@ class ChangesToHtmlTask extends DefaultTask {
def toHtml(File versionsFile) {
def output = new ByteArrayOutputStream()
def result = project.exec {
executable "perl"
executable project.externalToolExecutables["perl"]
standardInput changesFile.newInputStream()
standardOutput project.file("${targetDir.get().getAsFile()}/Changes.html").newOutputStream()
errorOutput = output

View File

@ -149,7 +149,7 @@ configure(project(":lucene:analysis:common")) {
def target = file('src/java/org/apache/lucene/analysis/charfilter/HTMLCharacterEntities.jflex')
target.withOutputStream { output ->
project.exec {
executable = "python"
executable = project.externalToolExecutables["python2"]
workingDir = target.parentFile
standardOutput = output
args += [

View File

@ -73,7 +73,7 @@ configure(project(":lucene:analysis:kuromoji")) {
// Apply patch via local git.
project.exec {
workingDir = unpackedDir
executable "git"
executable "git" // TODO: better use jgit to apply patch, this is not portable!!!
args += [
"apply",
file("src/tools/patches/Noun.proper.csv.patch").absolutePath

View File

@ -100,7 +100,7 @@ configure(project(":lucene:analysis:common")) {
doLast {
project.exec {
executable "bash"
executable "bash" // TODO: does not work with windows, use project.externalToolExecutables[] instead
args = [snowballScript, snowballStemmerDir, snowballWebsiteDir, snowballDataDir, projectDir]
}
}

View File

@ -57,7 +57,7 @@ configure(project(":lucene:core")) {
logger.lifecycle("Executing: ${prog} in ${targetDir}")
project.exec {
workingDir targetDir
executable "python3"
executable project.externalToolExecutables["python3"]
args = ['-B', "${prog}"]
}
}
@ -82,7 +82,7 @@ configure(project(":lucene:core")) {
['True', 'False'].each { transpose ->
project.exec {
workingDir targetDir
executable "python3"
executable project.externalToolExecutables["python3"]
args = ['-B', 'createLevAutomata.py', num, transpose, "${momanDir}/finenight/python"]
}
}

View File

@ -52,7 +52,7 @@ class CheckBrokenLinksTask extends DefaultTask {
def result
outputFile.withOutputStream { output ->
result = project.exec {
executable "python3"
executable project.externalToolExecutables["python3"]
ignoreExitValue = true
standardOutput = output
errorOutput = output

View File

@ -89,7 +89,7 @@ class CheckMissingDocsTask extends DefaultTask {
def checkMissingJavadocs(File dir, String level) {
def output = new ByteArrayOutputStream()
def result = project.exec {
executable "python3"
executable project.externalToolExecutables["python3"]
ignoreExitValue = true
standardOutput = output
errorOutput = output