Commit Graph

17934 Commits

Author SHA1 Message Date
Dream 3dd7f939cf
[2.x] fix: Scope dependencyMode filtering to compilation only (#8990)
**Problem**
When dependencyMode := Direct is set, the filtering was applied at
the managedClasspath level, which removed transitive dependencies
from all downstream classpaths including Test / dependencyClasspath.
This caused runtime test failures because transitive deps like
hamcrest-core (pulled in by junit) were missing.

**Solution**
Move the dependencyMode filtering from managedClasspath to a new
filteredDependencyClasspath task, and wire dependencyPicklePath
(the classpath used by the compiler) to use it. Runtime classpaths
like dependencyClasspath and fullClasspath remain unfiltered,
preserving all transitive dependencies for test execution.

Fixes #8989
2026-03-29 23:13:06 -04:00
kenji yoshida 9936f9c07c
Update mima settings (#8991) 2026-03-29 23:03:20 -04:00
Dream 9a48ed818f
[2.x] fix: Preserve configuration visibility in ivy.xml when publishing with coursier (#8988)
**Problem**
When publishing with coursier, the `visibility` attribute of `<conf />`
elements in `ivy.xml` was hardcoded to `"public"`. Configurations
defined as hidden (e.g. `scala-tool`) were incorrectly published with
`visibility="public"` instead of `"private"`.

The root cause was that `Inputs.configExtendsSeq` only extracted config
names and extends relationships, discarding the `isPublic` flag from
sbt's `Configuration` objects.

**Solution**
Add a `privateConfigNames: Set[String]` field to the lmcoursier
`Project` data class (with `@since` for backward compatibility).
Populate it from `Configuration.isPublic` in `CoursierInputsTasks`,
and use it in both `IvyXml` implementations to set the correct
visibility attribute.

Fixes sbt/sbt#5455
2026-03-29 00:37:00 -04:00
Dream f624998c91
[2.x] fix: Avoid following symlinks during scripted test cleanup (#8985)
**Problem**
When a scripted test creates a symbolic link within the test directory
pointing to a file or directory outside of it, the batch cleanup code
follows the symlink and deletes the external target. This is because
`view.list(base / **, !keep)` recursively traverses symlinked
directories, and the resulting paths resolve to the external location.

**Solution**
Replace the flat recursive glob listing with manual recursion that
checks `FileAttributes.isSymbolicLink` before descending into
directories, matching the pattern already used in `Clean.scala`.
Symlinks are now deleted as leaf nodes without traversing their targets.

Also hoists the cleanup helpers out of the per-test loop since they
only depend on the (constant) temp directory.

Fixes sbt/sbt#7331
2026-03-28 13:10:06 -04:00
BitToby f81a1524bb
[2.x] fix: Stabilize progress indicator sort (#8984)
When multiple tasks run in parallel, the super shell progress lines reorder in a semi-random manner on every refresh because they are sorted by raw elapsed microseconds. Tasks that start at nearly the same time constantly swap positions due to sub-second timing jitter, making the display hard to read.

This fixes the sort key to use elapsed seconds (rounded down) with task name as a tiebreaker, matching the granularity already shown to the user (e.g. 3s). Tasks displaying the same elapsed second now stay alphabetically stable instead of flickering.
2026-03-26 18:17:30 -04:00
BitToby 99471da5f1
[2.x] fix: Fix ProjectMatrix base directory resolution for source dependencies (#8983)
**Problem**

ProjectMatrix.baseSettings computes sourceDirectory and unmanagedBase using base.getAbsoluteFile, which resolves relative paths against the JVM's working directory. This works fine within a single build, but breaks for source dependencies - when an external build loaded via ProjectRef(file("ext/lib"), "lib") uses projectMatrix.in(file(".")), the file(".") resolves to the root project's directory instead of ext/lib/.

As a result, the matrix project picks up wrong sources and compilation fails.

**Solution**
Replace base.getAbsoluteFile with IO.resolve((ThisBuild / baseDirectory).value, base). Since ThisBuild / baseDirectory is set per build unit during loading, this correctly resolves against each build's own root directory.

sourceDirectory and unmanagedBase now derive from the resolved projectMatrixBaseDirectory setting.
2026-03-25 22:41:56 -04:00
kenji yoshida bece316725
[2.x] test: Update ZincComponentCompilerSpec (#8979) 2026-03-25 01:18:14 -04:00
eugene yokota 3c34579c18
[2.x] Update to Zinc 2.0.0-M15 (#8980) 2026-03-25 01:15:21 -04:00
kenji yoshida f98c4ce139
[2.x] Update ErrorMessageAuthenticator. Remove unnecessary reflection (#8976) 2026-03-24 23:59:50 -04:00
BrianHotopp b362a0ba91
[2.x] fix: Emit <type> in POM for non-jar explicit artifacts (#8975)
PomGenerator never emitted <type> for dependencies with explicit
artifacts, so a WAR dependency would appear in the POM without
<type>war</type>. Maven then treats it as a JAR dependency, resolving
the wrong artifact.

Uses the primary (non-classifier) artifact to determine the type,
so .withSources()/.withJavadoc() classifier artifacts don't produce
spurious <type>doc</type> or <type>src</type> elements.

Fixes #1979

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 23:51:01 -04:00
Anatolii Kmetiuk 81d379f12d
[2.x] Fix Resolvers test formatting (#8968) 2026-03-23 21:47:42 -04:00
Anatolii Kmetiuk a9347cf220
Merge commit from fork
* Harden Windows VCS URI fragments against command injection

- Use Process(argv) for git/hg/svn without cmd /c on Windows
- Add VcsUriFragment.validate for fragments in clone/checkout/update
- Add tests

* Allowlist-based approach to VCS string sanitization
2026-03-23 20:12:58 -04:00
dependabot[bot] baf455ecf6
build(deps): bump nick-fields/retry from 3.0.2 to 4.0.0 (#8965)
Bumps [nick-fields/retry](https://github.com/nick-fields/retry) from 3.0.2 to 4.0.0.
- [Release notes](https://github.com/nick-fields/retry/releases)
- [Commits](ce71cc2ab8...ad984534de)

---
updated-dependencies:
- dependency-name: nick-fields/retry
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-23 19:41:56 -04:00
Dream 8132a392c3
[2.x] feat: Add dependencyMode setting to control classpath transitivity (#8960)
**Problem**
sbt always includes all transitive dependencies on the classpath.
This makes it easy to accidentally depend on transitive dependencies
without declaring them, leading to fragile builds that break when
a library changes its own dependencies.

**Solution**
Add a `dependencyMode` setting with three modes:

- DependencyMode.Transitive (default) — current behavior, all
  transitive dependencies on the classpath
- DependencyMode.Direct — only declared dependencies plus
  scala-library on the classpath
- DependencyMode.PlusOne — declared dependencies plus their
  immediate transitive dependencies plus scala-library

Fixes sbt/sbt#8942
2026-03-23 16:30:16 -04:00
Daniil Sivak 9939666a33
[2.x] fix: server-test and related refactoring (#8904)
- TestServer was replaced with ServerSession class, which is located in protocol module and allows you to interact with JSON-RPC sbt server.
2026-03-21 23:45:37 -04:00
ckstck 33c9bbdbe2
[2.x] fix: libraryDependency didn't work for cross-platform dependencies (#8957)
Problem
libraryDependencySchemes didn't work for platforms like Scala.JS

Solution
Modified EvictionError.scala to extract the suffix.
Changed from _: Binary to b: Binary and added ${b.suffix} to the module name.

---------

Co-authored-by: oolokioo7 <loki021107@gmail.com>
2026-03-21 22:43:17 -04:00
BrianHotopp d1468f414a
[2.x] Fix misleading error message when .evaluated is used outside macro context (#8951)
Fixes #1144

The compileTimeOnly message on wrapInitInputTask said "`value` can
only be called on an input task..." when the user called `.evaluated`,
not `.value`. Changed to say `evaluated` and suggest `.toTask(" <args>").value`
as an alternative.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 19:27:53 -04:00
Philippus Baalman 7b23ee96d3
[2.x] Replace defunct link (#8950) 2026-03-21 14:23:26 -04:00
kenji yoshida 6dcb601f73
Add scalafmt newlines.topLevelStatementBlankLines setting (#8949) 2026-03-21 02:58:49 -04:00
kenji yoshida cf80230738
[2.x] test: Delete sbt-test/project/continuations (#8948) 2026-03-20 23:04:53 -04:00
kenji yoshida 535891f9f7
[2.x] test: Enable sbt-test/project/auto-plugins (#8947) 2026-03-20 23:03:11 -04:00
kenji yoshida 8c4cc2b912
[2.x] test: Enable sbt-test/plugins/twirl (#8944) 2026-03-20 22:47:38 -04:00
kenji yoshida de6b28d7fc
[2.x] test: Enable sbt-test/project/skip (#8937) 2026-03-20 21:47:40 -04:00
BitToby 1852b4a454
[2.x] fix: Fix scripted test loading build definition twice on first test in batch (#8946) 2026-03-20 15:45:36 -04:00
kenji yoshida 132443b16e
[2.x] test: Enable sbt-test/project/setting-order (#8936) 2026-03-20 12:59:34 -04:00
kenji yoshida 8cbff8f003
[sbt] test: Enable sbt-test/run/fork (#8943) 2026-03-20 12:59:09 -04:00
eugene yokota 9a1c41ab1e
[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-20 12:31:14 -04:00
xuwei-k 90f46971c6 Remove return statement in Escapes.scala 2026-03-20 15:04:50 +09:00
xuwei-k 5a74ba3992 Remove return statement in CommandExchange.scala 2026-03-20 15:04:42 +09:00
xuwei-k 324f863d60 Remove return statements in UpdateReportPersistenceBenchmark 2026-03-20 15:04:34 +09:00
xuwei-k 87d8ae3a6c Use IO.withTemporaryDirectory in UpdateReportPersistenceSpec 2026-03-20 15:04:25 +09:00
kenji yoshida 3602f056fc
[2.x] test: Enable sbt-test/project/giter8-plugin (#8935) 2026-03-20 01:38:43 -04:00
kenji yoshida f0492085f4
[2.x] test: Enable sbt-test/project/src-plugins (#8934) 2026-03-20 01:38:11 -04:00
xuwei-k 3c0f90ce12 Enable sbt-test/plugins/unidoc scripted test 2026-03-20 10:20:56 +09:00
xuwei-k 4310528ede Enable sbt-test/plugins/dotty-compiler-plugin 2026-03-20 10:20:50 +09:00
xuwei-k e13186fd22 Avoid deprecated URL constructor 2026-03-20 10:20:30 +09:00
BitToby be305eb3a5
fix: Use sbt script in BSP config instead of hardcoded Java path (#8920)
**Problem**

sbt bspConfig writes the absolute path of the current Java binary into .bsp/sbt.json. When the user switches Java versions (via sdkman, cs java, etc.) or removes that JDK, the IDE fails to start the sbt BSP server because the hardcoded path is stale or gone.

**Solution**

When an sbt launcher script is available (via `sbt.script` system property or PATH lookup), generate:

"argv": ["/path/to/sbt", "bsp"]
2026-03-19 20:57:53 -04:00
kenji yoshida f92c06155c
Delete sbt-test/lm-coursier/neo-sbt-scalafmt (#8931) 2026-03-19 20:41:45 -04:00
corevibe555 9994552750
deps: Updatge launcher to 1.6.1 (#8923) 2026-03-19 20:26:18 -04:00
kenji yoshida b839d308e1
[2.x] refactor: Use new Array instead of Array.fill (#8929) 2026-03-19 20:18:47 -04:00
kenji yoshida a6a1cf383e
[2.x] refactor: Update EscHelpers.scala (#8928) 2026-03-19 20:14:04 -04:00
kenji yoshida e0a067da99
[2.x] Update Parser.~.unapply (#8927) 2026-03-19 20:12:22 -04:00
kenji yoshida b8ab0031f1
[2.x] refactor: Remove unnecessary unchecked annotation (#8926) 2026-03-19 20:11:01 -04:00
kenji yoshida 0608a660da
[2.x] refactor: Reduce return statements (#8925) 2026-03-19 20:09:31 -04:00
bitloi b24ecddbd6
[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-19 16:52:14 -04:00
kenji yoshida 14606c593d
[2.x] ci: Add scalafix DisableSyntax.noReturns (#8922) 2026-03-19 10:48:10 -04:00
BitToby 963acca8ad
[2.x] fix: Preserve user-specified scope axes in command instead of silently discarding them (#8916)
**Problem**
set every silently discards scope axes the user provides. Running:

set every Test / sources := Nil

empties sources in **all** scopes including Compile, not just Test. This happens because rescope in SettingCompletions.setAll strips the scope and forces Global.

**Solution**
Changed rescope to keep the user's config/task/extra axes and only wildcard the project axis. When no scope is given, behavior is unchanged - all axes match everything as before.
2026-03-18 00:53:54 -04:00
Anatolii Kmetiuk e6a2b536bf
Merge pull request #8915 from eed3si9n/wip/virtual-file
[2.x] Add VF keys
2026-03-18 11:37:56 +09:00
Eugene Yokota 5a767e3442 [2.x] Add VF keys
**Problem**
java.io.File cannot participate in cached task.

**Solution**
This adds a few VF-equivalent keys so they can participate
in cached task.
2026-03-17 02:33:13 -04:00
Anatolii Kmetiuk a1f6fd2f65
Merge pull request #8912 from bitloi/fix/6694-scala3-eviction-downgrade
[2.x] feat: Eviction error for downgrade of Scala 3.x
2026-03-17 14:19:10 +09:00