Commit Graph

18151 Commits

Author SHA1 Message Date
BrianHotopp df6c6c454e
[2.x] fix: Sequence server start before publish in ivyless HTTP scripted tests (#9463)
The ivyless-publish-http and ivyless-publish-http-plugin scripted tests
defined publishToHttp as three unordered `.value` dependencies
(startPublishServer, publish, stopPublishServer). sbt evaluates task
dependencies before the task body in an unspecified order, so publish
could run before the HTTP server was listening and fail intermittently
with "Connection refused". It is reproducible under CPU contention (a
2-vCPU runner), which is why it began flaking on the JDK-25 shard and
turned develop red.

Use Def.sequential to guarantee start -> publish -> stop ordering, the
way the sibling ivyless-publish-maven-http test already sequences via
separate scripted commands.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 12:44:34 -04:00
Anatolii Kmetiuk 271cde7025
[2.x] restore JVM option capability in the launcher config (#9452)
Restores override-build-repos config option responsible for passing the JVM flag to the launcher.
2026-07-16 02:39:59 -04:00
eugene yokota e68edc51a3
[2.x] sjson-new 0.15.1 (#9458) 2026-07-16 01:02:56 -04:00
eugene yokota 427b444ba5
[2.x] Ivy 2.3.0-sbt-f686954b0021a5c3245766ced0cdaeca8ba2fd7a (#9457) 2026-07-16 01:02:39 -04:00
BrianHotopp 3de18d446f
[2.x] fix: Propagate -java-home to a server the thin client starts (#9448)
The thin client (sbtn) parsed the launcher value flags (-java-home, -mem,
-jvm-debug, -sbt-dir, ...) but then dropped them. The space form was consumed
and discarded; the flag=value form fell through to the residual arguments and
was forwarded to the server verbatim, where --java-home=/path was rejected as a
command (`Not a valid command: --`).

When the client had to start a server (none running, no --server), the consumed
-java-home never reached the forked sbt launcher, so the server came up under
the default JVM and, in CI where the intended JDK is only reachable via
-java-home, failed to connect.

parseArgs now captures the consumed launcher value flags (both `flag value` and
`flag=value`) into Arguments.launcherValueArgs, and the cold-start fork re-passes
them to the sbt launcher so the server runs under the requested JVM. The client
tokenizes arguments by splitting on whitespace, which would otherwise fragment a
value that contains spaces (a Windows path like C:\Program Files\Java); parseArgs
tracks those split boundaries and rejoins a value flag's value. An empty flag=
value and a dangling flag with no value are consumed but not propagated, since
the launcher's require_arg would otherwise fail the fork.

The fork command construction is extracted into a pure, package-visible
serverCommand so a test can assert the propagated flag reaches the started
server. The sbt-launch-jar path is unchanged: it invokes java directly, with no
launcher to interpret the flag.

Fixes #9418

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 10:14:20 +09:00
kenji yoshida 5ff0c638d4
[2.x] Avoid deprecated url method in test (#9453) 2026-07-15 10:56:04 -04:00
Anatolii Kmetiuk 972d574750
[2.x] fix dependency parsing for bsp (#9450) 2026-07-14 23:04:38 -04:00
Anatolii Kmetiuk da1a94bea9
[2.x] Add native client startup diagnostics regression test (#9447)
Add native client startup diagnostics regression test
2026-07-14 18:27:28 -04:00
Anatolii Kmetiuk 2d2d5136ef
[2.x] fix sjson downgrade (#9426)
Extend metabuild exclusion to all sbt-provided deps.
2026-07-12 22:25:40 -04:00
Anatolii Kmetiuk e7d25a0971
[2.x] Fix ivyless sbt plugin publish cross paths (#9416)
Problem:
When useIvy := false, ivyless publishing dropped the optional
scala_[scalaVersion]/ and sbt_[sbtVersion]/ path segments from Ivy-style
plugin publish patterns. This caused sbt 1 plugins published from sbt 2 builds
to land under non-plugin Ivy paths, so consumers looking under
scala_2.12/sbt_1.0/ could not resolve them.

Solution:
Read the plugin cross-version attributes from the CsrProject module and use
them when constructing ivyless Ivy-layout publish paths. Apply the same
substitution for local/file Ivy publishing and remote Ivy-style URL publishing,
while continuing to omit those optional segments when the attributes are absent.
Add scripted regressions for local and HTTP Ivy-style publishing of an sbt 1
plugin with useIvy := false.
2026-07-12 22:24:41 -04:00
Anatolii Kmetiuk 66f38defdc
Fix #9343 route pipelined dependencyPicklePath through internalDependencyPicklePath (#9425) 2026-07-12 21:18:10 -04:00
eugene yokota 9f83cb1ef0
[2.x] sbtn 2.0.0-b4d628dd (#9443) 2026-07-12 21:07:14 -04:00
BrianHotopp b4d628dd32
[2.x] fix: Discard a cancelled task's output backlog on cancel (#9411)
A task that floods stdout could not be stopped promptly: cancelling it
(Ctrl+C from the thin client) stopped the task, but the server kept
draining the already-queued output to the client for several seconds,
because onCancellationRequest never discarded the pending backlog.

onCancellationRequest now sets a per-channel isCanceled flag and clears the
queued frames and buffered stdout (discardPending), and jsonRpcNotify
drops the cancelled task's systemOut/systemErr while the flag is set, so
output stops promptly.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 15:03:45 -04:00
eugene yokota d3141f1391
[2.x] scala-dyn-version working again (#9438) 2026-07-12 01:19:22 -04:00
eugene yokota 898e79fe86
[2.x] fix: Fixes shutdownall (#9435)
**Problem**
sbt shutdown all requires --server.

**Solution**
Fix it so it doesn't need extra flag.
2026-07-11 16:04:01 -04:00
eugene yokota 257fb50e4c
[2.x] ipcsocket 1.8.0 (#9433) 2026-07-11 15:01:20 -04:00
eugene yokota 45a4e88adb
[2.x] Tweak server startup message (#9429)
**Problem/Solution**
sbt 2.x uses client-server by default.
This makes the message a bit more obvious when the build is using a client.
2026-07-11 12:51:47 -04:00
eugene yokota 209867c7db
[2.x] ivy 2.3.0-sbt-939a7ea82f140cdb1f51dc404bb43e00a8c43b83 (#9423) 2026-07-10 17:17:47 -04:00
BrianHotopp b11adb6a88
[2.x] fix: Keep the output-flush timer alive across forceFlush (#9414)
NetworkChannel batches writes to the client at most once per 20ms to
reduce terminal flicker and byte volume. forceFlush(), used to order
buffered stdout ahead of a control-plane message, called
flushExecutor.shutdownNow() -- the only place the executor was ever
shut down. Once it ran during active output it tore the executor
down (and, if a coalesced flush was pending, cancelled its future
without resetting flushFuture, leaving the slot stuck), so the 20ms
coalescing was gone for the rest of the connection: stdout was then
flushed per write via the inline fallback instead of batched. Output
still reaches the client, so the effect is extra flushes rather than
lost output, but shutting the shared executor down on the first
forceFlush is clearly unintended.

Extract the flush state machine into CoalescingFlusher. forceFlush now
drains immediately and leaves the timer live (a pending coalesced
drain harmlessly drains the remainder when it fires); the executor is
shut down once, at channel teardown, so it no longer leaks. doFlush
now holds a lock across both the drain and the publish so an inline
forceFlush and the timer's drain can't deliver two stdout batches out
of order.

Fixes #9415

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 14:15:32 -04:00
eugene yokota 4edd5521c6
Merge pull request #9420 from eed3si9n/wip/url
[2.x] Deprecate url(...) and Resolver.url(...) in favor of uri(...)
2026-07-10 18:54:57 +02:00
Eugene Yokota e1dad1a057 [2.x] Mark project/scala-dyn-version as pending
Scala 3.9.0-RC2 is missing scala3-directives-parser_3.
2026-07-10 12:23:58 -04:00
Eugene Yokota 74f76e5445 [2.x] Deprecate Resolver.url
This adds Resolver.uri instead.
2026-07-10 11:46:26 -04:00
Eugene Yokota b804634c4e [2.x] Deprecate url(...)
**Problem**
In sbt 2.x url already reaturns URI, but it's somewhat confusing.

**Solution**
Deprecate it instead.
2026-07-10 11:10:56 -04:00
Yannick Heiber 3b36560a8c
[2.x] fix: apply ByteStream deadline per-call, not on the memoized stub (#9413)
The byteStreamStub lazy val applied withDeadlineAfter once, baking in an
absolute deadline that was reused for the store's whole (session-long)
lifetime. remoteTimeoutInSec after the first blob transfer, every later
ByteStream read/write was rejected with DEADLINE_EXCEEDED, so the remote
cache could neither upload nor download blobs >chunkSizeBytes for the rest
of the sbt server's life.

Derive a fresh stub with the deadline per RPC so each call gets its own
relative timeout.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 23:30:08 +02:00
xuwei-k 8773c55965 Support given in build.sbt 2026-07-06 20:07:30 +09:00
eugene yokota c4e5e8654e
[2.x] Mark log-related keys transient (#9407) 2026-07-03 10:40:10 +02:00
kenji yoshida e9304a3659
[2.x] refactor: Refactor LibraryManagement.scala (#9405)
Remove unnecessary map
2026-07-02 18:58:24 +02:00
BrianHotopp bcd7fe1fbc
[2.x] fix: Probe for a live server before refusing to start (#9337)
Any IOException while creating the boot io socket was wrapped in
ServerAlreadyBootingException and reported as "sbt thinks that server
is already booting" with a stack trace, and non-interactive
invocations exited with code 2. Permission or path-length problems
with XDG_RUNTIME_DIR or the temp directory and Windows named-pipe
access errors all hit this, blocking sbt entirely (#6777). Raw
IOExceptions from the constructor (socket directory creation) were
not caught at all and crashed startup.

getSocketOrExit now connects to the socket (BootServerSocketProbe,
shared with the test suite) to check for a live server before
believing the exception.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 17:02:50 -04:00
eugene yokota c8312cdd88
[2.x] fix: Fixes WinGet release config (#9404) 2026-06-30 21:27:56 -04:00
Anatolii Kmetiuk 316379821d
Add issue reproduction skill (#9400) 2026-06-29 14:18:35 +09:00
eugene yokota 69fa196803
[2.x] fix: Fixes sbt runner openbsd support (#9394)
**Problem**
sbt runner script defaults to sbtn, even on the operating system
where sbtn is not available.

**Solution**
This fallbacks to the jvm client.
2026-06-28 15:30:54 -04:00
Yannick Heiber ca20f68a14
[2.x] Optimize incremental test further (#9364)
This applies a range of optimisations local to ClassStamper that bring the time needed for refinedTestDigests down to acceptable levels (see #9108):
* Cache the digests of transitive dependencies (big impact)
* Avoid sorting of digest subsets that would later get sorted again (small)
* Pre-compute which Analysis instances are required for each class to avoid repeated scanning of the whole list (medium)
* Merge two loops on relations.externalDeps into one (small)
* Compute the set of extra digests outside loop (small)
* Track the digest closure of each test via a BitSet (big)
2026-06-28 15:20:08 -04:00
eugene yokota 0ef972706c
[2.x] fix: Fixes global plugin loading (#9391)
**Problem**
Global plugin loading doesn't work.

**Solution**
1. Use ModuleID from to supply the location of global-plugin module.
2. Update pluginData with the global plugin classpath.
2026-06-28 14:57:18 -04:00
Matt Dziuban 3d99cffd5a
[2.x] Improve performance of `ClassStamper` (#9253)
- Use Builders to avoid building intermediate collections
- Use a mutable.Set for alreadySeen
- Use plain Set instead of SortedSet
  - Sorting only needs to happen at the end of the computation in transitiveStamp
2026-06-27 19:04:33 -04:00
eugene yokota af37f1f765
[2.x] Update Coursier to version 2.1.25-M26 (#9393)
Includes performance improvements.

https://github.com/coursier/coursier/compare/v2.1.25-M25...v2.1.25-M26

Co-authored-by: Jason Zaugg <jzaugg@gmail.com>
2026-06-27 16:36:14 -04:00
eugene yokota 3dd7c92979
[2.x] Add devcontainer (#9392) 2026-06-27 15:21:49 -04:00
Merlin Hughes aa0cb95c48
[2.x] fix: Constrain job id parser to signed longs (#9353)
Job ids are long. The job id parser currently uses NotSpace to parse the ids, which fails with a NumberFormatException for short non-numeric values and OOMs SBT for long non-numeric values.
2026-06-27 00:15:43 -04:00
eugene yokota b1392daa60
[2.x] test: Refactor global plugin test (#9380) 2026-06-27 00:13:54 -04:00
eugene yokota 128697c73b
[2.x] ci: Modify bug report template for custom labels (#9384)
Updated bug report template to allow custom labels.
2026-06-27 00:13:34 -04:00
kenji yoshida 1e4fcd66b6
Update versions in TemplateCommandUtil (#9388) 2026-06-27 00:12:41 -04:00
kenji yoshida 22df8d9d49
[2.x] test: Enable scala-js tests (#9387) 2026-06-27 00:11:46 -04:00
Anatolii Kmetiuk 4ed16c96ce
[2.x] Fix publishDiagnostics propagation (#9376)
**Problem**
Test is based on https://github.com/sbt/sbt/issues/9345#issuecomment-4718229113 which gives us the following sequence:

1. Metals sends buildTarget/compile.
2. sbt publishes real non-empty diagnostics.
3. Metals sends buildTarget/scalaMainClasses.
4. During that request, sbt emits build/publishDiagnostics with diagnostics: [] and reset: true.
5. The following build/taskFinish still reports errors: 1.

Previously, errors for diagnostics reporting via bsp were collected from a live compilation run. In the sequence above, that is triggered by buildTarget/compile. Then, buildTarget/scalaMainClasses does not trigger such a run for the second time, it uses the cached compilation result. Therefore, the diagnostics is not populated.

**Solution**
The proposed fix modifies sendFailureReport to accept an optional CompileFailed object that contains the diagnostics even in case the actual compiler did not run because the cached result was used. If no problems were found for a file via default means, this CompileFailed object is queried to see if it has any information about problems in a given file.
2026-06-26 12:36:42 -04:00
Anatolii Kmetiuk 4766e4370d
[2.x] fix: Fixes runner parsing build.properties with whitespaces (#9374)
Problem
When build.properties contains whitespaces like sbt.version = 1.12.12, parsing fails and the detected sbt version falls back to 2.0.0.

Solution
Trim whitespaces in build.properties.
2026-06-25 02:48:40 -04:00
Rikito Taniguchi 10f98e6c01
[2.x] Fix macro expand for HKT type arguments (#9377)
Def.setting and Def.task macro expansion looks for internal wrapper
call generated for .value.

It visits all function calls in the macro. If the block contains
functions call whose type parameter is HKT, macro expansion crashed.

Macro expansion tries to match IO against '[a], and failed with MatchError.

This commit adds wildcard pattern, and leave unmatched type arguments unchanged.
2026-06-24 21:22:11 -04:00
Merlin Hughes 7575c5a1be
[2.x] Suppress multiple main classes warning when running tests (#9372)
In a project with multiple main classes, the "multiple main classes detected" warning is unwanted noise when running tests. This message is already suppressed for explicit run commands, now also suppress it for test.
2026-06-24 02:03:13 -04:00
Anatolii Kmetiuk 3a37da86f3
[2.x] fix: Fixes dependency tree rendering on some libraries (#9371)
For the purposes of matching resolved dependencies to reverse-dependency entries, do not use dependency overrides to check equality.
2026-06-23 14:35:44 -04:00
Anatolii Kmetiuk 1d7b0d66c3
Fix #9358: preserve --allow-empty and --sbt-create in sbtArguments (#9370) 2026-06-23 15:03:21 +09:00
dependabot[bot] d5e9888db9
[2.x] ci: bump actions/checkout from 6 to 7 (#9366)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  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-06-22 01:10:42 -04:00
eugene yokota f468735c9f
[2.x] sbtn 2.0.0-2932685e (#9363) 2026-06-21 14:41:45 -04:00
eugene yokota 2932685ed2
[2.x] ipcsocket 1.7.0 (#9361) 2026-06-21 01:31:40 -04:00