fix: Fix sbt --client on Windows

**Problem**
sbt --client doens't work on Windows because the runner script
passes itself to the server, but it's unable to launch Bash script.

**Solution**
Pass in the bat version instead on Windows.
This commit is contained in:
Eugene Yokota 2025-03-16 22:33:53 -04:00
parent 1b4a345406
commit ff4825ccff
2 changed files with 11 additions and 2 deletions

View File

@ -161,7 +161,8 @@ jobs:
# test building sbtn on Linux
sbt "-Dsbt.io.virtual=false" nativeImage
# smoke test native Image
./client/target/bin/sbtn shutdown
./client/target/bin/sbtn --sbt-script=$(pwd)/sbt about
./client/target/bin/sbtn --sbt-script=$(pwd)/sbt shutdown
# test launcher script
echo build using JDK 8 test using JDK 8 and JDK 11
cd launcher-package
@ -189,6 +190,9 @@ jobs:
run: |
# test building sbtn on Windows
sbt "-Dsbt.io.virtual=false" nativeImage
# smoke test native Image
./client/target/bin/sbtn --sbt-script=$(pwd)/launcher-package/src/universal/bin/sbt.bat about
./client/target/bin/sbtn --sbt-script=$(pwd)/launcher-package/src/universal/bin/sbt.bat shutdown
# test launcher script
echo build using JDK 8, test using JDK 8, on Windows
cd launcher-package

7
sbt
View File

@ -805,7 +805,12 @@ runNativeClient() {
unset 'original_args[i]'
fi
done
sbt_script=$0
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[@]}"
}