Skip to content

Commit af65807

Browse files
authored
Amend Windows Reproducible Ant Check To Be Less Strict (adoptium#4092)
1 parent 9301202 commit af65807

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

tooling/reproducible/windows_repro_build_compare.sh

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ REPORT_DIR="$3"
4343
# The Defaults Below Are Suitable For An Adoptium Windows Build Environment
4444
# Which Has Been Created Via The Ansible Infrastructure Playbooks
4545
WORK_DIR="/cygdrive/c/comp-jdk-build"
46-
ANT_VERSION="1.10.5"
46+
ANT_VERSION_ALLOWED="1.10"
47+
ANT_VERSION_REQUIRED="1.10.15"
4748
ANT_CONTRIB_VERSION="1.0b3"
4849
ANT_BASE_PATH="/cygdrive/c/apache-ant"
4950
CW_VS_BASE_DRV="c"
@@ -466,30 +467,36 @@ Check_UCRT_Location() {
466467

467468
Check_And_Install_Ant() {
468469
# Check For Existence Of Required Version Of Ant
469-
echo "Checking For Installation Of Ant Version $ANT_VERSION "
470-
if [ ! -r ${ANT_BASE_PATH}/apache-ant-${ANT_VERSION}/bin/ant ]; then
471-
echo "Ant Doesnt Exist At The Correct Version - Installing"
472-
# Ant Version Not Found... Check And Create Paths
473-
echo Downloading ant for SBOM creation:
474-
curl https://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.zip > /tmp/apache-ant-${ANT_VERSION}-bin.zip
475-
(cd /usr/local && unzip -qn /tmp/apache-ant-${ANT_VERSION}-bin.zip)
476-
rm /tmp/apache-ant-${ANT_VERSION}-bin.zip
477-
echo Downloading ant-contrib-${ANT_CONTRIB_VERSION}:
478-
curl -L https://sourceforge.net/projects/ant-contrib/files/ant-contrib/${ANT_CONTRIB_VERSION}/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip > /tmp/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip
479-
(unzip -qnj /tmp/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip ant-contrib/ant-contrib-${ANT_CONTRIB_VERSION}.jar -d /usr/local/apache-ant-${ANT_VERSION}/lib)
480-
rm /tmp/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip
470+
ant_found=false
471+
for ant_path in "${ANT_BASE_PATH}/apache-ant-${ANT_VERSION}"*/bin/ant; do
472+
if [ -r "$ant_path" ]; then
473+
ant_found=true
474+
break
475+
fi
476+
done
477+
if [ "${ant_found}" != true ]; then
478+
echo "Ant Doesn't Exist At The Correct Version - Installing"
479+
# Ant Version Not Found... Check And Create Paths
480+
echo "Downloading ant for SBOM creation:"
481+
curl -o "/tmp/apache-ant-${ANT_VERSION}-bin.zip" "https://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION_REQUIRED}-bin.zip"
482+
(cd /usr/local && unzip -qn "/tmp/apache-ant-${ANT_VERSION_REQUIRED}-bin.zip")
483+
rm "/tmp/apache-ant-${ANT_VERSION_REQUIRED}-bin.zip"
484+
echo "Downloading ant-contrib-${ANT_CONTRIB_VERSION}:"
485+
curl -L -o "/tmp/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip" "https://sourceforge.net/projects/ant-contrib/files/ant-contrib/${ANT_CONTRIB_VERSION}/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip"
486+
(unzip -qnj "/tmp/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip" "ant-contrib/ant-contrib-${ANT_CONTRIB_VERSION}.jar" -d "/usr/local/apache-ant-${ANT_VERSION}/lib")
487+
rm "/tmp/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip"
481488
else
482-
echo "Ant Version: $ANT_VERSION Is Already Installed"
489+
echo "Ant Version: ${ANT_VERSION_ALLOWED}.X Already Installed"
483490
fi
484491
echo ""
485492
# Check For Existence Of Required Version Of Ant-Contrib For Existing Ant
486493
echo "Checking For Installation Of Ant Contrib Version $ANT_CONTRIB_VERSION "
487-
if [ -r ${ANT_BASE_PATH}/apache-ant-${ANT_VERSION}/bin/ant ] && [ ! -r $ANT_BASE_PATH/apache-ant-${ANT_VERSION}/lib/ant-contrib.jar ]; then
494+
if [ -r "${ANT_BASE_PATH}/apache-ant-${ANT_VERSION}/bin/ant" ] && [ ! -r "${ANT_BASE_PATH}/apache-ant-${ANT_VERSION}/lib/ant-contrib.jar" ]; then
488495
echo "But Ant-Contrib Is Missing - Installing"
489496
# Ant Version Not Found... Check And Create Paths
490497
echo Downloading ant-contrib-${ANT_CONTRIB_VERSION}:
491498
curl -L https://sourceforge.net/projects/ant-contrib/files/ant-contrib/${ANT_CONTRIB_VERSION}/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip > /tmp/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip
492-
(unzip -qnj /tmp/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip ant-contrib/ant-contrib-${ANT_CONTRIB_VERSION}.jar -d ${ANT_BASE_PATH}/apache-ant-${ANT_VERSION}/lib)
499+
(unzip -qnj "/tmp/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip" "ant-contrib/ant-contrib-${ANT_CONTRIB_VERSION}.jar" -d "${ANT_BASE_PATH}/apache-ant-${ANT_VERSION}/lib")
493500
rm /tmp/ant-contrib-${ANT_CONTRIB_VERSION}-bin.zip
494501
else
495502
echo "Ant Contrib Version: $ANT_CONTRIB_VERSION Is Already Installed"
@@ -543,7 +550,7 @@ Prepare_Env_For_Build() {
543550

544551
# set --build-reproducible-date if not yet
545552
if [[ "${buildArgs}" != *"--build-reproducible-date"* ]]; then
546-
buildArgs="--build-reproducible-date \"${buildStamp}\" ${buildArgs}"
553+
buildArgs="--build-reproducible-date \"${buildStamp}\" ${buildArgs}"
547554
fi
548555
# reset --jdk-boot-dir
549556
# shellcheck disable=SC2001

0 commit comments

Comments
 (0)