Skip to content

[2.x] feat: sbtw launcher#8742

Merged
eed3si9n merged 19 commits intosbt:developfrom
bitloi:feat/sbtw-5406-windows-launcher
Feb 16, 2026
Merged

[2.x] feat: sbtw launcher#8742
eed3si9n merged 19 commits intosbt:developfrom
bitloi:feat/sbtw-5406-windows-launcher

Conversation

@bitloi
Copy link
Copy Markdown
Contributor

@bitloi bitloi commented Feb 15, 2026

Summary

Adds sbtw, a Windows-only drop-in launcher that replaces sbt.bat.

What’s included

  • sbtw module (sbtw/): Scala 3.3.7, scopt-based CLI
    • Config loading: .sbtopts, .jvmopts, sbtconfig.txt, env
    • Launcher options and arg parsing (including --server)
    • Runner: Java discovery, JVM vs native client, memory options
  • Root build: sbtwProj with NativeImagePlugin; target/bin created before native-image to fix CI
  • Release: .github/workflows/sbtw-release.yml — build sbtw on Windows and attach to releases

Testing

  • sbtwProj/compile, sbtwProj/test, sbtwProj/scalafmtCheck pass
  • Native image builds on macOS/Windows CI (directory-creation fix for Graal)

Closes #5406

bitloi and others added 4 commits February 15, 2026 02:12
- Add sbtwProj: Scala 3.3.7 launcher with scopt, drop-in for sbt.bat
- Config: .sbtopts, .jvmopts, sbtconfig.txt, JAVA_OPTS/SBT_OPTS precedence
- Options: --client, --server, --jvm-client, mem, sbt-version, java-home, etc.
- sbt 2.x defaults to native client; --server forces JVM launcher
- JVM run via xsbt.boot.Boot; native via sbtn with --sbt-script
- build.sbt: sbtwProj in root build and allProjects; NativeImagePlugin
- Fixes: JAVA_OPTS then .jvmopts, build.properties trim, shutdownAll PID, Iterator.lastOption
@bitloi bitloi requested a review from eed3si9n February 15, 2026 06:41
@eed3si9n
Copy link
Copy Markdown
Member

Could you test this against the integration tests in https://github.com/sbt/sbt/blob/develop/launcher-package/integration-test/src/test/scala/ directory to see if we can use sbtw as the drop-in replacement for sbt.bat please?

…Dsbt.test.useSbtw=true)

- Add LauncherTestHelper: use sbtw (JVM) when -Dsbt.test.useSbtw=true on Windows
- Wire RunnerScriptTest, RunnerMemoryScriptTest, ExtendedRunnerTest, BspConfigTest
- launcherPackageIntegrationTest depends on sbtwProj
- CI (Windows): run launcherPackageIntegrationTest twice (sbt.bat, then sbtw)
- Workflow comment: verify sbtw native image built, do not run (scopt/Graal)
@bitloi
Copy link
Copy Markdown
Contributor Author

bitloi commented Feb 15, 2026

Could you test this against the integration tests in https://github.com/sbt/sbt/blob/develop/launcher-package/integration-test/src/test/scala/ directory to see if we can use sbtw as the drop-in replacement for sbt.bat please?

Done. Integration tests support sbtw via -Dsbt.test.useSbtw=true on Windows; CI runs them with sbt.bat and with sbtw.

bitloi and others added 4 commits February 15, 2026 12:05
When useSbtw=true, LauncherTestHelper runs 'java -cp ... sbtw.Main' using
java.class.path, which is incomplete in the test JVM. Pass the full test
classpath via -Dsbt.test.classpath in launcherPackageIntegrationTest
(fork=true, javaOptions) and use it in LauncherTestHelper when set.
Resolve sbt script and citest paths relative to integration-test base
directory via sbt.test.integrationtest.basedir, so forked tests no longer
depend on CWD. Fixes 'file not found' on Windows when CWD is not the
integration-test project dir.
bitloi and others added 3 commits February 15, 2026 23:38
…kflow comment

- ArgParser: use optional brace / fewer braces style per sbt coding style
- Runner.runJvm: use Java ProcessBuilder with inheritIO() for interactive sbt
- client-test.yml: clarify why sbtw native image is not smoke-tested
@bitloi bitloi requested a review from eed3si9n February 15, 2026 22:50
Per contributing-docs/03_coding_style.md: object/trait with : and end,
if/while with then/do, fewer braces, colon syntax for lambdas.
@bitloi bitloi requested a review from eed3si9n February 16, 2026 00:18
Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If lazy val causes issues, could you see if the problem can be fixed if we bumped to Scala 3.8.1? If native-image doesn't work, we should drop that from this PR (I'm still ok landing this PR with or without native-image).

@bitloi bitloi requested a review from eed3si9n February 16, 2026 03:12
@bitloi
Copy link
Copy Markdown
Contributor Author

bitloi commented Feb 16, 2026

Tried bumping to 3.8.1 first — native image still builds but the binary crashes at runtime with the same scopt lazy val issue, so that didn’t fix it. I’ve dropped sbtw native-image from this PR (removed from CI and the sbtw project in build.sbt). sbtw is still tested as the JVM runner on Windows.

@eed3si9n eed3si9n changed the title Feat/sbtw 5406 windows launcher [2.x] feat: sbtw launcher Feb 16, 2026
Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bitloi!

@eed3si9n eed3si9n merged commit f870b60 into sbt:develop Feb 16, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sbtw

2 participants