Commit Graph

18027 Commits

Author SHA1 Message Date
kenji yoshida 2dbc85ffcf
[2.x] ci: Avoid deprecated replaceAllLiterally (#9173)
- b4aa12d2b0
- https://github.com/scala/scala/blob/v2.12.21/src/library/scala/collection/immutable/StringLike.scala#L177-L184
- https://github.com/scala/scala3/blob/3.8.2/library/src/scala/collection/StringOps.scala#L746-L747
2026-05-03 12:40:44 -04:00
kenji yoshida 590dbbacb8
Avoid infix syntax in build files (#9175) 2026-05-03 12:40:00 -04:00
eugene yokota 4847f31219
Merge pull request #9176 from xuwei-k/source-3-7-option
[2.x] Remove "-source:3.7" option
2026-05-03 12:39:10 -04:00
eugene yokota 3bef48d366
Merge pull request #9174 from xuwei-k/project-Utils-unused
[2.x] Remove unused code in `project/Utils.scala`
2026-05-03 12:38:44 -04:00
xuwei-k a377790ed7 Remove "-source:3.7" option 2026-05-03 21:02:56 +09:00
xuwei-k 871706bf83 Remove unused code in project/Utils.scala 2026-05-03 16:53:26 +09:00
eugene yokota 5586488f6c
[2.x] fix: Adjust the forked test classpath (#9170)
**Problem**
We can't test WorkerMain using forked test.

**Solution**
Allow WorkerMain to be shadowed.
2026-05-03 02:36:00 -04:00
eugene yokota 4ec3a753e7
[2.x] fix: Fix build.sbt file loading in subdirs (#9165)
**Problem**
Projects defined in subdirectory build.sbt files are
not correctly resolved to the base directory relative to the file.

**Solution**
Call resolveBase.
2026-05-02 21:17:55 -04:00
Matt Dziuban 5757955fc7
[2.x] Fix console output not appearing with bgRun and run / fork := true (#9166)
Bug 1: bgRun forks with inheritIO() instead of LoggedOutput

bgRunTask / bgRunMainTask resolve their fork options via (run / forkOptions), which inherits run / connectInput := true. That has two downstream consequences:

1. ForkRun.configLogged (in run/src/main/scala/sbt/Run.scala) skips installing OutputStrategy.LoggedOutput(log) whenever config.connectInput == true.
2. Fork.apply (in run/src/main/scala/sbt/Fork.scala) sees connectInput && outputStrategy == StdoutOutput and takes the interactiveFork path, which calls jpb.inheritIO().

Bug 2: Background-job log relay drops messages after the spawning task ends

Even after Bug 1 is fixed, LoggedOutput routes the forked process's stdout into the background ManagedLogger, whose appenders include a shared RelayAppender. The relay calls CommandExchange.logMessage(event), which uses isChannelOwner(c) to pick the target channel.
2026-05-02 14:04:10 -04:00
kenji yoshida 0af7c2f4a6
[2.x] test: Add more ClassLoaderLayeringStrategy.Raw test (#9163) 2026-05-01 00:33:09 -04:00
kenji yoshida 71a5ad6448
[2.x] test: Add javaagent test (#9164) 2026-05-01 00:29:16 -04:00
eugene yokota 4a02167fa4
[2.x] feat: ClassLoaderStrategy.Raw (#9161)
**Problem**
In sbt 2.x, forking still creates layered classloader in the worker process,
which doesn't work for some tests.

**Solution**
This provides an escape hatch to emulate the sbt 1.x semantics of
using the system classpath for testing.
2026-04-30 12:35:30 -04:00
kenji yoshida b3d16be556
[2.x] fix: Fix error with "-language:postfixOps" (#9151) 2026-04-29 13:21:26 -04:00
kenji yoshida ddd888dc42
[2.x] Remove duplicate packageSrc/mappings (#9156) 2026-04-29 08:58:36 -04:00
kenji yoshida dd1eb78e8a
Remove unnecessary code in build.sbt (#9154) 2026-04-29 08:56:08 -04:00
kenji yoshida 2893bff7ca
[2.x] ci: Filter NOTICE file (#9155) 2026-04-29 08:45:08 -04:00
kenji yoshida 01fbc474f1
[2.x] ci: Avoid infix syntax in build files (#9157) 2026-04-29 08:41:54 -04:00
eugene yokota 0968cbf7ef
[2.x] perf: Use bytecodeHash for incremental test (#9146)
**Problem**
There's perf issue building ClassStamp for the incremental test.

**Solution**
This reuses the bytecodeHash created during compilation.
2026-04-29 03:27:04 -04:00
kenji yoshida c9c90978e4
[2.x] ci: Avoid postfix in build files (#9150) 2026-04-29 03:13:17 -04:00
kenji yoshida 3d64237122
[2.x] ci: Update sbt and sbt-scalafmt plugin (#9148) 2026-04-29 03:12:09 -04:00
jimcody1995 0f2c973452
[2.x] fix: Avoid dependencyTree browse crashes on Linux (#9147)
**Problem**
`dependencyTree` with `--browse` can throw when desktop browse is unavailable (for example on Wayland/headless environments), causing command failure.

**Solution**
Handle unsupported desktop/browse actions and runtime browse failures gracefully by logging a warning instead of throwing, and add regression tests for unsupported/throwing desktop scenarios.

Generated-by: Cursor Codex 5.3
2026-04-27 22:12:14 -04:00
eugene yokota cd5fb7f7fb
[2.x] fix: Remove will-be-ignored warning (#9143)
**Problem**
run warns about jvm option not being applied,
but it is applied for client-side run.

**Solution**
Remove the warning.
2026-04-27 03:18:47 -04:00
eugene yokota 5b9553af9e
[2.x] Bump sbtn to 2.0.0-RC13 (#9140) 2026-04-27 01:03:42 -04:00
eugene yokota 64463535ca
[2.x] refactor: Replace string Array with ju.List (#9138)
**Problem**
Scala 3 supposedly has problem with String array in structural types.

**Solution**
This works around the issue by using ju.List.
2026-04-27 00:22:30 -04:00
eugene yokota 4617a6ca05
[2.x] fix: Fixes compilerPlugin(...) to ignore platform (#9135)
**Problem**
When using scala-native, we can't enable semanticdb etc
because of the platform-level platform.

**Solution**
Since compilerPlugin(...) is always going to be JVM,
just add an explicit JVM platform to the given ModuleID.
2026-04-26 15:14:51 -04:00
Ali Rashid 9275bda052
[2.x] feat: Expose `scripted / excludeFilter` and `scripted / includeFilter` keys for scripted test filtering. (#9131)
* [2.x] feat: Add scripted / includeFilter and scripted / excludeFilter

* [2.x] Add scripted-exclude-filter scripted test. Remove stale item from Scripted.sbtWindowsExcludeFilter
2026-04-26 14:31:42 -04:00
eugene yokota d132926197
Merge pull request #9130 from eed3si9n/wip/ignore-ctrl-c
[2.x] fix: Fixes ctrl-c handling
2026-04-25 18:03:50 -04:00
Eugene Yokota bf678f2d6a [2.x] fix: Fixes ctrl-c handling
**Problem**
Ctrl-C during client-side run gets interpreted in sbtn,
and shuts down the shell.

**Solution**
Ignore ctrl-c during client-side run.
2026-04-25 03:36:32 -04:00
eugene yokota 8d6627929d
[2.x] desp: Gigahorse 0.9.4 (#9125) 2026-04-23 23:40:54 -04:00
Zainab Ali 3b1dbae74a
[2.x] Add Test configuration to evictionWarningOptions (#9102)
* Add Test configuration to evictionWarningOptions
* Add Test configuration to default evictionWarningOptions
* Deduplicate eviction errors based on callers.
* Update eviction error test for semantic versioning.
* Group evictions by configuration and update test.
2026-04-23 23:06:54 -04:00
eugene yokota b98c4f8984
[2.x] fix: Fixes managedScalaInstance false support (#9121)
**Problem**
When managedScalaInstance is set to false, we stopped creating
ScalaInstance, but the documentation says the user can
pull in their own dependencies.

**Solution**
Attempt to construct a ScalaInstance from update report
even when managedScalaInstance is set to false.
2026-04-23 00:30:32 -04:00
volcano303 ac0f3f5c6f
[2.x] fix: Cache AutoPlugin projectSettings/projectConfigurations (#9077)
- Cache AutoPlugin.projectSettings and projectConfigurations via AutoPluginCache so they are evaluated once per plugin instance during build loading, not once per subproject (N×M → M)
- Make GroupedAutoPlugins.globalSettings a lazy val and pre-compute buildSettingsMap to avoid repeated aggregation
2026-04-21 23:50:28 -04:00
Anatolii Kmetiuk 4ebacc6e05
[2.x] fix: Include platform suffix in Artifact.artifactName (#9118) 2026-04-21 22:58:34 -04:00
Matthias Kurz 1f0b0e1bfa
[2.x] ci: Update sbt-java-formatter (#9098) 2026-04-21 12:19:44 -04:00
kenji yoshida d2da9ce1e6
[2.x] refactor: Use exists instead of find and isDefined (#9111) 2026-04-19 00:27:39 -04:00
Matt Dziuban b721644cbc
[2.x] fix: Use rootPaths to replace virtual paths in console and doc scalac options. (#9110)
Rather than using the FileConverter to replace virtual paths, this uses the rootPaths directly. It only replaces a virtual path in a scalac option if the given segment of the option begins with the root path key.
2026-04-18 03:29:45 -04:00
eugene yokota af0cbaf74e
Merge pull request #9112 from xuwei-k/duplicate-hedgehog
[2.x] Remove duplicate hedgehog TestFramework setting
2026-04-18 03:21:31 -04:00
eugene yokota 95152f9745
Merge pull request #9083 from xuwei-k/mimaPreviousArtifacts-RC12
[2.x] Update mimaPreviousArtifacts
2026-04-18 03:05:57 -04:00
xuwei-k 639a19d262 Update mimaPreviousArtifacts 2026-04-18 15:38:09 +09:00
Matthias Kurz 083dba59d6 [2.x] add no-op addDependencyTreePlugin shim for migration (#9067)
(cherry picked from commit e515decfc5)
2026-04-18 15:37:57 +09:00
xuwei-k 349e91da04 Remove duplicate hedgehog TestFramework setting 2026-04-18 08:22:42 +09:00
Dream 81b81ce6b0
[2.x] fix: Fix consoleProject for Scala 3 (#9073)
**Problem**
consoleProject does not work with Scala 3 because the compiler bridge
does not implement REPL binding injection (scala/scala3#5069).
The bindings currentState, extracted, and cpHelpers are never
injected into the REPL session, causing Not found errors.

**Solution**
Work around the missing binding support by storing the three runtime
objects in a static holder (ConsoleProjectBindings) before launching
the REPL, and generating val definitions via initialCommands that
read from the holder. The original bindings are still passed to
Console to preserve Scala 2 backward compatibility.

Pass -Xrepl-interrupt-instrumentation:local to the REPL when the
consoleProject scala instance is 3.8 or newer. In local mode the
instrumented loader skips re-defining classpath classes and falls
through to standard parent-first delegation, so REPL code sees the
same singleton sbt.* and scala.* classes as the surrounding sbt
process — while still keeping interrupt support for REPL-defined code,
preserving Ctrl+C on long-running expressions like
(Compile / compile).eval.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 01:37:24 -04:00
Clayton ef90ca0540
[2.x] feat: Forward test events to listeners as they are emitted (#9087)
Test report listeners now receive testEvent callbacks as the underlying test framework emits events, instead of only after a whole group finishes. startGroup / endGroup timing is aligned with that streaming model for both in-process and forked test runs.

No public API changes - only listener callback timing and the internal worker <-> sbt JSON-RPC protocol.
2026-04-16 00:58:06 -04:00
kenji yoshida 9d620f3b1f
[2.x] refactor: Use Files.writeString instead of Files.write (#9093) 2026-04-15 22:29:19 -04:00
Full Stack Developer 60cbde453f
[2.x] feat: Implement BSP buildTarget/dependencyModules (#9085)
- implement BSP buildTarget/dependencyModules endpoint support in sbt
2026-04-14 23:07:51 -04:00
Jonathan Chang dd93c92ebc
[2.x] feat: Add English aliases cross and switch for + / ++ (#9051)
Fixes #3137. Adds discoverable English-name alternatives for the symbolic
cross-build commands using the | parser combinator, making them more
beginner-friendly without adding separate commands.
2026-04-14 23:03:48 -04:00
kenji yoshida 8bcc6ae420
[2.x] refactor: Use `IO.withTemporaryDirectory` instead of `File.createTempFile` (#9084)
* Use IO.withTemporaryDirectory instead of File.createTempFile

* fix JUnitXmlTestsListenerSpec
2026-04-13 15:07:32 -04:00
bitloi 840887820c
[2.x] fix: Fix FileAlreadyExistsException in packageDirectory (#9047)
**Problem**
Intermittent java.nio.file.FileAlreadyExistsException when publishing
classes.sbtdir.zip during action-cache packaging under parallel tasks
(#9043). Copying from a temp directory straight into the final path races
on the fixed destination name.

**Solution**
Stage the built zip next to the destination with a unique temp file, then
replace the final path via Files.move with REPLACE_EXISTING and ATOMIC_MOVE,
falling back to a non-atomic move when needed. Add a concurrent
packageDirectory test.

Closes #9043

Generated-by: Cursor (AI-assisted)
2026-04-13 04:30:45 -04:00
bitloi 936a7e1ffb
[2.x] fix: clear compiler bridge zinc cache on reboot dev (#9057)
Reboot dev now removes zinc/org.scala-sbt under the resolved global zinc
directory (same layout as ZincComponentManager secondary cache).

Closes #5735
2026-04-13 04:28:43 -04:00
eugene yokota 25dd9b7363
[2.x] fix: Fixes client-side run status (#9081)
**Problem**
In sbt 2.x, if we execute a run task from the shell,
and if the program fails, it ends up taking down the entire shell
because client-side run rethrows, which is not desirable
for the sbt shell.

**Solution**
1. Omit printing out success for ClientJobParams, which is the runinfo.
2. Print out success or error on the client-side for shell usage case.
2026-04-13 00:41:35 -04:00