Commit Graph

17847 Commits

Author SHA1 Message Date
eureka928 1c4094e35d [2.x] refactor: Fix ivyless publish fallbacks and add ivyless publishM2
**Problem**
1. The ivyless publish task had ivyModule.value and publisher.value calls
   inside match/case fallback branches. sbt's macro hoists ALL .value calls
   from ALL match branches as task dependencies regardless of runtime path,
   causing failures when useIvy=false even for supported repo types.
2. publishM2 used publishOrSkip which errors when useIvy=false, but M2
   targets MavenCache which the ivyless path already supports.

**Solution**
1. Remove hoisted .value calls from fallback branches in ivylessPublishTask.
   Replace with direct sys.error calls since these branches handle truly
   unsupported repo types.
2. Add ivylessPublishM2Task using Def.ifS that publishes to MavenCache
   via ivylessPublishMavenToFile when useIvy=false.

Generated-by: Claude claude-opus-4-6
2026-03-03 13:36:10 +01:00
eureka928 e7882b9cd0 [2.x] refactor: Gate Ivy-specific tasks behind useIvy
**Problem**
Several tasks (makePom, makeMavenPomOfSbtPlugin, deliverTask, publisher,
publishOrSkip, depMap, GlobalPlugin dependency mapping) unconditionally
depend on Ivy infrastructure, preventing ivyless operation.

**Solution**
Add useIvy guards to each task:
- makePom and makeMavenPomOfSbtPlugin: error when useIvy=false
- deliverTask: error when useIvy=false
- publisher: error when useIvy=false
- publishOrSkip: error when useIvy=false
- depMap: return empty map when useIvy=false
- GlobalPlugin.extract: skip ivyModule.dependencyMapping when useIvy=false

Generated-by: Claude claude-opus-4-6
2026-03-03 13:36:10 +01:00
eureka928 8746f5b291 [2.x] refactor: Replace ivyModule with Coursier descriptor in evicted task
**Problem**
The evicted task directly uses ivyModule.value to get a module descriptor.
This creates an unnecessary dependency on Ivy for eviction warnings.

**Solution**
Use dependencyResolution.value.moduleDescriptor() which works with both
Ivy and Coursier resolvers, removing the direct Ivy coupling from the
eviction checking path.

Generated-by: Claude claude-opus-4-6
2026-03-03 13:36:10 +01:00
Renzo b1db6ba44d
[2.x] feat: support passing JVM arguments via -- delimiter in run commands (#8868)
Summary
- Adds support for passing JVM arguments inline to `run`, `runMain`, `bgRun`, `bgRunMain`, and `fgRun`/`fgRunMain` using `--` as a delimiter
- Syntax: `run <jvmArgs> -- <appArgs>` (e.g., `run -Xmx2G -Dapp.mode=debug -- arg1 arg2`)
- Fully backward compatible — without `--`, all arguments are treated as app args as before
- When `fork` is `false`, a warning is logged that JVM arguments will be ignored
2026-03-02 23:49:10 -05:00
bitloi 09c4856409
[2.x] fix: Unresolved dependency error for Coursier (#8869)
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
2026-03-02 23:21:53 -05:00
Dream 0d01cc0b10
[2.x] refactor: Remove Ivy from update path and decouple lm-coursier from lm-ivy (#8832)
- **Remove `ivyModule` from `updateTask0`**: Replace `IvySbt#Module` with `moduleSettings` + `DependencyResolution.moduleDescriptor()`, eliminating the Ivy dependency in the update path.
- **Replace direct Ivy usage in `Load.scala` and `TemplateCommandUtil`**: Use Coursier's `DependencyResolution` API for plugin bootstrapping and template resolution instead of constructing `IvySbt` instances directly.
- **Break `lm-coursier`'s dependency on `lm-ivy`**: Remove `IvySbt#Module` pattern match from `CoursierDependencyResolution`, replace `IBiblioResolver` usage in `Resolvers` with reflection, and switch build dependencies from `lmIvy` to `lmCore`.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 17:46:15 -05:00
bitloi dfa5e31571
[2.x] fix: make ScopeFilter .all ordering deterministic and preserve project filter order (#8861)
Fixes nondeterministic ordering in `ScopeFilter`-backed `.all(...)` aggregation.

`SettingKeyAll.all` and `TaskKeyAll.all` previously iterated a `Set[Scope]` using `toSeq`, which made returned values order-dependent on hash iteration. This PR keeps `.all(...)` deterministic and preserves explicit project ordering when a filter provides it (for example, `inProjects(c, a, b)`).
2026-03-02 17:42:24 -05:00
eugene yokota 2d583bfe65
[2.x] sbtn 1.12.5 (#8858) 2026-03-01 16:53:29 -05:00
kenji yoshida fb32f78cdb
Remove unnecessary code (#8843) 2026-03-01 02:57:54 -05:00
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 75d9834dec
[2.x] test: Use new wildcard syntax in test build files (#8844) 2026-03-01 02:53:29 -05:00
eugene yokota 677a6cf7a6
[2.x] fix: Fixes double quotes handling in fork mode (#8842)
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 02:44:08 -05:00
kenji yoshida a1314ed05c
Enable DagSpecification.scala (#8840) 2026-03-01 01:53:36 -05:00
kenji yoshida 870e526a00
Avoid private[this] in test build files (#8839) 2026-03-01 01:46:56 -05:00
it-education-md 7b5481ec3c
[2.x] fix: Fix spelling and link in AGENTS docs (#8837)
**Problem**
AGENTS.md contains a spelling typo in a section heading and a broken link for the tech stack document.

**Solution**
- Replaced "Pull reuqest guideline" with "Pull request guideline"
- Fixed tech stack link target to contributing-docs/07_tech_stack.md
2026-03-01 00:25:09 -05:00
it-education-md ead2a93244
[2.x] fix: Fix spelling typos in contributing docs (#8835)
**Problem**
The contributing docs contain spelling typos in unit tests, coding style, and tech stack pages.

**Solution**
Corrected:
- "prefered" -> "preferred" in 04_unit_tests.md
- "exessive" -> "excessive" in 03_coding_style.md
- "concete" -> "concrete" in 07_tech_stack.md
2026-02-28 23:51:01 -05:00
Seth Tisue 191894c471
Merge pull request #8834 from it-education-md/docs/fix-contributing-guidelines-typo
[2.x] fix: Fix typo in CONTRIBUTING.md ("guideslins" -> "guidelines")
2026-02-28 19:05:47 -08:00
it-education-md 77edf6ed3a [2.x] fix: Fix typo in CONTRIBUTING guide
**Problem**
CONTRIBUTING.md contains a typo: "guideslins" in the issue reporting sentence.

**Solution**
Replace "guideslins" with "guidelines" in CONTRIBUTING.md.
2026-02-28 20:44:19 -06:00
Renzo 5271babfa5
[2.x] fix: support comma-separated imports in build.sbt (#8829)
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
2026-02-28 19:12:38 -05:00
bitloi c1475da07c
[2.x] feat: case-insensitive tab completion (#8827)
Replace the custom JLineCompletion fallback with JLine 3's built-in
CASE_INSENSITIVE option on the LineReader, which handles case-insensitive
matching natively. Revert JLineCompletion.scala to its original state.

Fixes #2251
2026-02-28 17:19:02 -05:00
kenji yoshida f64b5288ca
[2.x] ci: Update launcher-package rpmUrl (#8833) 2026-02-28 12:48:26 -05:00
Dream c3e72f79c0
[2.x] fix: Backtick-quote project IDs in classloader error messages (#8830)
When a test fails with ClassNotFoundException/IllegalAccessError, sbt
suggests a set command to change classLoaderLayeringStrategy. If the
project name contains hyphens (e.g. bug-report), the suggested command
was syntactically invalid because it parses as subtraction in Scala.

Quote project IDs using Util.quoteIfNotScalaId so the suggested
commands are valid when copy-pasted.

Fixes #5803
2026-02-28 01:52:55 -05:00
Daniil Sivak 33d86d0cd2
[2.x] fix: IgnoreSourceChanges now works (#8820)
Closes #6773
2026-02-27 22:28:02 -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
Dream 034834bd71
[2.x] feat: Support doc / skip := true (#8824) 2026-02-27 08:41:04 -05:00
since-2017-hub 2ee7c26d1e
[2.x] Fix duplicate compiler bridge jar in ZincComponentManager (#8800)
* Fix duplicate compiler bridge jar in ZincComponentManager
* Fix update method to clean stale stamped jars in ZincComponentManager
* Fix update method to prevent duplicate jars from secondary cache lookups in ZincComponentManagerSpec

Generated-by: GitHub Copilot
2026-02-26 23:58:33 -05:00
bitloi 33ac10c1ce
[2.x] fix: sbt -debug doesn't display loading log (#8819)
* Fix #4979: apply -debug (and other level options) at startup so loading shows debug log

- Parse log level from configuration.arguments in StandardMain.initialState
- Pass initialLevel to GlobalLogging.initial so console appender uses it from first log
- Set Keys.logLevel and BasicKeys.explicitGlobalLogLevels in initial state when level option present
- Add initialLevel parameter to GlobalLogging.initial (default Level.Info) for backward compatibility
- Add InitialLogLevelSpec tests for logLevelFromArguments
- Add docs/fix-4979-manual-verification.md for manual reproduction
2026-02-26 13:50:31 -05:00
kenji yoshida f04093bd9f
[2.x] Fix lazy val name handling in Eval (#8818) 2026-02-26 10:57:27 -05:00
Dream 1a1b1dca4a
[2.x] refactor: Extract color-default logic as a pure function (#8817)
**Problem**
The color-detection logic in Terminal.scala is interleaved with side
effects (system property reads, environment checks) making it hard to
understand and impossible to unit test.

**Solution**
Extract a pure `isColorDefault` function that takes all inputs as
parameters and returns whether color should be enabled. The existing
`useColorDefault` delegates to it. Add unit tests covering all priority
levels and heuristic branches.

Fixes #6050
2026-02-26 01:19:26 -05:00
Dream 8d9a0027e2
[2.x] fix: Print server stderr on startup failure (#8816)
**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
2026-02-26 00:31:09 -05:00
eugene yokota 32c5637dc9
[2.x] test: Add Git Bash test on Windows (#8779) 2026-02-25 22:51:52 -05:00
bitloi 19ebaaafb6
[2.x] perf: lightweight UpdateReport cache persistence (#8815)
- Add UpdateReportCache case class wrapping UpdateReportLite with stats/stamps
- Implement toCache/fromCache for conversion between UpdateReport and cache
- Add readFrom/writeTo for CacheStore persistence with backward compatibility
- Add fromLiteFull to JsonUtil for full reconstruction from lite format
- Update LibraryManagement to use new persistence API
- Add benchmark comparing full vs lite deserialization
- Add unit tests for persistence correctness
- Add scripted test for cache round-trip verification
2026-02-25 22:36:07 -05:00
Daniil Sivak 12cbd877bc
[2.x] fix: excluding artifacts w/o scala version suffix (#7454) (#8756)
**Problem**

Excluding artifacts using `.exclude(org, name)` requires you to
explicitly set scala version in `name`.

**Solution**

- Deprecating `.exclude(org, name)` in favor of new
  `.exclude(OrganizationArtifactName)`
- Fixing `lmcoursier.FromSbt` ignores `excludeRule.crossVersion`
2026-02-25 15:06:16 -05:00
eugene yokota 1a8ac935f9
[2.x] blame ignore commits (#8814)
Ignore formatting commits
2026-02-25 10:51:21 -05:00
fireXtract e007fcf6dc
fix: Refer to universal sbtn in detectNativeClient (#8810)
** Problem **
sbtn-x86_64-apple-darwin doesn't exist anymore

** Solution **
point to universal binary instead
2026-02-24 23:24:00 -05:00
BrianHotopp 87414a8733
[2.x] fix: Fixes double quotes handling in fork mode (#8765)
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: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 23:22:48 -05:00
Angel98518 c031bdd9b1
[2.x] Add project id to Zinc debug log (#8750)
- CompileDebugLogger wraps logger to prefix debug messages with [projectId]
- projectIdFromScope derives id from task scope (avoids HashWriter on ResolvedProject)
- Wire CompileDebugLogger into compileIncrementalTaskImpl and compileJavaTask
- Add CompileDebugLoggerSpec unit test and i408-debug-invalidation-prefix scripted test
2026-02-24 21:55:39 -05:00
dev-miro26 3ca9a388df
[2.x] feat: Add allowMismatchScala setting (#8804)
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
2026-02-24 21:52:44 -05:00
bitloi 130a332100
[2.x] feat: sbtn subscription level (#8796)
Closes #4399

- Add subscribeToAll to InitializeOption (protocol); default true for backward compatibility.
- CommandExchange: send broadcast notifyEvent/logMessage only to channels with subscribeToAll.
- TestServer: support subscribeToAll parameter for tests; AbstractServerTest: subscribeToAllForTest.
- ClientSubscriptionTest: assert default client receives build/logMessage when command runs.
- Scripted test server/client-subscription: run show name to exercise server client path.
2026-02-24 21:46:37 -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