Commit Graph
18011 Commits
Author SHA1 Message Date
eugene yokota e36dbf894c Merge pull request #9509 from eed3si9n/bport2/backports
[2.0.x] Backport fixes
2026-07-26 16:11:55 -04:00
eugene yokota e4f3e7f66b [2.x] Zinc 2.0.4 (#9508) 2026-07-26 15:49:44 -04:00
Jozef Koval ff2a76e769 [2.0.x] fix: Make forked run inherit sbt's working directory (#9442)
forked run used the project's baseDirectory as the working directory, while non-forked execution inherits sbt's own working directory — so toggling fork silently changed how relative paths resolved.

forked run (and forked console) now inherit sbt's working directory, consistent with non-forked execution and `sbtn` expectations.
2026-07-26 15:49:44 -04:00
eugene yokota 3155bde5ab [2.0.x] fix: Fixes scalaCompilerBridgeBin (#9506)
**Problem/Solution**
Fixes scalaCompilerBridgeBin leaking project names
across different builds.
2026-07-26 15:49:44 -04:00
Eugene Yokota 30f573f1c3 [2.0.x] Move compiler bridge to Update
**Problem**
We want to grab tooling artifacts in update.

**Solution**
This adds binary compiler bridge artifacts into the update graph.
2026-07-26 15:49:44 -04:00
BrianHotoppandClaude Opus 4.8 8266803408 [2.0.x] fix: Complete server teardown before logging so reboot works from sbtn (#9497)
Running reboot in the sbt shell dropped to the OS shell instead of rebooting.
The break was in teardown: Server.shutdown opened with
log.info, and during a client-initiated reboot the terminal in scope is that
client's already-closed virtual terminal, so the log write throws
ClosedChannelException through the terminal proxy. That aborted teardown
before the portfile was deleted and the server socket closed, and the
exception was swallowed by the shutdown hook (whose own error print goes to
the same dead terminal).

Server.shutdown now completes its state cleanup (portfile, tokenfile, running
flag, server socket) before logging, and CommandExchange.shutdown wraps each
channel shutdown and the server shutdown individually so one failing step
cannot skip the rest.

Fixes #9095

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-26 15:04:46 -04:00
Eugene Yokota aacbf737c0 Add remote-cache test 2026-07-26 15:03:07 -04:00
Eugene Yokota aed2719f02 [2.x] fix: Intern GrpcActionCacheStore
**Problem**
GrpcActionCacheStore gets recreated per reload.

**Solution**
This interns GrpcActionCacheStore based on the parameters.
2026-07-26 15:00:58 -04:00
eugene yokota 6ea3eb7e87 [2.0.x] sbtn 2.0.0-a0c4773a (#9503) 2026-07-26 15:00:15 -04:00
eugene yokota c7fb328142 Merge pull request #9501 from eed3si9n/bport2/backports
[2.0.x] Backport fixes
2026-07-25 17:30:46 -04:00
Eugene Yokota 752f5d42b1 Add missing imports 2026-07-25 16:21:53 -04:00
Kevin Lee fa2f8b87b8 [2.0.x] fix: Fixes three test-classloader / jar-handle leaks in the sbt server JVM (#9485)
2 independent, pre-existing retention bugs kept the classloader of a
finished in-process test run -- and the open jar handles it holds -- alive
for the rest of the server session.

- JUnitXmlTestsListener: testSuite is an InheritableThreadLocal, so
  threads spawned during a run (e.g. async-framework pool workers) inherit
  a copy of the suite reference that remove() cannot reach.

- ClassLoaderCache: loaders evicted from delegate by clearExpiredLoaders
  are unreachable from the map and never enqueued on the ReferenceQueue, so
  neither clear()/close() nor the cleanup thread could ever close them.

SuiteResult now documents the retention hazard on throwables. Adds
deterministic, cross-platform tests for all three severed chains.
2026-07-25 16:02:21 -04:00
eugene yokota fd4e7c4863 [2.x] fix: Skip checksum generation for asc file, take 2 (#9499)
**Problem**
Checksums are still generated for asc file.
1. localStaging is a file repo, which was not handled
2. It was checking Artifact name, not the file name

**Solution**
This fixes both.
2026-07-25 15:59:42 -04:00
Eugene Yokota 9b295a6d41 [2.0.x] Zinc 2.0.3 2026-07-25 15:59:09 -04:00
BrianHotoppandClaude Opus 4.8 67b8c54432 [2.x] fix: Keep file I/O out of cache-write serialization (#9496)
putBlobsIfNeeded reads each blob's hash and size once, up front, and
returns only plain HashedVirtualFileRef values, so serializing an ActionResult
(disk, in-memory, or remote store) performs no file I/O and nothing re-stats a
blob after its CAS entry is written: a file vanishing once stored no longer
prevents the write, and I/O errors on an output file surface upfront at blob
storage time rather than mid-serialization.

Fixes #9349

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-25 15:57:32 -04:00
66e0a3ed93 [2.x] fix: Register every Def.declareOutput execution, not one per call site (#9492)
The cached-task macro allocated one mutable slot per syntactic
Def.declareOutput / Def.declareOutputDirectory call site and snapshotted the
slots into the task's outputs after the body ran. A call inside a loop or .map
over a runtime-determined list is a single syntactic site executed many times,
so each iteration overwrote the same slot and only the last file was cached and
restored on a cache hit. There was also no way for a conditional call site that
did not execute to stay out of the outputs: its slot remained null.

Declared outputs now accumulate in a per-task ListBuffer: the macro emits one
buffer at the top of the cached body and rewrites each call site to
ActionCache.registerOutput(vf, buffer), which appends and returns the value.
Every execution registers, an unexecuted site contributes nothing, and the
static multi-site shape is unchanged.

Refs #9462 (the declareOutput-in-a-loop half)

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: eugene yokota <[email protected]>
2026-07-25 15:57:06 -04:00
eugene yokota c9e94107a9 [2.x] Allow opt-out of transient warning (#9437)
**Problem**
We want to opt out of the transient key warning.

**Solution**
This implements an optout via nowarn annotation.
2026-07-25 15:56:34 -04:00
eugene yokota f026f09c89 [2.x] clean task cleans sona-staging (#9479)
**Problem/Solution**
1. clean task cleans sona-staging directory.
2. cleanFull calls clean task.
2026-07-25 15:56:15 -04:00
eugene yokota c12181af7f [2.x] fix: Fixes common settings with extraProjects (#9495)
**Problem**
The presence of extraProjects broke common settings.

**Solution**
This fixes it by passing finalRoot.commonSettings.
2026-07-25 15:55:52 -04:00
90ce3b99f8 [2.x] fix: Re-extract a declared output directory on cache hit when it is missing (#9473)
A directory declared via Def.declareOutputDirectory is packaged as a sibling
<dir>.sbtdir.zip, so deleting the directory leaves the zip behind. On a cache
hit, syncFile's up-to-date short-circuit saw the zip in sync (same digest,
already a CAS symlink) and returned without the unpack side effect, which only
ran from the file-write path: the directory was never restored. For sbt's own
compile, whose classes directory is declared this way, rm -rf of the classes
directory with a warm cache meant run failed with ClassNotFoundException and no
recompile; only deleting the zip as well (or the whole cache) recovered.

The up-to-date branch now re-extracts when the extracted directory itself is
missing: a single stat on the warm path, per review preference over a
manifest-based per-file check. Partial deletions inside a still-existing
directory are not repaired, consistent with treating target/ contents as
sbt-managed.

Refs #9462 (the directory-restoration half; the declareOutput-in-a-loop half is
a separate macro-layer issue)

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: eugene yokota <[email protected]>
2026-07-25 15:55:33 -04:00
Stas Shevchenkoandsshevchenko 8d2219e906 [2.x] fix: Fixes partial cache restoration (#9488)
A genuinely broken restore now degrades to the onsite task instead of a
silent cache hit with incomplete outputs. Related to #9349.

Co-authored-by: sshevchenko <[email protected]>
2026-07-25 15:55:09 -04:00
BrianHotoppandClaude Opus 4.8 380a031cc7 [2.0.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) <[email protected]>
2026-07-25 15:53:54 -04:00
eugene yokota 84f9b53e72 [2.0.x] Zinc 2.0.2 (#9490) 2026-07-23 02:38:27 -04:00
0f4c26fe04 [2.0.x] fix: Don't cache environmental (position-less) compile failures (#9464) (#9475)
Failure caching assumes a CompileFailed is a function of
the sources, which is true for source errors. But zinc also surfaces I/O write
failures ("error writing X.class") as compiler problems, so an environmental
failure (a concurrent target/ deletion, a permission blip) was cached under the
same mechanism and replayed from the global action cache on every later build,
even after the cause was gone. When the poisoned task is the metabuild compile
this is self-sustaining and unrecoverable from inside sbt: project loading
fails, so no task -- including clean -- can run, and only deleting the global
cache by hand recovers. The replayed diagnostics also name files/permissions
that no longer exist.

Refs #9455

Co-authored-by: BrianHotopp <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-20 00:28:39 -04:00
eugene yokota fa7065bdda [2.0.x] fix: Fixes stale resources in test (#9472)
**Problem**
sbt 2.x currently constructs the test classloader using symlinks
to the JARs in CAS (content-addressable storage).
This causes issues because JVM apparently caches opened JAR files by path,
and since the symlink itself doesn't change it could end up
serving stale resource files.

**Solution**
We can workaround this issue by resolving the symlinks to the real path.
2026-07-18 10:13:59 -04:00
eugene yokotaandAnatolii Kmetiuk 9af670246d [2.0.x] fix: Fixes dependency tree rendering on some libraries (#9371) (#9466)
For the purposes of matching resolved dependencies to reverse-dependency entries, do not use dependency overrides to check equality.

Co-authored-by: Anatolii Kmetiuk <[email protected]>
2026-07-17 14:38:53 -04:00
Eugene Yokota 2a3208fd05 sbt 2.0.3 v2.0.3 2026-07-16 19:00:39 -04:00
eugene yokotaandAnatolii Kmetiuk 19a71f316e [2.0.x] restore JVM option capability in the launcher config (#9465)
Restores override-build-repos config option responsible for passing the JVM flag to the launcher.

Co-authored-by: Anatolii Kmetiuk <[email protected]>
2026-07-16 13:46:25 -04:00
eugene yokota c987acd3da Merge pull request #9459 from eed3si9n/bport2/bump-ivy
[2.0.x] bport: Update Ivy and sjson-new
2026-07-16 01:52:08 -04:00
eugene yokota 067a8642ea [2.0.x] sjson-new 0.15.1 (#9458) 2026-07-16 01:05:53 -04:00
eugene yokota 1d3add8fc1 [2.x] Ivy 2.3.0-sbt-f686954b0021a5c3245766ced0cdaeca8ba2fd7a (#9457) 2026-07-16 01:05:18 -04:00
Eugene Yokota bd44b836c1 sbt 2.0.2 v2.0.2 2026-07-12 23:54:12 -04:00
eugene yokota 6207378a49 Merge pull request #9446 from eed3si9n/bport2/mix2
[2.0.x] Backports
2026-07-12 23:03:33 -04:00
Anatolii Kmetiuk c1b289c934 [2.0.x] fix sjson downgrade (#9426)
Extend metabuild exclusion to all sbt-provided deps.
2026-07-12 22:28:37 -04:00
Anatolii Kmetiuk e00efb9d9c [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:28:10 -04:00
eugene yokota f80e2c38c8 Merge pull request #9445 from eed3si9n/bport2/mix
[2.0.x] Backports
2026-07-12 21:50:11 -04:00
eugene yokota 03425046b4 [2.0.x] sbtn 2.0.0-b4d628dd (#9444) 2026-07-12 21:42:56 -04:00
eugene yokota 33a217ae6a [2.0.x] fix: Fixes shutdownall (#9435)
**Problem**
sbt shutdown all requires --server.

**Solution**
Fix it so it doesn't need extra flag.
2026-07-12 21:28:38 -04:00
Anatolii Kmetiuk 7d77f44cdc Fix #9343 route pipelined dependencyPicklePath through internalDependencyPicklePath (#9425) 2026-07-12 21:28:14 -04:00
BrianHotoppandClaude Fable 5 b5ecb37ae7 [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 <[email protected]>
2026-07-12 21:27:57 -04:00
eugene yokota b61b778aff [2.0.x] scala-dyn-version working again (#9440) 2026-07-12 12:04:34 -04:00
eugene yokota 13f584e2e4 [2.0.x] ipcsocket 1.8.0 (#9436) 2026-07-11 16:03:12 -04:00
eugene yokotaandxuwei-k 1125129bce [2.0.x] Support given in build.sbt (#9432)
Co-authored-by: xuwei-k <[email protected]>
2026-07-11 14:30:27 -04:00
35e99d27c1 [2.0.x] fix: apply ByteStream deadline per-call, not on the memoized stub (#9413) (#9431)
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: Yannick Heiber <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-11 13:58:24 -04:00
eugene yokota 3c350df583 [2.0.x] Tweak server startup message (#9430)
**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 13:28:07 -04:00
eugene yokota 80f768225e [2.0.x] ivy 2.3.0-sbt-939a7ea82f140cdb1f51dc404bb43e00a8c43b83 (#9424) 2026-07-11 00:37:04 -04:00
1bfb971e2d [2.0.x] fix: Keep the output-flush timer alive across forceFlush (#9422)
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: BrianHotopp <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
2026-07-10 16:05:25 -04:00
eugene yokota 0905578abf Merge pull request #9421 from eed3si9n/bport2/url
[2.0.x] Backport url(...) deprecation
2026-07-10 20:13:55 +02:00
Eugene Yokota a690492a62 [2.0.x] Mark project/scala-dyn-version as pending
Scala 3.9.0-RC2 is missing scala3-directives-parser_3.
2026-07-10 12:58:13 -04:00
Eugene Yokota be3a396853 [2.0.x] Deprecate Resolver.url
This adds Resolver.uri instead.
2026-07-10 12:57:55 -04:00