[1.x] fix: Fixes sbt runner openbsd support (#9394)

**Problem**
sbt runner script defaults to sbtn, even on the operating system
where sbtn is not available.

**Solution**
This fallbacks to the jvm client.
This commit is contained in:
eugene yokota
2026-08-06 01:17:58 -04:00
committed by Eugene Yokota
parent c78c8a8ac8
commit 606837914e
+44 -29
View File
@@ -199,8 +199,7 @@ acquire_sbtn () {
archive_target="$p/sbtn-${arch}-pc-linux-${sbtn_v}.tar.gz"
url="https://github.com/sbt/sbtn-dist/releases/download/v${sbtn_v}/sbtn-${arch}-pc-linux-${sbtn_v}.tar.gz"
else
echoerr_error "sbtn is not supported on $arch"
exit 2
return 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
arch="universal"
@@ -211,8 +210,7 @@ acquire_sbtn () {
archive_target="$p/sbtn-x86_64-pc-win32-${sbtn_v}.zip"
url="https://github.com/sbt/sbtn-dist/releases/download/v${sbtn_v}/sbtn-x86_64-pc-win32-${sbtn_v}.zip"
else
echoerr_error "sbtn is not supported on $OSTYPE"
exit 2
return 1
fi
if [[ -f "$target" ]]; then
@@ -746,7 +744,7 @@ process_args () {
-d|-debug|--debug) sbt_debug=1 && addSbt "-debug" && shift ;;
-client|--client) use_sbtn=1 && shift ;;
--server) use_sbtn=0 && shift ;;
--jvm-client) use_sbtn=0 && use_jvm_client=1 && addSbt "--client" && shift ;;
--jvm-client) use_sbtn=0 && use_jvm_client=1 && shift ;;
--no-hide-jdk-warnings) hide_jdk_warnings=0 && shift ;;
-mem|--mem) require_arg integer "$1" "$2" && addMemory "$2" && shift 2 ;;
@@ -828,13 +826,17 @@ detectNativeClient() {
fi
}
# Run native client if build.properties points to 1.4+ and has SBT_NATIVE_CLIENT
isRunNativeClient() {
# Run client (sbtn or jvm verion) if build.properties points to 1.4+ and has SBT_NATIVE_CLIENT
isRunClient() {
# sbt new/init should not use native client as it needs to run outside a project
if [[ "$sbt_new" == "true" ]]; then
echo "false"
return
fi
if [[ "$use_jvm_client" == "1" ]]; then
echo "true"
return
fi
sbtV="$build_props_sbt_version"
[[ "$sbtV" == "" ]] && sbtV="$init_sbt_version"
[[ "$sbtV" == "" ]] && sbtV="0.0.0"
@@ -858,25 +860,40 @@ isRunNativeClient() {
fi
}
runNativeClient() {
vlog "[debug] running native client"
detectNativeClient
[[ -f "$sbtn_command" ]] || acquire_sbtn "$sbtn_version" || {
exit 1
}
for i in "${!original_args[@]}"; do
if [[ "${original_args[i]}" = "--client" ]]; then
unset 'original_args[i]'
fi
done
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
sbt_script="$0.bat"
else
sbt_script="$0"
runClient() {
if [[ "$use_jvm_client" != "1" ]]; then
detectNativeClient
[[ -f "$sbtn_command" ]] || acquire_sbtn "$sbtn_version" || {
use_jvm_client="1"
}
fi
if [[ "$use_jvm_client" == "1" ]]; then
vlog "[debug] running jvm client"
addSbt "--client"
addDefaultMemory
addSbtScriptProperty
addJdkWorkaround
set -- "${residual_args[@]}"
argumentCount=$#
run
else
vlog "[debug] running native client"
set -- "${residual_args[@]}"
argumentCount=$#
for i in "${!original_args[@]}"; do
if [[ "${original_args[i]}" = "--client" ]]; then
unset 'original_args[i]'
fi
done
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
sbt_script="$0.bat"
else
sbt_script="$0"
fi
sbt_script=${sbt_script/ /%20}
execRunner "$sbtn_command" "--sbt-script=$sbt_script" "${original_args[@]}"
fi
sbt_script=${sbt_script/ /%20}
execRunner "$sbtn_command" "--sbt-script=$sbt_script" "${original_args[@]}"
}
original_args=("$@")
@@ -942,10 +959,8 @@ java_version="$(jdk_version)"
vlog "[process_args] java_version = '$java_version'"
checkJava17ForSbt2
if [[ "$(isRunNativeClient)" == "true" ]] && [[ -z "$print_version" ]]; then
set -- "${residual_args[@]}"
argumentCount=$#
runNativeClient
if [[ "$(isRunClient)" == "true" ]] && [[ -z "$print_version" ]]; then
runClient
else
addDefaultMemory
addSbtScriptProperty