Skip to content

Commit 5d1f348

Browse files
authored
Merge pull request #494 from gradle/erichaagdev/invalid-jvm-error
Invalid JVM version error message is handled in the scripts
2 parents be5e5b5 + 8ed2ee0 commit 5d1f348

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

components/scripts/lib/build-scan-offline.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
readonly READ_BUILD_SCAN_DATA_JAR="${LIB_DIR}/build-scan-clients/build-scan-summary-${SUMMARY_VERSION}.jar"
44

5+
# Build scan summary exit codes
6+
readonly SUCCESS=0
7+
readonly JVM_VERSION_NOT_SUPPORTED=3
8+
59
build_scan_dumps=()
610

711
find_and_read_build_scan_dumps() {
@@ -28,16 +32,19 @@ find_build_scan_dump() {
2832
}
2933

3034
read_build_scan_dumps() {
31-
local build_scan_data args
32-
args=()
35+
local args build_scan_data build_scan_summary_exit_code
3336

34-
args+=(
35-
"0,file://${build_scan_dumps[0]}"
36-
"1,file://${build_scan_dumps[1]}"
37+
args=(
38+
"0,file://${build_scan_dumps[0]}"
39+
"1,file://${build_scan_dumps[1]}"
3740
)
3841

3942
echo "Extracting Build Scan data for all builds"
40-
if ! build_scan_data="$(JAVA_HOME="${CLIENT_JAVA_HOME:-$JAVA_HOME}" invoke_java "$READ_BUILD_SCAN_DATA_JAR" "${args[@]}")"; then
43+
build_scan_data="$(JAVA_HOME="${CLIENT_JAVA_HOME:-$JAVA_HOME}" invoke_java "$READ_BUILD_SCAN_DATA_JAR" "${args[@]}")"
44+
build_scan_summary_exit_code="$?"
45+
if [[ $build_scan_summary_exit_code -eq $JVM_VERSION_NOT_SUPPORTED ]]; then
46+
die "ERROR: Java 17+ is required when using --disable-build-scan-publishing. Rerun the script with Java 17+ or set the CLIENT_JAVA_HOME environment variable to a Java 17+ installation." "$UNEXPECTED_ERROR"
47+
elif [[ $build_scan_summary_exit_code -ne $SUCCESS ]]; then
4148
exit "$UNEXPECTED_ERROR"
4249
fi
4350
echo "Finished extracting Build Scan data for all builds"

0 commit comments

Comments
 (0)