Commit Graph

17713 Commits

Author SHA1 Message Date
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
calm 2380ab84b6
[2.x] feat: testOnly as a command (#8607)
Adds `testOnly` command that fails when no tests match the specified patterns across all aggregated subprojects.
2026-01-22 04:53:54 -05:00
eugene yokota 089d56c50e
[2.x] doc: tech stack (#8609)
Problem/Solution

Document sbt's tech stack.
2026-01-22 04:20:06 -05:00
calm f4ab500d19
[2.x] fix: Use -external-mappings for Scala 3 doc task #6652 (#8602)
**Problem**

When `autoAPIMappings := true` is set on a Scala 3 project, running `sbt doc` emits warnings:

```
[warn] bad option '-doc-external-doc:/modules/java.base#https://docs.oracle.com/...
```

This happens because Scala 3's scaladoc doesn't recognize Scala 2's `-doc-external-doc` option.

Fixes #6652

**Solution**

- Added `Opts.doc.externalAPIScala3` that generates the Scala 3 format: `-external-mappings:regex::[scaladoc3|javadoc]::url`
- Modified `Defaults.scala` to use the appropriate method based on Scala version
- Added heuristics to detect javadoc vs scaladoc based on file/URL patterns
2026-01-22 02:13:10 -05:00
calm c099be5f18
[2.x] fix: Race condition in WorkerExchangeTest.propBye (#8606) 2026-01-22 00:49:41 -05:00
calm 527f109671
[2.x] fix: Lazy cache hostname resolution at object level (#8603)
- Move hostname resolution to object-level lazy val to prevent blocking sbt startup
- On macOS with misconfigured hostname, `InetAddress.getLocalHost.getHostName` can take ~5 seconds due to DNS timeout
- Now resolution only happens once per session and is deferred until tests actually run
2026-01-21 20:01:28 -05:00
calm 37c6eb2cd9
[2.x] test: Add test for sbt --client startup time (#8599)
* Add test for sbt --client startup time
* Skip startup time test on macOS due to slow hostname resolution
2026-01-21 20:00:00 -05:00
MkDev11 2a5746cf6c
[2.x] feat: Add dependency lock file support (#2989) (#8581)
**What it does**

When you run `dependencyLock`, sbt generates a `deps.lock` file that captures your resolved dependencies. This file can be checked into version control to ensure reproducible builds across different machines and CI environments.

**New tasks**

- **`dependencyLock`** - Generates the lock file from the current resolution
- **`dependencyLockCheck`** - Validates the lock file is up-to-date (fails build if stale)

**How it works**

The lock file stores a hash of your declared dependencies and resolvers. When dependencies change, the hash changes, and `dependencyLockCheck` will fail until you regenerate the lock file.

If no lock file exists, `dependencyLockCheck` passes silently - this allows gradual adoption.
2026-01-21 19:08:59 -05:00
calm 1b8e3317f9
[2.x] feat: Add "3-latest.candidate" support for Scala 3 release candidates (#8596)
Add support for `"3-latest.candidate"` to automatically resolve to the latest Scala 3 RC from Maven Central.

```scala
scalaVersion := "3-latest.candidate"
```

Ref https://github.com/sbt/sbt/discussions/8590
2026-01-21 03:42:50 -05:00
calm 642be58d44
Add scripted test for #6175 (#8598)
This PR adds a scripted test to prevent regression of issue #6175, where `MethodHandle.invokeExact` failed to compile on JDK 15+ when using `-release 11`.

Changes:
- Added `sbt-app/src/sbt-test/java/method-handle-release/` scripted test
- Test uses Scala 2.13.16 with `-release:11` to reproduce the original issue scenario
- Verifies that polymorphic signature methods compile correctly under cross-version targeting
2026-01-21 02:31:07 -05:00
Dairus d2cd284e5e
[2.x] Add scripted test for #7838 (#8541)
This PR adds a new scripted test `watch-termination-reload` to prevent regression of the fix in PR #7838. The test verifies that the `Reload` action is correctly passed to the `watchOnTermination` callback when a reload is triggered in watch mode, instead of falling back to `CancelWatch` (which was the root cause of issue #7017).
2026-01-20 12:13:27 -05:00
azdrojowa123 6493707d2f
[2.x] fix: Create `project` directory if extra sbt files are added to the meta-build #8570 (#8586) 2026-01-20 10:02:58 -05:00
MkDev11 6f14de514b
[2.x] feat: Add setup-java action support in CrossJava (#8574)
Add SetupJavaDiscoverConfig to detect JDKs installed by GitHub's
setup-java action at paths like:
- /opt/hostedtoolcache/Java_Zulu_jdk/25.0.1-8/x64 (Linux)
- C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.29-7\x64 (Windows)

These JDKs are now available in fullJavaHomes as zulu@25.0.1,
temurin@11.0.29, etc.

Supported vendors: Zulu, Temurin, Adopt, Corretto, Liberica,
Microsoft, Semeru. Temurin-Hotspot and Adopt are normalized to
temurin.

Fixes #8582

* test: Refactor setup-java tests to use real directory structure

---------

Co-authored-by: mkdev11 <noreply@users.noreply.github.com>
2026-01-20 09:35:43 -05:00
MkDev11 b6cdfe0d81
[2.x] test: Test transitive cached task (#8579)
Co-authored-by: mkdev11 <noreply@users.noreply.github.com>
2026-01-19 22:40:37 -05:00
byteforge c5af677632
[2.x] feat: Support ... as testOnly pattern (#8577) 2026-01-19 18:45:29 -05:00
Dream a5f915bf87
[2.x] test: Migrate ClassLoaderCacheTest to verify.BasicTestSuite (#8534) 2026-01-19 17:13:21 -05:00
circlecrystalin 2f348a09b9
[2.x] fix: Fixes the handling of special characters in dot files (#8558)
- Replace 'eval echo $line' with 'printf "%s\n" "$line"' in loadConfigFile()
- Prevents shell expansion of special characters like |, *, &, etc.
- Fixes issue where properties with pipes, wildcards, and ampersands
  caused 'command not found' or 'unexpected' errors
- Add test to verify special characters are handled correctly on all platforms
2026-01-19 14:37:08 -05:00
eugene yokota 215e9d6325
[2.x] fix: Prevent fork test cross talk (#8575)
**Problem**
currently all notifications go to all listeners.

**Solution**
This adds "re" field so we can check if it matches with the id.
2026-01-19 00:55:16 -05:00
E.G 0ec5144a63
[2.x] test: Migrate parser specs to verify.BasicTestSuite (#8551)
Migrate the following test files from ScalaTest's AnyFlatSpec to
verify.BasicTestSuite, following the pattern established by other
test files in the sbt codebase:

- SizeParserSpec.scala (util-complete)
- MultiParserSpec.scala (main-command)

Changes in all files:
- Replace AnyFlatSpec class with BasicTestSuite object
- Convert 'should ... in' syntax to 'test(...)' syntax
- Use Scala 3 syntax with colon indentation
- Add 'end' markers
- Add explicit types where needed

Related to the ongoing test migration effort.
2026-01-18 14:33:04 -05:00
E.G 574654900f
[2.x] test: migrate SonaClientTest from ScalaTest to verify.BasicTestSuite (#8562)
- Convert class to object with BasicTestSuite
- Use test() syntax instead of 'should ... in'
- Move RecordingLogger and extension to top-level
- Use Scala 3 colon indentation syntax

Co-authored-by: GlobalStar117 <GlobalStar117@users.noreply.github.com>
2026-01-18 14:31:06 -05:00
E.G 402619fc45
[2.x] fix: Format Seq values consistently in multi-project builds (fixes #7339) (#8567)
When running commands like 'Test/definedTests' on multi-project builds,
the output was showing raw Vector(...) format instead of nicely formatted
per-item output.

Before:
  [info] svc / Test / definedTests
  [info]   Vector(Test FooSpec : ..., Test BarSpec : ..., ...)

After:
  [info] svc / Test / definedTests
  [info]   * Test FooSpec : ...
  [info]   * Test BarSpec : ...

The fix extends printSettings to check if values are Seq types in
the multi-project case and format each item on its own line with
a '* ' prefix, matching the single-project behavior.
2026-01-17 14:37:42 -05:00
E.G 1efebeaa98
fix: Handle -X JVM options on command line (fixes #5742) (#8566)
Previously, passing JVM options like -Xmx1G directly on the command
line would result in an error:

  sbt -v -Xmx1G
  [error] Expected ';'
  [error] -Xmx1G
  [error]       ^

This was because -X options were being passed to sbt as commands
instead of being recognized as JVM arguments.

Changes:
- Added handling for -X options in sbt.bat to pass them to the JVM
- Updated help text to document this feature
- Added integration tests for the new functionality
2026-01-17 14:29:30 -05:00
eugene yokota 8b4b89c395
[2.x] Disable delegation on shell (#8539)
**Problem**
Currently the shell delegates request tasks even when a non-existent
task like Compile / update is requested.

**Solution**
This removes the delegation, if the input key is scoped, so it will fail.
We will, however, continue to delegate on the subproject axis,
since it's useful to use Global or ThisBuild scoping.
2026-01-17 00:05:21 -05:00
bitloi c832fad7b5
[2.x] feat: Notify sbtn client when command is queued (#8568)
Fixes #8356

**Problem**

When `sbtn` sends a command while another long-running task (like `console`) is already executing, the client silently blocks with no indication that the command is waiting in a queue.

**Solution**

When a new command arrives via the network channel and another command is currently running, the server now sends an `ExecStatusEvent` notification with status `"Queued"` to the client. The client displays a message like:

```
[info] waiting for: console
```
2026-01-16 16:17:00 -05:00
eugene yokota 4d7e0633a8
Revert "[2.x] feat: Enable musl static linking for sbtn on JDK 17+ (#8464)" (#8557)
This reverts commit e16298521b.
2026-01-16 00:06:28 -05:00