From 586ed007925cfb3a52f791fa1e3facc1b75fe397 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sat, 16 Nov 2024 08:04:03 -0500 Subject: [PATCH] SOLR-17490: Check for existence of perl executable and skip if it doesnt exist (#2753) --- gradle/documentation/changes-to-html.gradle | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 + } + } }