Commit Graph

113 Commits

Author SHA1 Message Date
eugene yokota 2d18eadd2c
[2.x] Comments in dot files (#8841)
**Problem**
Hash comments doesn't work in dot files.

**Solution**
This reapplies the comment removal sed,
with improved inline comment handling.
2026-03-01 02:54:12 -05:00
kenji yoshida f64b5288ca
[2.x] ci: Update launcher-package rpmUrl (#8833) 2026-02-28 12:48:26 -05:00
bitloi 58f34117ca
[2.x] perf: short-circuit --version from build.properties (#8822)
Avoid launching sbt just to render --version by reading sbt.version directly from project/build.properties in the shell script, batch script, and sbtw wrapper. Tighten launcher integration assertions to verify version output no longer depends on the sbtVersion command output.
2026-02-27 12:02:17 -05:00
Dream 28d877f633
[2.x] fix: Runner should fail on JDK < 17 for sbt 2.x (#8825)
**Problem**
Running sbt 2.x with JDK 8 produces a confusing "server was not
detected" error because the JDK version check only required JDK 8+
and only ran in the non-native-client path.

**Solution**
Move java_version detection before the native client decision and add
checkJava17ForSbt2 that requires JDK 17+ when sbt major version >= 2.

Fixes #8813

* [2.x] fix: Fail early when sbt 2.x is run with JDK < 17 (sbtw)

Move JDK version check before native client decision in sbtw and
require JDK 17+ when build.properties declares sbt 2.x.

* [2.x] fix: Fail early when sbt 2.x is run with JDK < 17 (sbt.bat)

Move checkjava before native client decision in sbt.bat and require
JDK 17+ when build.properties declares sbt 2.x.

* [2.x] test: Add minimumJdkVersion helper and unit tests for sbtw

Extract JDK version check logic into Runner.minimumJdkVersion for
testability. Add RunnerSpec with tests for sbt 1.x, 2.x, and 3.x
version detection.

* [2.x] test: Bump fake java to JDK 17 for integration tests

The fake java script used by launcher integration tests reported
JDK 8. Since sbt 2.x now requires JDK 17+, the citest2 (sbt 2.x)
integration tests would fail with the new JDK version check.

* Simulate JDK 9+ rt.jar handling in fake java script

Instead of silently ignoring --rt-ext-dir (which causes sbt.bat
to mkdir on an empty string), properly simulate JDK 9+ behavior
by creating a temp directory with java9-rt-ext- prefix and a
dummy rt.jar inside it.
2026-02-27 11:43:24 -05:00
eugene yokota 32c5637dc9
[2.x] test: Add Git Bash test on Windows (#8779) 2026-02-25 22:51:52 -05:00
kenji yoshida f976330759
Scala 3.8.2 (#8805) 2026-02-24 00:29:44 -05:00
eugene yokota 4b3c525c22
Revert "[2.x] fix: Handle JVM parameters with spaces in dot files (#8730)" (#8797)
This reverts commit 921efce541.
Ref https://github.com/sbt/sbt/issues/8767

**Problem**
On Git Bash on Windows, we get a cryptic error Invalid maximum heap size: -Xmx2G.

**Solution**
Revert.
2026-02-23 02:41:29 -05:00
eugene yokota 0eff5369d9
[2.x] fix: Remove global.base setting in runner script (#8795)
**Problem**
1. It's difficult to find out when Process fails.
2. global.base setting isn't needed in sbt runner script.

**Solution**
1. Forward to stderr as it happens.
2. Remove global.base setting in the runner script.
2026-02-23 01:39:15 -05:00
bitloi c6f67d706f
[2.x] feat: XDG directory standard (#8769)
- Add SysProp.defaultGlobalBaseDirectory: uses SBT_CONFIG_HOME,
  XDG_CONFIG_HOME/sbt (Unix), LOCALAPPDATA/sbt (Windows), else ~/.sbt
- BuildPaths.defaultGlobalBase delegates to SysProp for consistent default
- sbt script: inject -Dsbt.global.base from XDG when not already set;
  getPreloaded() fallback uses SBT_CONFIG_HOME/XDG_CONFIG_HOME
- sbt.bat: use LOCALAPPDATA/sbt when --sbt-dir not set
- Tests: BuildPathsTest (property + absolute path), RunnerScriptTest (XDG)
2026-02-20 23:32:48 -05:00
Lazz 02d9d4c699
[2.x] fix: Support inline comments in .jvmopts and .sbtopts files (#8758)
**Problem**
After PR #8730 (commit 921efce), inline comments in .jvmopts and .sbtopts files cause errors.
For example, `--add-opens=java.base/java.util=ALL-UNNAMED # comment` results in:
Error: Could not find or load main class #

The # and everything after it is now parsed as separate arguments instead of being stripped as a comment.

**Solution**
Update the sed command in outputConfigFileTokens() to strip inline comments (everything from # to end of line) before parsing tokens.

The new s/\s*\#.*// pattern matches optional whitespace + # + rest of line and removes it.

Generated-by: Claude Sonnet 4.5
2026-02-17 14:42:16 -05:00
bitloi f870b60b7c
[2.x] feat: sbtw launcher (#8742)
- Add sbtwProj: Scala 3.x 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
2026-02-16 16:21:30 -05:00
PandaMan 921efce541
[2.x] fix: Handle JVM parameters with spaces in dot files (#8730)
**Problem**

The sbt launcher script used naive word splitting when parsing `.sbtopts` and `.jvmopts`, so arguments with spaces were split incorrectly. For example, `-J--add-modules jdk.incubator.concurrent` in `.sbtopts` and `-Dtest.key="value with spaces"` in `.jvmopts` were not passed to the JVM as intended.
2026-02-14 03:17:44 -05:00
Pluto 0cae58403f
[2.x] fix: handle --version in sbt 2.x project dirs (sbt#8717) (#8735)
**Problem**
`sbt --version` in sbt 2.x project directories was delegated to the native client, which could try to start/connect to a server instead of printing version info.

**Solution**
Skip native-client delegation when `--version` is requested, and add runner-script tests for sbt 1.x and 2.x project variants.
2026-02-13 09:10:51 -08:00
PandaMan de2c27abeb
[2.x] fix: handle --script-version sbt 2.x project dirs (#8715)
When in an sbt 2.x project directory, the script used to delegate to sbtn
before checking --script-version, so 'sbt --script-version' ran sbtn and
failed. Now we print the script version and exit before the native client
branch.
2026-02-07 22:16:21 -05:00
eugene yokota 499ec520a7
[2.x] require coreutils for RPM (#8712)
**Problem**
Apparently sbt can fail when it doesn't have rm,
which can happen "when building relocatable RPM's and building an OS image in a chroot."

**Solution**
It was suggested that we require coreutils.
2026-02-07 17:23:39 -05:00
Pluto 12deebba2b
[2.x] fix: restore CLI precedence over .sbtopts
According to the issue, `.sbtopts` entries are appended after
CLI args in sbt 1.12.x, so `.sbtopts` JVM memory settings (e.g., `-Xmx2g`) override CLI `--mem`,
causing invalid JVM settings.
2026-02-05 18:04:55 -05:00
eugene yokota 5ba750059c
[2.x] Bump to sbtn 1.12.1 (#8683) 2026-02-03 02:05:50 -05:00
eugene yokota 40ef381fa2
[2.x] ExtendedRunnerTest (#8674)
Problem/Solution
Looks like this needs to be reformatted.
2026-02-01 22:25:10 -05:00
PandaMan 461e12d497
[2.x] fix: Handle paths with parentheses in sbt.bat on Windows (#8656)
Windows CMD interprets parentheses as special syntax for command grouping.
When the project directory path contains parentheses (e.g., in username),
the batch script fails with ') was unexpected at this time.' error.

This fix stores the current directory in a variable using delayed expansion
(!CURRENT_DIR!) instead of using %CD% directly, which properly handles
paths containing parentheses and other special characters.

Fixes #8644
2026-01-29 16:51:06 -05:00
eugene yokota ba8c340a2b
Merge pull request #8530 from eed3si9n/wip/scala-3.8.0
[2.x] deps: Update to Scala 3.8.1
2026-01-25 02:07:52 -05:00
Dairus 7a9775c87d
Add integration test for bspConfig & embedded launcher jar (fixes #7794) (#8597)
This adds a scripted integration test to verify that the `bspConfig` task correctly generates a valid BSP connection file (`.bsp/sbt.json`) when the embedded launcher JAR is present in the classpath.
2026-01-24 15:05:51 -05:00
Eugene Yokota 19ca2911d2 Scala 3.8.1 2026-01-24 04:52:28 -05:00
circlecrystalin 55e75faee2
[2.x] fix: Fix flaky client tests (#8580) 2026-01-22 05:35:13 -05:00
calm 37c6eb2cd9
[2.x] test: Add test for sbt --client startup time (#8599)
* Add test for sbt --client startup time
* Skip startup time test on macOS due to slow hostname resolution
2026-01-21 20:00:00 -05:00
circlecrystalin 2f348a09b9
[2.x] fix: Fixes the handling of special characters in dot files (#8558)
- Replace 'eval echo $line' with 'printf "%s\n" "$line"' in loadConfigFile()
- Prevents shell expansion of special characters like |, *, &, etc.
- Fixes issue where properties with pipes, wildcards, and ampersands
  caused 'command not found' or 'unexpected' errors
- Add test to verify special characters are handled correctly on all platforms
2026-01-19 14:37:08 -05:00
E.G 1efebeaa98
fix: Handle -X JVM options on command line (fixes #5742) (#8566)
Previously, passing JVM options like -Xmx1G directly on the command
line would result in an error:

  sbt -v -Xmx1G
  [error] Expected ';'
  [error] -Xmx1G
  [error]       ^

This was because -X options were being passed to sbt as commands
instead of being recognized as JVM arguments.

Changes:
- Added handling for -X options in sbt.bat to pass them to the JVM
- Updated help text to document this feature
- Added integration tests for the new functionality
2026-01-17 14:29:30 -05:00
SID bb02c3331c
[2.x] fix: Fix sbtopts files priority in sbt launch script (#8514)
* Fix sbtopts files priority in sbt launch script (fixes #7179)

- Change project .sbtopts from prepend to append so it appears last
2026-01-13 13:30:13 -05:00
MkDev11 28f7957307
[2.x] fix: Fix sbt new argument parsing on Windows (#8509)
Only recombine split -- arguments after new/init command.

Fixes #7507
2026-01-13 05:19:19 -05:00
MkDev11 d4570e3359
[2.x] fix: Skip native client for sbt new/init commands (#8512)
Fixes #7497
2026-01-13 05:18:05 -05:00
eugene yokota 4606c90f69
[2.x] ci: Integrate launcher package (#8485)
**Problem/Solution**
This is a follow up to launcher package migrating to sbt 1.x.
This joins the launcher package into the main build.
2026-01-11 20:57:59 -05:00
xuwei-k 813078695f Avoid deprecated java.net.URL constructor
- https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/net/URL.html#%3Cinit%3E(java.lang.String)
- https://bugs.openjdk.org/browse/JDK-8295949
2026-01-12 08:46:04 +09:00
eugene yokota 61899ecd16
ci: Use slash syntax in build.sbt (#8481) 2026-01-11 15:46:00 -05:00
MkDev11 bbeeb25422
[2.x] fix: Upgrade launcher-package to sbt 1.10.7 and replace dispatch-http (#8465)
Fixes #7826

Changes:
- Upgrade sbt version from 0.13.18 to 1.10.7 in launcher-package/project/build.properties
- Remove dead dispatch-http 0.8.10 dependency from plugins.sbt
- Update sbt-native-packager from 1.7.6 to 1.10.4 (com.github.sbt)
- Update sbt-pgp from 2.1.2 to 2.3.1
- Replace all dispatch.classic._ HTTP calls with Java URL.openStream()

The dispatch-http library is dead and doesn't support sbt 1.x. This change
uses standard Java networking APIs for HTTP downloads, eliminating the
dependency on outdated libraries.

All HTTP download operations now use:
- java.net.URL.openConnection()
- InputStream with buffered reading
- Proper resource cleanup with try-finally blocks

- Removes the sbt-export-repo plugin dependency
- Defines exportRepo and exportRepoDirectory settings locally
- Removes ExportRepoPlugin from dist project
- Fixes exportRepo task to not reference itself

* fix: Update PackageSignerPlugin.scala for sbt 1.x compatibility
- Use withExtension instead of copy(extension = ...) for Artifact
- Update Classpaths.publishConfig to use sbt 1.x signature with all required parameters
- Use new slash syntax for scoped keys (pgpSigner / skip instead of skip in pgpSigner)

* fix: Use computed status instead of status key in PackageSignerPlugin

* fix: Use withRevision instead of copy for ModuleID in build.sbt

- Add scala.sys.process._ import for shell command execution (! method)
- Fix resolvers setting to use new slash syntax and proper Option handling
- Fix publish/publishLocal to use {} instead of () to avoid deprecation warning
- Fix Classpaths.publishTask to use variant without delivery key (deprecated since 1.1.1)
- Add scala.sys.process._ import for shell command execution
- Fix publish/publishLocal to use {} instead of ()
- Remove problematic resolvers setting that caused task/setting dependency issues
- Use IvyActions.publish directly instead of deprecated Classpaths.publishTask
- Fix ModuleID.copy to use withRevision
- Fix Artifact.copy to use withExtension
- Use computed status value instead of status key

Build now compiles successfully with sbt 1.10.7.
2026-01-11 07:17:24 -05:00
xuwei-k 2d14adc721 avoid deprecated scala.App
7ddf329f6f/library/src/scala/App.scala (L65)
2026-01-09 20:10:28 +09:00
mkdev11 79ab58f4af Add regression test for debug options in SBT_OPTS (#8100) 2026-01-06 14:21:03 +02:00
mkdev11 17f03201d3 Fix debug options breaking launcher on Windows
Filter rt-ext-dir output for java9-rt-ext- pattern, matching the
Unix script behavior. This prevents debug agent stdout (e.g.,
'Listening for transport dt_socket at address: 1234') from being
incorrectly parsed as a file path.

Fixes #8100
2026-01-06 11:00:25 +02:00
Eugene Yokota e3f99d39cb Merge branch '1.12.x' into wip/merge-1.12.x 2026-01-05 00:08:21 -05:00
eugene yokota 03d57c5803
Merge pull request #8413 from sideeffffect/1.11.x-JDK_JAVA_OPTIONS
[1.x] Handle JDK_JAVA_OPTIONS
2025-12-17 18:09:27 -05:00
Ondra Pelech d48895df85 Handle JDK_JAVA_OPTIONS 2025-12-12 15:44:25 +01:00
xuwei-k 70960744e7 Scala 2.12.21 2025-12-09 17:28:03 +09:00
Eugene Yokota 5730383340 Merge branch '1.12.x' into wip/merge-1.12.x 2025-11-24 02:14:17 -05:00
Eugene Yokota bd460ae536 Test using JDK 25 2025-09-28 05:53:40 -04:00
Eugene Yokota 51aa789346 Suppress JDK 25 warnings 2025-09-28 04:17:50 -04:00
Eugene Yokota 64dcdafc07 Merge branch '1.11.x' into wip/merge-1.11.x 2025-09-17 23:35:59 -04:00
xuwei-k 64357d7e2a Scala 3.7.3 2025-09-09 12:31:28 +09:00
Eugene Yokota 9186f23839 sbt 1.11.6 2025-09-06 18:42:39 -04:00
Eugene Yokota 9783cd092b Merge branch '1.11.x' into wip/merge-1.11.x 2025-08-25 02:29:12 -04:00
Eugene Yokota 94d20176d9 sbtn 1.11.5 2025-08-24 05:50:16 -04:00
Eugene Yokota af967705e9 Make integrationTest sequential 2025-08-24 04:28:57 -04:00
Eugene Yokota 70070fcf06 Comment out version number tests 2025-08-24 02:04:34 -04:00