Commit Graph

17830 Commits

Author SHA1 Message Date
eugene yokota 8f41553a32
Merge pull request #8962 from eed3si9n/bport/coursier-update
[2.0.x] bport: Update to Coursier 2.1.25-M24
2026-03-22 22:39:13 -04:00
eugene yokota cd343c4cc6 [2.x] fix: Fixes non-typelevel scalaOrganization (#8945)
**Problem**
Coursier used to support only org.typelevel as scalaOrganization override.

**Solution**
This uses the newly added parameter in M24.
2026-03-22 22:09:11 -04:00
bitloi f5261d9e08 [2.x] fix: Skip Conflict when dependency relocations form a cycle (#8919)
**Problem**
Coursier graph.Conflict -> DependencyTree relocation can loop forever when
Maven/Gradle relocation metadata forms a cycle (sbt-site 1.4.1).

**Solution**
Detect relocation cycles with the same step logic as Coursier, skip Conflict
for affected configs, log once per update.

Generated-by: Claude
2026-03-22 22:08:42 -04:00
Michał Pawlik 972cc30ce1 [2.x] fix: use new constructor for CantDownloadModule (#8905) 2026-03-22 22:07:58 -04:00
Michał Pawlik 29d2653bf6 [2.x] Retry on HTTP 5xx during dependency resolution (#8903) 2026-03-22 22:07:31 -04:00
eugene yokota 1bd5a5e409 [2.x] Update to Coursier 2.1.25-M24 (#8381)
This forward ports (https://github.com/coursier/sbt-coursier/pull/570), and follows along some of the migrated methods to work through the deprecations.
2026-03-22 22:05:09 -04:00
eugene yokota db41205098
[2.0.x] fix: Unresolved dependency error for Coursier (#8869) (#8961)
Fixes unresolved dependency path reporting for Coursier (`ResolveException.failedPaths`) and adds a stable scripted regression.

This PR addresses 5168 by reconstructing unresolved dependency caller chains from the Coursier resolution graph and attaching them to `ResolveException.failedPaths`. That allows unresolved warnings to show the full path from the missing module up to the root project.

It also adds and stabilizes `lm-coursier/unresolved-path` scripted coverage by:
- using a local test Maven repo fixture (no flaky remote test dependency)
- checking update stream output via an sbt task (`checkLog`) instead of shell `grep`
- asserting the unresolved path includes missing module, transitive caller, and root project

Co-authored-by: bitloi <89318445+bitloi@users.noreply.github.com>
2026-03-22 21:53:20 -04:00
eugene yokota 023d3ba2c5
[2.0.x] Hide projectDescriptors (#8959)
**Problem**
projectDescriptors key depends on Ivy, and will be removed.

**Solution**
This hides the key in 2.0.x branch.
2026-03-22 02:15:37 -04:00
eugene yokota 6ddbf38d9a
[2.0.x] fix: Fix TaskConvert.appExpr (#8955)
Co-authored-by: kenji yoshida <6b656e6a69@gmail.com>
2026-03-21 17:30:46 -04:00
eugene yokota cf94c29478
[2.0.x] fix: fall back to the onsite task when cache fails (#8890) (#8954)
**Problem**
When the remote cache server (e.g. bazel-remote using S3 for storage) reports an AC (Action Cache)
hit but the underlying CAS (Content Addressable Storage) blob is missing or
corrupt, ActionCache.cache propagates the resulting exception (typically
java.io.FileNotFoundException) directly to the SBT task engine process with no interception of the propogated error.
This causes a build failure instead of a graceful cache miss.

The three unguarded call sites are:
1. organicTask - syncBlobs after a successful put only caught NoSuchFileException,
   missing FileNotFoundException and other IO errors.
2. getWithFailure / readFromSymlink fast-path - syncBlobs inside flatMap with no
   exception handling.
3. getWithFailure main branch - both syncBlobs calls and the subsequent IO.read
   were completely unguarded.

**Solution**
Guard all three call sites with NonFatal catches:
- Cache read failures (getWithFailure) return Left(None) which the caller
  interprets as a cache miss, triggering organic recomputation.
- Cache write failures (organicTask) are demoted to a debug-level log; the task
  result that was already computed is returned successfully.

Two regression tests are added to ActionCacheTest:
1. Tests the main getWithFailure branch using the default relative-path converter.
2. Tests the readFromSymlink fast-path using an absolute-path converter so the
   symlink created on the first run is found by Files.isSymbolicLink on the second.

Co-authored-by: Idan Ben-Zvi <idanbenzvi@users.noreply.github.com>
2026-03-21 17:29:46 -04:00
eugene yokota b4ee7ffc52
[2.x] fix: Undefined per-project settings order (#8953)
Closes #7173

Co-authored-by: Daniil Sivak <seroperson@gmail.com>
2026-03-21 15:49:19 -04:00
eugene yokota 2d375097e4
[2.x] Update semanticdbVersion in SemanticdbPlugin.scala (#8908)
Co-authored-by: kenji yoshida <6b656e6a69@gmail.com>
2026-03-15 05:53:11 -04:00
eugene yokota 009997f4e0
[2.x] Tweak the prompt (#8876) (#8877)
**Problem/Solution**
Tweak the shell prompt to differentiate sbt 1.x vs 2.x.
2026-03-06 00:29:04 -05:00
eugene yokota 8e40cc395a
[2.x] sbtn 1.12.5 (#8860) 2026-03-01 16:54:09 -05:00
eugene yokota 74374a493a
[2.x] fix: support comma-separated imports in build.sbt (#8829) (#8856)
Summary
- Fix `SbtParser.importsToLineRanges` to prepend `import` keyword when missing from Dotty's `Import` AST node source spans
- Add unit test for comma-separated import parsing

Co-authored-by: Renzo <170978465+RenzoMXD@users.noreply.github.com>
2026-03-01 16:10:05 -05:00
eugene yokota 5ce61b7f76
[2.x] fix: Print server stderr on startup failure (#8816) (#8857)
**Problem**
When the sbt server fails to start (e.g. wrong JDK version), the client
only shows "failed to connect to server" hiding the actual error. The
server stderr is redirected to /dev/null to prevent Linux pipe buffer
deadlocks (#8442), so diagnostic output is lost.

**Solution**
Redirect server stderr to a temp file instead of /dev/null. When the
server fails to start (portfile never appears), read and print the temp
file contents before throwing ServerFailedException. The temp file is
cleaned up eagerly on both success and failure paths.

Fixes #8812

Co-authored-by: Dream <42954461+eureka928@users.noreply.github.com>
2026-03-01 15:50:52 -05:00
eugene yokota b6d5acd6c2
[2.x] fix: Runner should fail on JDK < 17 for sbt 2.x (#8825) (#8855)
**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.

Co-authored-by: Dream <42954461+eureka928@users.noreply.github.com>
2026-03-01 05:29:46 -05:00
eugene yokota 660e8f92df
[2.x] fix: IgnoreSourceChanges now works (#8820) (#8853)
Closes #6773

Co-authored-by: Daniil Sivak <seroperson@gmail.com>
2026-03-01 05:29:06 -05:00
eugene yokota 1d6ec91dbc
[2.x] Fix lazy val name handling in Eval (#8818) (#8852)
Co-authored-by: kenji yoshida <6b656e6a69@gmail.com>
2026-03-01 05:28:43 -05:00
eugene yokota 22450b947c
fix: Refer to universal sbtn in detectNativeClient (#8810) (#8850)
** Problem **
sbtn-x86_64-apple-darwin doesn't exist anymore

** Solution **
point to universal binary instead

Co-authored-by: fireXtract <fireXtract@users.noreply.github.com>
2026-03-01 05:28:00 -05:00
eugene yokota bf33f51d10
[2.x] feat: Add allowMismatchScala setting (#8804) (#8849)
sbt 2.x allows `dependsOn(...)` between subprojects with mismatched
Scala versions without any warning or error. This can lead to confusing
classpath issues at compile or runtime, especially now that Scala 3.8+
has dropped backward TASTy compatibility with 2.13.

Per review feedback, move the Scala version mismatch check from
compileTask to projectDependenciesTask, where PR #8681 already handles
Scala version mixing logic. This provides earlier detection and keeps
the validation co-located with cross-version resolution.

Generated-by: Copilot

Co-authored-by: dev-miro26 <121471669+dev-miro26@users.noreply.github.com>
2026-03-01 05:27:40 -05:00
eugene yokota d4d5e72961
[2.x] Comments in dot files (#8841) (#8847)
**Problem**
Hash comments doesn't work in dot files.

**Solution**
This reapplies the comment removal sed,
with improved inline comment handling.
2026-03-01 05:26:58 -05:00
eugene yokota 38acd80147
[2.x] fix: Fixes double quotes handling in fork mode (#8846)
When using the arguments file (`@argsfile`) mechanism for forked runs,
double quotes inside arguments were not escaped, causing the JVM's
argument file parser to strip them. For example, passing `{"a":1}` as
an argument would result in `{a:1}`.

Escape `"` as `\"` in `createArgumentsFile`, matching the existing
backslash escaping, so the JVM correctly round-trips quoted arguments.

Fixes sbt/sbt#7129

Co-authored-by: BrianHotopp <brihoto@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 03:44:30 -05:00
kenji yoshida f976330759
Scala 3.8.2 (#8805) 2026-02-24 00:29:44 -05:00
kenji yoshida af57abe1ce
[2.x] test: Avoid old varargs splice syntax in test (#8806) 2026-02-24 00:18:11 -05:00
kenji yoshida 2688f7153c
[2.x] test: Use new wildcard syntax in test (#8807) 2026-02-24 00:15:37 -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
it-education-md cb498de41d
[2.x] fix: Fixes plugin toggle precedence between disablePlugins and enablePlugins (#8794)
Treat explicit plugin toggles as last-call-wins for the same plugin.
This avoids contradictory include/exclude states when disablePlugins(X) is followed by
enablePlugins(X) (and vice versa), aligning behavior with normal override expectations.

Apply the same semantics to ProjectMatrix and add regression coverage:
- unit tests in main/src/test/scala/ProjectSpec.scala
- scripted test in sbt-app/src/sbt-test/project/i1926-disable-enable-plugin
2026-02-23 00:11:57 -05:00
kenji yoshida 62d7b9a29f
[2.x] refactor: Use foreach instead of map (#8793) 2026-02-22 23:47:12 -05:00
kenji yoshida b3401a009e
[2.x] refactor: Remove unnecessary asInstanceOf (#8791) 2026-02-22 23:46:21 -05:00
kenji yoshida 62e43711f2
[2.x] refactor: Remove redundant conversions (#8786) 2026-02-22 23:44:17 -05:00
bitloi 20f4a9c3b2
[2.x] fix: Fixes java++ tab completion (#8778)
Fixes #4310

Per review, the OOM comes from the version parser - token(StringBasic)
on the right side of || has no examples constraint. Move
.examples(knownVersions*) from the inner number parser to wrap the
entire || expression, so both alternatives are bounded.
2026-02-22 23:43:38 -05:00
kenji yoshida c3a00771b3
[2.x] refactor: Use minBy instead of sortBy and head (#8792) 2026-02-22 22:23:15 -05:00
kenji yoshida 4dd0a9c89c
Use collectFirst instead of collect and headOption (#8789) 2026-02-22 22:22:38 -05:00
kenji yoshida 808dfefa59
[2.x] refactor: Fix Aggregation.printSettings pattern matching (#8790) 2026-02-22 22:21:50 -05:00
kenji yoshida fe1caa8ddf
Use enum instead of scala.Enumeration in sbt.Execute.State (#8788) 2026-02-22 22:21:29 -05:00
kenji yoshida 8c23c5ea60
Use foreachEntry instead of foreach if Map (#8787) 2026-02-22 22:21:08 -05:00
kenji yoshida 611cea8fbd
Add tailrec annotations (#8785) 2026-02-22 22:20:46 -05:00
kenji yoshida b7b3947b81
[2.x] refactor: Remove unnecessary nowarn annotation (#8784) 2026-02-22 19:25:45 -05:00
kenji yoshida 17ca2b3931
Fix raw types in java file (#8782) 2026-02-22 14:32:52 -05:00
kenji yoshida c1ada47c29
Fix warnings. Avoid copyArrayToImmutableIndexedSeq (#8781) 2026-02-22 06:04:21 -05:00
eugene yokota b1bfb6e627
[2.x] Fallback to HOME/.config/sbt (#8780)
**Problem/Solution**
When XDG_CONFIG_HOME is not defined, we should fallback to HOME/.config/sbt.
2026-02-22 00:02:30 -05:00
bitloi 861fbccaea
[2.x] fix: Fixes autoScalaLibrary in test classloader (#8776)
When Test / autoScalaLibrary := false, build the non-fork test classloader
without the ScalaInstance layer: use Flat strategy and project classpath
only (rawCP), so tests do not see sbt's scala-library and avoid
NoSuchMethodError / version mismatch (e.g. scala/scala build).

- ClassLoaders.testTask: read autoScalaLibrary; when false use Flat and
  rawCP-only fullCP, and do not add si.libraryJars to exclude.
- Add scripted test tests/autoScalaLibrary-test-loader that runs test
  with Test / autoScalaLibrary := false.
2026-02-21 14:59:46 -05:00
it-education-md ae1066ed12
[2.x] fix: Prefer direct key selection for testFull at root (#8775)
**Problem**
`testFull` can select an aggregate-only key before a directly defined root key.
In issue #8772 this causes root project tests to be skipped, so a failing root test can pass unexpectedly.

**Solution**
Prefer directly defined keys in `Act.select`, and only fall back to aggregate-only candidates when no direct key exists.
Add scripted regression test `tests/i8772-root-project-testfull` and keep `project/extra-projects-key-aggregate` behavior intact.
2026-02-21 03:05:25 -05:00
Douglas Ma a7d5f45515
[2.x] fix: Reject java.io.File as cached task output type (#8766)
Change the behavior when a cached task's output type contains
java.io.File: instead of silently skipping the cache, throw a
compile-time error with a message recommending xsbti.VirtualFileRef,
xsbti.HashedVirtualFileRef, or xsbti.VirtualFile, and linking to the
caching documentation.

Internal sbt tasks that return File types are wrapped with
Def.uncached to opt out of caching.

Fixes https://github.com/sbt/sbt/issues/8762

Generated-by: GitHub Copilot (Claude)

* [2.x] fix: Reject java.io.File as cached task output type

Use @transient on File-returning keys in Keys.scala instead of
wrapping tasks with Def.uncached in Defaults.scala. This ensures
build users who rewire these tasks also get caching skipped
automatically.

- Add @transient to 19 File-returning taskKey definitions in Keys.scala
- Revert Def.uncached wrappers from Defaults.scala
- Error at compile time when File is used as cached task output type
- Update error message to recommend @transient and link to docs
- Update scripted tests to use @transient approach

Fixes #8762

Generated-by: GitHub Copilot (Claude Opus 4.6)
2026-02-21 01:35:46 -05:00
Rikito Taniguchi 4a5701cb8e
[2.x and 1.x] Respect `scalaOrganization` in compiler bridge resolution (#8732)
**Problem**
`scalaOrganization` was ignored during compiler bridge resolution because `ZincLmUtil.getDefaultBridgeModule` hard-coded `ScalaArtifacts.Organization` (`org.scala-lang`).

**Solution**
Add a `scalaOrganization` parameter to `ZincLmUtil` methods, and passing `scalaOrganization` value to those methods.

Generated-by: Claude Opus 4.6
2026-02-21 01:11:10 -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
NeedmeFordev 2f14fd8bb1
implemente using PrettyPrinter instead of CompactPrinter (#8773) 2026-02-20 22:39:41 -05:00
xuwei-k 167b5d04ba Update sbt plugins 2026-02-21 09:27:34 +09:00