Apache Solr open-source search software
LUCENE-9474: make externalTool a function and add a build-stopping message on Windows for snowball generator.
Dawid Weissd847f4023730
diff --git a/build.gradle b/build.gradleindex 4c8209a11ec..9801e0671a2 100644--- a/build.gradle+++ b/build.gradle@@ -90,12 +90,12 @@ ext {"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'),- ]+ // Allow definiting external tool locations using system props.+ externalTool = { name ->+ def resolved = propertyOrDefault("${name}.exe", name as String)+ logger.info("External tool '${name}' resolved to: ${resolved}")+ return resolved+ }}// Include smaller chunks configuring dedicated build areas.diff --git a/gradle/documentation/changes-to-html.gradle b/gradle/documentation/changes-to-html.gradleindex 5f565322217..b49ae93e5da 100644--- a/gradle/documentation/changes-to-html.gradle+++ b/gradle/documentation/changes-to-html.gradle@@ -54,7 +54,7 @@ class ChangesToHtmlTask extends DefaultTask {def toHtml(File versionsFile) {def output = new ByteArrayOutputStream()def result = project.exec {- executable project.externalToolExecutables["perl"]+ executable project.externalTool("perl")standardInput changesFile.newInputStream()standardOutput project.file("${targetDir.get().getAsFile()}/Changes.html").newOutputStream()errorOutput = outputdiff --git a/gradle/generation/jflex.gradle b/gradle/generation/jflex.gradleindex 1f5feb2d1aa..e7c65dff8c3 100644--- a/gradle/generation/jflex.gradle+++ b/gradle/generation/jflex.gradle@@ -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 = project.externalToolExecutables["python2"]+ executable = project.externalTool("python2")workingDir = target.parentFilestandardOutput = outputargs += [diff --git a/gradle/generation/snowball.gradle b/gradle/generation/snowball.gradleindex b2b6882d67d..b7b37c4f38d 100644--- a/gradle/generation/snowball.gradle+++ b/gradle/generation/snowball.gradle@@ -15,6 +15,8 @@* limitations under the License.*/+import org.apache.tools.ant.taskdefs.condition.Os+apply plugin: "de.undercouch.download"configure(rootProject) {@@ -99,8 +101,12 @@ configure(project(":lucene:analysis:common")) {dependsOn downloadSnowballDatadoLast {+ if (Os.isFamily(Os.FAMILY_WINDOWS)) {+ throw GradleException("Snowball generation does not work on Windows, use a platform where bash is available.")+ }+project.exec {- executable "bash" // TODO: does not work with windows, use project.externalToolExecutables[] instead+ executable "bash"args = [snowballScript, snowballStemmerDir, snowballWebsiteDir, snowballDataDir, projectDir]}}diff --git a/gradle/generation/util.gradle b/gradle/generation/util.gradleindex d1a3c240069..36ad86beffe 100644--- a/gradle/generation/util.gradle+++ b/gradle/generation/util.gradle@@ -57,7 +57,7 @@ configure(project(":lucene:core")) {logger.lifecycle("Executing: ${prog} in ${targetDir}")project.exec {workingDir targetDir- executable project.externalToolExecutables["python3"]+ executable project.externalTool("python3")args = ['-B', "${prog}"]}}@@ -82,7 +82,7 @@ configure(project(":lucene:core")) {['True', 'False'].each { transpose ->project.exec {workingDir targetDir- executable project.externalToolExecutables["python3"]+ executable project.externalTool("python3")args = ['-B', 'createLevAutomata.py', num, transpose, "${momanDir}/finenight/python"]}}diff --git a/gradle/validation/check-broken-links.gradle b/gradle/validation/check-broken-links.gradleindex e9d1a11eeb5..26e9e8ab217 100644--- a/gradle/validation/check-broken-links.gradle+++ b/gradle/validation/check-broken-links.gradle@@ -16,7 +16,6 @@*/configure(rootProject) {-task checkBrokenLinks {group 'Verification'description 'Check broken links in the entire documentation'@@ -24,13 +23,10 @@ configure(rootProject) {dependsOn ':lucene:checkBrokenLinks'dependsOn ':solr:checkBrokenLinks'}-}configure(subprojects.findAll { it.path in [':lucene', ':solr'] }) {-task checkBrokenLinks(type: CheckBrokenLinksTask, 'dependsOn': 'documentation')-check.dependsOn checkBrokenLinks}@@ -51,7 +47,7 @@ class CheckBrokenLinksTask extends DefaultTask {def resultoutputFile.withOutputStream { output ->result = project.exec {- executable project.externalToolExecutables["python3"]+ executable project.externalTool("python3")ignoreExitValue = truestandardOutput = outputerrorOutput = outputdiff --git a/gradle/validation/missing-docs-check.gradle b/gradle/validation/missing-docs-check.gradleindex 2b24e791258..57399ecdd8d 100644--- a/gradle/validation/missing-docs-check.gradle+++ b/gradle/validation/missing-docs-check.gradle@@ -100,7 +100,7 @@ class CheckMissingDocsTask extends DefaultTask {def checkMissingJavadocs(File dir, String level) {def output = new ByteArrayOutputStream()def result = project.exec {- executable project.externalToolExecutables["python3"]+ executable project.externalTool("python3")ignoreExitValue = truestandardOutput = outputerrorOutput = output