Skip to content

Commit

Permalink
SOLR-17490: Check for existence of perl executable and skip if it doe…
Browse files Browse the repository at this point in the history
…snt exist (#2753)
  • Loading branch information
epugh authored Nov 16, 2024
1 parent c9d3885 commit 586ed00
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions gradle/documentation/changes-to-html.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
}
}
}

0 comments on commit 586ed00

Please sign in to comment.