Commit Graph

17905 Commits

Author SHA1 Message Date
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
bitloi 4696b91a17 CI: allowUnsafeScalaLibUpgrade for serverTestProj (Scala 3 eviction) 2026-03-16 17:39:06 +01:00
bitloi 7fc522da65 Refactor: extract reportScalaLibEviction for Scala 2.13 and 3 eviction messages 2026-03-16 17:07:31 +01:00
bitloi 7ad38eb221 [2.x] fix: Eviction error for downgrade of Scala 3.x (#6694)
**Problem**
When scalaVersion is Scala 3.x and a dependency brings a newer
scala3-library_3, sbt did not report an eviction error or warning.
The compiler could be older than the standard library on the
classpath, breaking compile-time alignment (e.g. scala/scala3#25406).

**Solution**
- In Compiler.scala, add an else if ScalaArtifacts.isScala3(sv) branch
  in scalaInstanceConfigFromUpdate that finds scala3-library_* on the
  Compile report and, if scalaVersion < that revision, fails (or warns
  when allowUnsafeScalaLibUpgrade := true) with the same pattern as
  the existing Scala 2.13 check (PR 7480). Message uses compile-time
  alignment wording and "See evicted to know why ... was upgraded from".
- Set allowUnsafeScalaLibUpgrade := true on b3 in stdlib-unfreeze so
  existing b3/run and b3/checkScala still pass.
- Add scripted tests: stdlib-unfreeze-scala3-eviction (expect compile
  to fail) and stdlib-unfreeze-scala3-warn (expect success with warning).

Closes #6694
2026-03-16 01:45:33 +01:00
bitloi f4eff2da77 [2.x] fix: Eviction error for downgrade of Scala 3.x (#6694)
**Problem**
When scalaVersion is Scala 3.x and a dependency brings a newer
scala3-library_3, sbt did not report an eviction error or warning.
The compiler could be older than the standard library on the
classpath, breaking compile-time alignment (e.g. scala/scala3#25406).

**Solution**
- In Compiler.scala, add an else if ScalaArtifacts.isScala3(sv) branch
  in scalaInstanceConfigFromUpdate that finds scala3-library_* on the
  Compile report and, if scalaVersion < that revision, fails (or warns
  when allowUnsafeScalaLibUpgrade := true) with the same pattern as
  the existing Scala 2.13 check (PR 7480). Message uses compile-time
  alignment wording and "See evicted to know why ... was upgraded from".
- Set allowUnsafeScalaLibUpgrade := true on b3 in stdlib-unfreeze so
  existing b3/run and b3/checkScala still pass.
- Add scripted tests: stdlib-unfreeze-scala3-eviction (expect compile
  to fail) and stdlib-unfreeze-scala3-warn (expect success with warning).

Closes #6694
2026-03-16 00:15:43 +01:00
eugene yokota ed501b71bd
[2.x] Simplify -Werror application (#8906) 2026-03-15 04:53:37 -04:00
bitloi e12b3c9b9a
[2.x] fix: Fixes script mode using Scala 3.x (#8900)
**Problem**
Scripts with scalaVersion 3.x in /*** */ and a shebang fail: -Xscript is
ignored by Scala 3, and the shebang line causes "Expected a toplevel
definition".

**Solution**
- Strip shebang when copying the script so the compiler never sees it.
- For Scala 3 only: do not add -Xscript; generate Main.scala wrapping the
  script body in object Main { def main(...) = { ... } }; use it as the
  single source and set run/mainClass to Main.
- For Scala 2: keep existing behavior (shebang stripped, -Xscript + script
  base name).
- Use Def.uncached and ScalaArtifacts.isScala3(scalaVersion.value) so
  embedded scalaVersion from /*** */ is respected.
2026-03-14 23:28:34 -04:00
Michał Pawlik 3f9bafc153
[2.x] fix: use new constructor for CantDownloadModule (#8905) 2026-03-14 14:39:15 -04:00
Michał Pawlik 866497c6e9
[2.x] Retry on HTTP 5xx during dependency resolution (#8903) 2026-03-14 02:24:20 -04:00
eugene yokota 39fa98ef79
[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-13 22:57:38 -04:00
atoz96 b268321412
[2.x] test: Add nested-testquick scripted test (#8901)
**Problem**
The tests/nested-testquick scripted test only verified test and testQuick but did not exercise testOnly against individual test
classes, nor did it verify that a failing nested test class is detected.

**Solution**
- Added GoodCalcTest.java (with a Nested inner class) as a passing test.
- Added changed/BadCalcTest.java (with a Nested`inner class) as a deliberately failing test.
2026-03-13 21:05:43 -04:00
Anatolii Kmetiuk a944018716
Merge pull request #8880 from seroperson/i1284-vcs-project-update
[2.x] feat: updating remote vcs projects
2026-03-13 15:59:06 +09:00
seroperson 6dcce4cf2d
[2.x] fix: addressing review comments 2026-03-13 09:34:32 +03:00
Dream dc90f160df
[2.x] feat: Support --autostart=false and --no-server in sbtn client (#8895)
**Problem**
When sbtn (native thin client) can't find a running sbt server, it prompts
to start one. There was no way to opt out of server auto-start from the
client side, which is needed for CI environments and scripting (sbt/sbt#7079).

**Solution**
Reuse the existing sbt.server.autostart system property in NetworkClient
to control whether sbtn should attempt to start a server. When no server is
running and sbt.server.autostart=false, sbtn exits with an error instead
of prompting.

Support setting this property via:
- sbtn --no-server compile (sets sbt.server.autostart=false)
- sbtn --autostart=false compile (new flag following sbt conventions)
- sbtn -Dsbt.server.autostart=false compile (direct system property)
- sbt --autostart=false compile (bash runner and sbtw)

This follows sbt's naming conventions for properties/options: positive
property names with =false opt-out (like --color=false, --supershell=false).

Fixes sbt/sbt#7079

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 20:51:07 -04:00
seroperson d322b2428c
[2.x] fix: remove staging directory before running tests 2026-03-12 13:17:43 +03:00
seroperson c9fe1635f4
[2.x] feat: updating remote vcs projects
Closes #1284
2026-03-12 13:15:14 +03:00
kenji yoshida ab503ca51e
Fix TaskConvert.appExpr (#8899) 2026-03-12 00:45:29 -04:00
kenji yoshida 5dad0d325f
Format launcher-package/build.sbt (#8898) 2026-03-11 20:11:02 -04:00
Dream b3d2733fb1
[2.x] fix: Remove projectDescriptors key that leaks Ivy types (#8894)
**Problem**
The projectDescriptors key in sbt.Keys leaked Ivy classes
(ModuleRevisionId, ModuleDescriptor) through its API surface.
No external plugins use this key.

**Solution**
Remove projectDescriptors entirely. IvyDependencyPlugin now uses
its internal depMap method directly for projectResolverTask and
coursierExtraProjectsTask, eliminating unnecessary Any casts.
The descriptors field is also removed from GlobalPluginData.

Fixes sbt#8865
2026-03-11 14:53:39 -04:00
kenji yoshida d6e6d28f87
Delete checkPluginCross task. Add sourceGenerators for PluginCross (#8897) 2026-03-11 14:40:49 -04:00
kenji yoshida 5fb9f3c5fa
[2.x] refactor: Use InputStream.transferTo (#8896)
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/io/InputStream.html#transferTo(java.io.OutputStream)
2026-03-11 14:32:40 -04:00
Idan Ben-Zvi 09c76127a3
[2.x] fix: fall back to the onsite task when cache fails (#8890)
**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.
2026-03-11 01:34:01 -04:00
BinaryWorldTl 6821167032
[2.x] fix: Handle scala/toolkit.local when passed as argument to sbt new (#8887)
Running sbt new scala/toolkit.local with the template slug on the command line throws:

The same templates work when chosen from the interactive menu (sbt new with no args). The code path for “arguments provided” only consulted external template resolvers (e.g. Giter8), which do not handle these built-in local templates.
2026-03-10 23:46:51 -04:00
Dream d71fe5b7a3
[2.x] refactor: Extract lm-ivy to separate sbt-ivy plugin module (#8873)
Step 5 of #7640 — removes the compile-time dependency on lm-ivy from main/ by creating a standalone sbt-ivy plugin module.

- Create new sbt-ivy/ subproject with IvyDependencyPlugin AutoPlugin that provides all Ivy-specific functionality (ivySbt, ivyModule, ivyConfiguration, publisher, projectDescriptors, deliver/makeIvyXml)
- Move IvyXml.scala from main/ to sbt-ivy/
2026-03-10 23:30:06 -04:00
kenji yoshida 4f4bc374f6
[2.x] refactor: Delete silent annotation (#8893) 2026-03-10 13:39:02 -04:00
kenji yoshida 963e38256c
[2.x] ci: Update java file formatter plugin (#8892) 2026-03-10 11:19:48 -04:00
PandaMan 1ab9411446
[2.x] Improve -help/--help and fix launcher test harness (#8879)
- sbt script: add 'Getting started' section to usage (create project, help commands)
- sbt script: handle -h/--help without starting JVM, exit 0
2026-03-09 23:11:05 -04:00
kenji yoshida 02c403b7cf
Update semanticdbVersion in SemanticdbPlugin.scala (#8885) 2026-03-09 15:39:13 -04:00
kenji yoshida 1926a693da
Update TemplateCommandUtil.scala (#8884) 2026-03-09 14:27:01 -04:00
kenji yoshida 19da44c4fb
Delete reset.sh (#8886) 2026-03-08 19:22:17 -04:00