Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-17490: Check for existence of perl executable and skip if it doesnt exist (#2753)

Eric Pugh586ed007925c
diff --git a/gradle/documentation/changes-to-html.gradle b/gradle/documentation/changes-to-html.gradle
index 3b4ca69bf9d..af9d1b5fa9a 100644
--- a/gradle/documentation/changes-to-html.gradle
+++ b/gradle/documentation/changes-to-html.gradle
@@ -76,6 +76,13 @@ class ChangesToHtmlTask extends DefaultTask {
def toHtml(File versionsFile) {
def output = new ByteArrayOutputStream()
+
+ // Check if the perl executable exists
+ if (!perlExists()) {
+ logger.warn("WARNING: Perl is not installed, skipping creating Changes.html")
+ return
+ }
+
def result = project.exec {
executable project.externalTool("perl")
standardInput changesFile.newInputStream()
@@ -114,4 +121,14 @@ class ChangesToHtmlTask extends DefaultTask {
throw new GradleException("Changes file ${changesFile} or Doap file ${changesDoapFile} not found.")
}
}
+
+ def perlExists() {
+ try {
+ def process = "perl -v".execute()
+ process.waitFor()
+ return process.exitValue() == 0
+ } catch (Exception e) {
+ return false
+ }
+ }
}