Commit Graph

17737 Commits

Author SHA1 Message Date
Pluto 12deebba2b
[2.x] fix: restore CLI precedence over .sbtopts
According to the issue, `.sbtopts` entries are appended after
CLI args in sbt 1.12.x, so `.sbtopts` JVM memory settings (e.g., `-Xmx2g`) override CLI `--mem`,
causing invalid JVM settings.
2026-02-05 18:04:55 -05:00
Angel98518 949c3ab04f
[2.x] Replace commented System.err.println with proper logger.debug (#8693)
**Problem**
The writeSuite() method in JUnitXmlTestsListener had a commented-out System.err.println statement with a TODO to use proper logging.
2026-02-05 16:22:15 -05:00
bitloi 54548041cf
[2.x] feat: Ivyless Maven repo publish (#8692)
- Add ivylessPublishMavenToFile and ivylessPublishMavenToUrl for Maven layout
- Handle MavenCache and MavenRepo in ivylessPublishTask (file + HTTP)
- Add credentialFor for realm+host credential matching per Publishing docs
- Consume HTTP response body on success to avoid connection leak
- Add scripted tests: ivyless-publish-maven, ivyless-publish-maven-http
2026-02-05 11:21:31 -05:00
bitloi 2f27b5cecd
[2.x] fix: extraProjects with auto-root aggregate breaks key aggregation (#8690)
When using the aggregated key parser, a key is now valid if it exists in `data` for that scope **or** it's an aggregate key and every key it aggregates to exists in `data`. So `(root, scripted)` is accepted when the root aggregates a project that defines `scripted`, and running `scripted` at root runs it on that project as before.
2026-02-04 23:25:47 -05:00
bitloi b460bb871e
[2.x] feat: Ivyless publish to Ivy repo (#8686)
Implements ivyless publish task as part of #7639 (drop Ivy dependency).
Fixes #8639.

- Add ivylessPublish for URLRepository: HTTP PUT with optional Basic auth,
  same layout as ivyless publishLocal (artifacts + ivy.xml + checksums).
- Add ivylessPublishToFile for FileRepository: write to local path for
  testing without HTTP server.
- Add ivylessPublishTask: when useIvy is false, use ivyless path for
  URLRepository or FileRepository; otherwise use Ivy.
- Wire publish in Defaults to LibraryManagement.ivylessPublishTask
  (tagged Publish, Network).
- Add scripted test dependency-management/ivyless-publish using
  Resolver.file to verify ivyless publish produces identical layout.

Credentials supported via allCredentials (Basic auth for PUT).
2026-02-04 14:20:38 -05:00
bitloi b0601b4c6c
[2.x] fix: Fixes subproject deps with different Scala versions (#8681)
When a project depended on another project that was built with a different Scala binary version (e.g. 2.12 vs 2.13), compilation could fail with "not found: value X" because resolution was asking for the wrong artifact.

This change updates how we build the `ModuleID` for inter-project dependencies in `projectDependenciesTask`: we now request the dependency’s Scala binary version (e.g. `bar_2.12`) instead of the current project’s, so the resolver can find the right artifact. We keep existing behavior for `Disabled` and `Constant` cross-version, and add a small safeguard in the default case when the dependency’s Scala version differs from the current project’s.
2026-02-03 13:40:00 -05:00
eugene yokota 5ba750059c
[2.x] Bump to sbtn 1.12.1 (#8683) 2026-02-03 02:05:50 -05:00
eugene yokota 5131b8658a
[2.x] Use JProcess for interactive forking (#8677)
**Problem/Solution**
For forking that require both input and output,
use a Java process instead of the Scala process.
2026-02-02 11:03:28 -05:00
bitloi 4c16466672
[2.x] feat: Support Maven BOM (Bill of Materials) (#8675)
**Consuming BOMs**

- You can declare a BOM with `.pomOnly()` and versionless deps with `"*"`:
  - `libraryDependencies += ("com.fasterxml.jackson" % "jackson-bom" % "2.21.0").pomOnly()`
  - `libraryDependencies += "com.fasterxml.jackson.core" % "jackson-core" % "*"`
- BOMs are passed to Coursier via `Resolve.addBom()`; version `"*"` is resolved from the BOM.

**makePom**

- POM-only dependencies are emitted under `<dependencyManagement><dependencies>...</dependencies></dependencyManagement>` with `<type>pom</type>` and `<scope>import</scope>`.
- Dependencies with version `"*"` are emitted without a `<version>` element so Maven uses the BOM-managed version.

**Ivy / publishLocal emulation**

- When publishing to Ivy (e.g. `publishLocal`), BOM-resolved versions (deps that had `"*"`) are written into the published `ivy.xml` as forced dependencies (`force="true"`), so consumers that depend on this module get those versions.
2026-02-02 10:54:43 -05:00
eugene yokota 40ef381fa2
[2.x] ExtendedRunnerTest (#8674)
Problem/Solution
Looks like this needs to be reformatted.
2026-02-01 22:25:10 -05:00
bitloi a76074a602
[2.x] fix: skip writing sbt.version in scripted test directories (#8673)
**Problem**

1. Write a scripted test that runs sbt in that test.
2. sbt writes `sbt.version` under `project/build.properties`, which acts as a test filter.
3. The test setup is implicitly altered.

**Solution**

Before writing `build.properties`, sbt checks whether the base directory is inside a scripted test directory (path contains `sbt-test`). If so, it skips writing so the test setup is not altered.
2026-02-01 18:02:17 -05:00
eugene yokota afc9a90374
[2.x] fix: Fix subproject evaluation order (#8672)
**Problem**
Subproject definition is ordered bottom-to-top.

**Solution**
Fixes the definition to be top-to-bottom.
2026-02-01 02:33:11 -05:00
bitloi 4430d4c553
[2.x] feat: add rootProject macro (#8671)
Add a rootProject convenience macro that expands to a Project with base "."
and the enclosing val name as id. Allows writing `val root = rootProject`
instead of `val root = (project in file("."))` for a stable root project id.
2026-02-01 01:07:10 -05:00
eugene yokota 080ce8f00e
[2.x] Extend 2.x universe to BinCompatV (#8667)
**Problem**
Some scripted tests are failing due to the fact that -bin-SNAPSHOT
isn't being recognized.

**Solution**
This fixes sbtApiVersion to recognize BinCompatV.
2026-01-31 23:29:50 -05:00
eugene yokota 5b2881e15e
Merge pull request #8668 from bitloi/fix/3616-resolve-this-project
[2.x] feat: Support ThisProject in aggregate and dependencies
2026-01-31 23:29:13 -05:00
bitloi 3de8704bd3 WorkerMain: exit quietly on invalid JSON-RPC input (no stack trace)
When input lacks 'jsonrpc' field (e.g. {}), call System.exit(1) instead
of throwing IllegalArgumentException. Avoids noisy stack traces in
CI from WorkerExchangeTest's intentional bad-input tests.
2026-02-01 02:33:41 +01:00
bitloi 4dfe68a681 fix: Resolve ThisProject to empty to avoid cycle in aggregate/deps DAG
Resolving ThisProject to ProjectRef(uri, p.id) created a self-reference
in the aggregate (and dependency) list. BuildUtil.checkCycles runs
topological sort on this relation and throws Cyclic when it sees the
self-loop.

Treat ThisProject as no-op: resolve to Vector.empty so the build loads
without error. aggregate(ThisProject) / dependsOn(ThisProject) is
effectively a no-op (self is already included).
2026-02-01 01:59:46 +01:00
bitloi 1a6039c17a Handle ThisProject in aggregate and dependencies
Fixes #3616 - Scope's resolveProjectBuild and resolveProjectRef
mishandle ThisProject.

Previously, using ThisProject in aggregate() or dependsOn() would
cause a runtime error: 'Cannot resolve ThisProject w/o the current
project'.

This change adds proper handling for ThisProject in Load.scala:
- In checkAll: Skip validation for ThisProject (refers to self)
- In resolveProjects: Resolve ThisProject to ProjectRef(uri, p.id)
2026-02-01 01:06:07 +01:00
eugene yokota a6e4c9c3c1
[2.x] Bump to 2.0.0-RC9-bin-SNAPSHOT (#8666) 2026-01-31 18:23:07 -05:00
bitloi d633de5c3f
[2.x] fix: Detect alias/task key name conflicts (#8659)
Problem
When a user defines an alias with a name that matches an existing task or setting key (e.g., `alias c = compile` when a custom task `c` exists), the alias silently wins and shadows the task.

Solution
Detect conflicts at alias creation time and fail with an error message:
```
Alias 'c' conflicts with a task or setting key of the same name. Use a different alias name to avoid ambiguity.
```
2026-01-31 17:56:42 -05:00
eugene yokota 9388c140fa
[2.x] test: Move back the project scripted tests (#8660)
**Problem**
"project" scripted tests are commented out into "project1" directory.

**Solution**
This brings them back, while some remain pending.
2026-01-31 17:41:45 -05:00
bitloi 1ad6b88742
[2.x] feat: Per-channel project cursor for multi-client server mode (#8649)
**Problem**
When multiple clients connect to the same sbt server, they all share the same "current project" state. When one client switches projects with `project X`, all other clients see that change.

**Solution**
Store per-channel project cursors in State attributes. Each client maintains its own cursor that tracks which project it has selected.
2026-01-29 23:15:39 -05:00
PandaMan 461e12d497
[2.x] fix: Handle paths with parentheses in sbt.bat on Windows (#8656)
Windows CMD interprets parentheses as special syntax for command grouping.
When the project directory path contains parentheses (e.g., in username),
the batch script fails with ') was unexpected at this time.' error.

This fix stores the current directory in a variable using delayed expansion
(!CURRENT_DIR!) instead of using %CD% directly, which properly handles
paths containing parentheses and other special characters.

Fixes #8644
2026-01-29 16:51:06 -05:00
eugene yokota f05a96aceb
Update contributing to clarify AI usages (#8657) 2026-01-29 11:56:45 -05:00
bitloi 627c484cd8
[2.x] fix: Restore bincompat for ScriptedRun methods (#8654)
In PR #8621, I added a new `keepTempDirectory` parameter to `ScriptedRun.run()` and `invoke()` methods. To suppress MiMa warnings, I added `mimaBinaryIssueFilters` for:
- `DirectMissingMethodProblem("sbt.ScriptedRun.run")`
- `DirectMissingMethodProblem("sbt.ScriptedRun.invoke")`
- `DirectMissingMethodProblem` for various internal `RunV1`, `RunV2`, `RunInParallelV1`, `RunInParallelV2` classes

However, this broke binary compatibility, which prevents sbt 1.x from calling sbt 2.x for cross-building (building sbt 2.x plugins using sbt 1.x).
2026-01-29 11:07:44 -05:00
NeedmeFordev 81c3d7d6c6
[2.x] fix: Fixes ActionCache tests on Windows (#8628)
Fixes #8627

- Use ${OUT} placeholder and remove StringVirtualFile1 special-case handling
- Make dirZipExt check generic (use vf instead of svf: StringVirtualFile1)
- Let syncBlobs handle StringVirtualFile1 transparently via fileConverter.toPath()
2026-01-28 15:27:46 -05:00
DEBORAH FUNMILOLA OLABOYE a66a3064f9
[2.x] fix: Display HTTP response body when bundle upload fails (#8630)
When a bundle upload to Central Portal fails, the error now displays the HTTP response body instead of just the status code. This provides more useful debugging information, as the response body typically contains detailed error messages from the server.
2026-01-28 10:36:45 -05:00
bohdansolovie aa4ac5b981
[2.x] fix: Add null check for resource URL in ResourceLoader.getPropertiesFor (#8641)
**Problem**
getPropertiesFor method calls getResource().openStream() without checking
if getResource returns null. When a resource doesn't exist, this causes
a NullPointerException with no context about which resource was missing.

**Solution**
Added null check before calling openStream() and throw a descriptive
FileNotFoundException with the resource name if the resource is not found.
This prevents NullPointerException and provides better error messages.

Generated-by: Auto
2026-01-28 10:05:03 -05:00
eugene yokota cc0915fed9
[2.x] refactor: Scala Instance (#8648)
**Problem**
Strings are used to pass paths around.

**Solution**
This cleans up the Scala instance construction code.
2026-01-28 02:27:57 -05:00
calm 5789a7ef77
[2.x] feat: Implement ivyless publishLocal (#8634)
Fixes #8631

**Changes:**
- Add `useIvy` setting key (defaults to `true`)
- Add `ivylessPublishLocalImpl` helper that publishes without Ivy
- Modify `publishLocal` to use ivyless publisher when `useIvy := false`
- Generate ivy.xml via `lmcoursier.IvyXml`
- Generate MD5/SHA-1 checksums for all files
- Add scripted test `dependency-management/ivyless-publish-local`
2026-01-27 00:05:43 -05:00
dive2tech cf8899919d
[2.x] Fix potential division by zero in CacheEventLog.toSummary (#8635)
Add guard to prevent division by zero when calculating hitRate.
If total is 0, hitRate is set to 0.0 instead of causing NaN or Infinity.
2026-01-26 15:47:16 -05:00
eugene yokota 92b0564dc6
[2.x] fix: Fix scala-reflect not found problem (#8632)
## Problem
We enforce same-version policy for scala-reflect in Scala 2.13.
However due to sandwich dependency, the graph can bump
scala-library to 3.8.1, which is missing scala-reflect counterpart.

## Solution
Drop the same-version policy.
2026-01-26 04:55:07 -05:00
eugene yokota 0a96df6f89
[2.x] docs: Move to CONTRIBUTING (#8629)
To improve the visibility, move the pull request guides
into CONTRIBUTING.md.
2026-01-25 15:48:09 -05:00
calm 9951a302c9
[2.x] feat: Support fork in console task (#8604)
When enabled, the Scala REPL runs in a separate JVM.
2026-01-25 02:16:49 -05:00
eugene yokota ba8c340a2b
Merge pull request #8530 from eed3si9n/wip/scala-3.8.0
[2.x] deps: Update to Scala 3.8.1
2026-01-25 02:07:52 -05:00
Eugene Yokota 1a214cbb72 Drop flaky Ivy test 2026-01-25 01:29:52 -05:00
Eugene Yokota eaada0494d Fix common settings loading 2026-01-25 01:29:09 -05:00
eugene yokota e4b651b3a8
Apply suggestion from @mzuehlke
Co-authored-by: Marco Zühlke <mzuehlke@gmail.com>
2026-01-24 17:25:28 -05:00
Dairus 7a9775c87d
Add integration test for bspConfig & embedded launcher jar (fixes #7794) (#8597)
This adds a scripted integration test to verify that the `bspConfig` task correctly generates a valid BSP connection file (`.bsp/sbt.json`) when the embedded launcher JAR is present in the classpath.
2026-01-24 15:05:51 -05:00
Eugene Yokota 1b9f065c0a CI fixes 2026-01-24 04:52:28 -05:00
Eugene Yokota a8ecbf2e61 Fix lazy val extraction 2026-01-24 04:52:28 -05:00
Eugene Yokota 19ca2911d2 Scala 3.8.1 2026-01-24 04:52:28 -05:00
Eugene Yokota d9bf396bf7 Use JDk 17 for CI 2026-01-24 04:52:28 -05:00
Eugene Yokota 6cf8611dee Scala 3.8.0 2026-01-24 04:52:28 -05:00
Eugene Yokota 9813e60fe3 refactor: Clean up infix etc 2026-01-24 04:52:28 -05:00
bitloi f8704752e0
[2.x] feat: Add scriptedKeepTempDirectory setting (#8621)
**Problem**

When running scripted tests to debug sbt plugins, the temporary directories (`/private/var/folder/...`) are automatically deleted after tests complete. This makes it difficult to inspect the test state for debugging purposes, requiring workarounds like adding `$ pause` commands and manually copying directories.

**Solution**

Added a new `scriptedKeepTempDirectory` setting that allows users to preserve temporary directories after scripted tests complete. When enabled, the temporary directory path is logged so users can inspect it.

Usage:
```scala
scriptedKeepTempDirectory := true
```
2026-01-23 21:22:50 -05:00
bitloi 64dadd6459
[2.x] fix: Throw on addCompilerPlugin(foo % Test) (#8622)
Problem

When using `addCompilerPlugin((dependency) % Test)`, the compiler plugin was incorrectly added to BOTH `test:scalacOptions` AND `compile:scalacOptions`, instead of only `test:scalacOptions`.

Solution

Throw when the dependency is scoped, since we do not support this use case.
2026-01-23 11:41:16 -05:00
calm 8a518dfb98
[2.x] fix: Skip eviction warning when winner satisfies version range (#8616)
- Add `versionSatisfiesRange()` function to `VersionRange.scala` supporting Maven-style ranges (`[x,y)`, `(x,y]`, `[x,)`, etc.) and plus ranges (`1.0+`)
- Check if winner version satisfies evicted module's version range in `guessCompatible()`
2026-01-22 15:52:58 -05:00
calm 398af2eaaa
[2.x] fix: Suppress "Multiple main classes" warning for runMain commands (#8613)
Changed the scope separator parsing from `/` only to `[/:]` to handle both new slash syntax (`Test/runMain`) and old colon syntax (`test:runMain`).
2026-01-22 12:58:53 -05:00
circlecrystalin 55e75faee2
[2.x] fix: Fix flaky client tests (#8580) 2026-01-22 05:35:13 -05:00