Skip to content

Commit

Permalink
Excavator: Update gradle-jdks infrastructure plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot committed Nov 12, 2024
1 parent 79b302c commit a0c5831
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ buildscript {

dependencies {
classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.6.0'
classpath 'com.palantir.gradle.jdks:gradle-jdks:0.55.0'
classpath 'com.palantir.gradle.jdks:gradle-jdks:0.56.0'
classpath 'com.palantir.gradle.jdkslatest:gradle-jdks-latest:0.16.0'
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.19.0'
classpath 'com.palantir.gradle.failure-reports:gradle-failure-reports:1.13.0'
Expand Down
25 changes: 14 additions & 11 deletions gradle/gradle-jdks-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ fi
TMP_WORK_DIR=$(mktemp -d)
export TMP_WORK_DIR

# writing to stderr
write() { echo "$*" >&2; }

cleanup() {
[ -d "$TMP_WORK_DIR" ] && rm -rf "$TMP_WORK_DIR"
}

die() {
echo
echo "$*"
echo
write
write "$*"
write
cleanup
exit 1
} >&2
Expand Down Expand Up @@ -115,17 +118,17 @@ install_and_setup_jdks() {
major_version_dir=${dir%*/}
major_version=${major_version_dir##*/}
if [ "$major_version" = "8" ]; then
echo "Skipping JDK 8 installation as it is not supported by Gradle JDKs Setup."
write "Skipping JDK 8 installation as it is not supported by Gradle JDKs Setup."
continue
fi
distribution_local_path=$(read_value "$major_version_dir"/"$OS"/"$ARCH"/local-path)
distribution_url=$(read_value "$major_version_dir"/"$OS"/"$ARCH"/download-url)
# Check if distribution exists in $GRADLE_JDKS_HOME
jdk_installation_directory="$GRADLE_JDKS_HOME"/"$distribution_local_path"
if [ ! -d "$jdk_installation_directory" ]; then
echo "JDK installation '$jdk_installation_directory' does not exist, installing '$distribution_url' in progress ..."
write "JDK installation '$jdk_installation_directory' does not exist, installing '$distribution_url' in progress ..."
elif [ ! -f "$jdk_installation_directory/bin/java" ]; then
echo "Java executable not found in $jdk_installation_directory/bin/java, re-installing the JDK...."
write "Java executable not found in $jdk_installation_directory/bin/java, re-installing the JDK...."
else
continue
fi
Expand All @@ -134,19 +137,19 @@ install_and_setup_jdks() {
mkdir -p "$in_progress_dir"
cd "$in_progress_dir" || die "failed to change dir to $in_progress_dir"
if command -v curl > /dev/null 2>&1; then
echo "Using curl to download $distribution_url"
write "Using curl to download $distribution_url"
case "$distribution_url" in
*.zip)
distribution_name=${distribution_url##*/}
curl -C - "$distribution_url" -o "$distribution_name"
tar -xzf "$distribution_name"
;;
*)
curl -k -C - "$distribution_url" | tar -xzf -
curl -C - "$distribution_url" | tar -xzf -
;;
esac
elif command -v wget > /dev/null 2>&1; then
echo "Using wget to download $distribution_url"
write "Using wget to download $distribution_url"
case "$distribution_url" in
*.zip)
distribution_name=${distribution_url##*/}
Expand All @@ -160,11 +163,11 @@ install_and_setup_jdks() {
else
die "ERROR: Neither curl nor wget are installed, Could not set up JAVA_HOME"
fi
cd - || exit
cd - > /dev/null || die "failed to change dir to old pwd: $OLDPWD"

# Finding the java_home
java_home=$(get_java_home "$in_progress_dir")
"$java_home"/bin/java -cp "$scripts_dir"/gradle-jdks-setup.jar com.palantir.gradle.jdks.setup.GradleJdkInstallationSetup jdkSetup "$jdk_installation_directory" || die "Failed to set up JDK $jdk_installation_directory"
echo "Successfully installed JDK distribution in $jdk_installation_directory"
write "Successfully installed JDK distribution in $jdk_installation_directory"
done
}
Binary file modified gradle/gradle-jdks-setup.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
# !! Contents within this block are managed by 'palantir/gradle-jdks' !!
if [ -f gradle/gradle-jdks-setup.sh ]; then
if ! . gradle/gradle-jdks-setup.sh; then
echo "Failed to set up JDK, running gradle/gradle-jdks-setup.sh failed with non-zero exit code"
echo "Failed to set up JDK, running gradle/gradle-jdks-setup.sh failed with non-zero exit code" >&2
exit 1
fi
# Setting JAVA_HOME to the gradle daemon to make sure gradlew uses this jdk for `JAVACMD`
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
gradlePluginPortal() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
}
dependencies {
classpath 'com.palantir.gradle.jdks:gradle-jdks-settings:0.55.0'
classpath 'com.palantir.gradle.jdks:gradle-jdks-settings:0.56.0'
}
}
apply plugin: 'com.palantir.jdks.settings'
Expand Down

0 comments on commit a0c5831

Please sign in to comment.