You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2020/08/23 18:16:31 UTC

[lucene-solr] branch master updated: LUCENE-9474: Make external tools configurable like in ant through those sysprops: perl.exe, python3.exe, python2.exe

This is an automated email from the ASF dual-hosted git repository.

uschindler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new 494a8a8  LUCENE-9474: Make external tools configurable like in ant through those sysprops: perl.exe, python3.exe, python2.exe
494a8a8 is described below

commit 494a8a8e04b88f8b4ca8ce1958580ede5ecba538
Author: Uwe Schindler <us...@apache.org>
AuthorDate: Sun Aug 23 20:16:22 2020 +0200

    LUCENE-9474: Make external tools configurable like in ant through those sysprops: perl.exe, python3.exe, python2.exe
---
 build.gradle                                | 7 +++++++
 gradle/documentation/changes-to-html.gradle | 2 +-
 gradle/generation/jflex.gradle              | 2 +-
 gradle/generation/kuromoji.gradle           | 2 +-
 gradle/generation/snowball.gradle           | 2 +-
 gradle/generation/util.gradle               | 4 ++--
 gradle/validation/check-broken-links.gradle | 2 +-
 gradle/validation/missing-docs-check.gradle | 2 +-
 8 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/build.gradle b/build.gradle
index 571ab30..ec5fed0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -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.
diff --git a/gradle/documentation/changes-to-html.gradle b/gradle/documentation/changes-to-html.gradle
index 8d8c02e..5f56532 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 "perl"
+      executable project.externalToolExecutables["perl"]
       standardInput changesFile.newInputStream()
       standardOutput project.file("${targetDir.get().getAsFile()}/Changes.html").newOutputStream()
       errorOutput = output
diff --git a/gradle/generation/jflex.gradle b/gradle/generation/jflex.gradle
index 9bdbc2c..1f5feb2 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 = "python"
+          executable = project.externalToolExecutables["python2"]
           workingDir = target.parentFile
           standardOutput = output
           args += [
diff --git a/gradle/generation/kuromoji.gradle b/gradle/generation/kuromoji.gradle
index 2f55c1a..c865a13 100644
--- a/gradle/generation/kuromoji.gradle
+++ b/gradle/generation/kuromoji.gradle
@@ -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
diff --git a/gradle/generation/snowball.gradle b/gradle/generation/snowball.gradle
index 6f7049e..b2b6882 100644
--- a/gradle/generation/snowball.gradle
+++ b/gradle/generation/snowball.gradle
@@ -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]
       }
     }
diff --git a/gradle/generation/util.gradle b/gradle/generation/util.gradle
index 597b60a..d1a3c24 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 "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"]
           }
         }
diff --git a/gradle/validation/check-broken-links.gradle b/gradle/validation/check-broken-links.gradle
index bebfe45..2810475 100644
--- a/gradle/validation/check-broken-links.gradle
+++ b/gradle/validation/check-broken-links.gradle
@@ -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
diff --git a/gradle/validation/missing-docs-check.gradle b/gradle/validation/missing-docs-check.gradle
index e465997..e9cb6ae 100644
--- a/gradle/validation/missing-docs-check.gradle
+++ b/gradle/validation/missing-docs-check.gradle
@@ -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