Commit Graph
18080 Commits
Author SHA1 Message Date
eugene yokota 8be080a446 [2.0.x] fix: Use Path.userHome (#9866)
**Problem**
user.home can return "?"

**Solution**
This centralize to Path.userHome, which works around the JDK bug.
2026-10-05 13:59:13 -04:00
Eugene YokotaandClaude Opus 5.5 f1d9bae56e [2.0.x] fix: Fix task output lost by the thin client under CPU load
**Problem**
Under CPU load, the thin client sometimes loses task output. The channel
started reading before it was subscribed, so an early sbt/attach was
dropped and the command ran on an unattached channel.

**Solution**
Start the channel threads after subscribing it.

Fixes #9834

Generated-by: Claude Code

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 13:52:57 -04:00
Albert MeltzerandClaude Opus 5 091ec3b794 [2.0.x] fix: Keep accepting after a client fails
**Problem**
The accept loop did not catch an exception from onIncomingSocket, so
its thread ended. Nothing closed the server socket, so the path stayed
bound: the server took no further client, and the process kept running.
The socket of the client that failed stayed open too.

**Solution**
Log that client, close its socket, and take the next one. An exception
from accept itself keeps the handling it had, so a socket that is
really broken still ends the loop.

The callback now takes a holder rather than the socket, and calls
AtomicCloseable.release to keep it. The loop closes whatever the
callback left behind.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
2026-10-05 13:51:17 -04:00
eugene yokota a805b32d1d [2.0.x] fix: Fixes .m2/settings.xml overriding sbtResolvers (#9828)
**Problem**
Since Coursier 2.1.25 .m2/settings.xml takes over even when sbtResolvers exists.

**Solution**
Turn off .m2/settings.xml unless explicitly enabled.
2026-10-05 13:25:33 -04:00
eugene yokota c76e4a1f33 Merge pull request #9863 from eed3si9n/wip/backports
[2.0.x] Backports
v2.0.10
2026-10-02 11:52:39 -04:00
eugene yokotaandClaude Opus 5.5 7094f75c83 [2.0.x] fix: Keep the interrupt flag in more thin-client paths (#9855)
**Problem**
Like #9848, some paths still swallow InterruptedException. The
NetworkTerminal request methods block on queue.take, so an
interrupted task thread gets a default value back and loses its
interrupt flag. removeChannel still uses put, and the client's boot
read thread ignores the interrupt meant to stop it.

**Solution**
Restore the flag in NetworkTerminal (in withThread only while the
terminal is open), use add in removeChannel, and stop the read
thread on interrupt. Add tests to NetworkChannelSpec.

Generated-by: Claude Opus 5.5

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-10-02 11:11:20 -04:00
Michał Pierściński 7bf30ff003 [2.0.x] fix: Keep the interrupt flag when writing to the thin client (#9848)
**Problem**
In the default thin-client mode, writing to System.out or System.err
from an interrupted thread throws InterruptedException and clears the
interrupt flag. NetworkChannel enqueues output with `put` on unbounded
LinkedBlockingQueues, and `put` acquires its lock with
lockInterruptibly(). Logging libraries swallow the exception, so the
interrupt is silently lost and code relying on it can hang.

**Solution**
Use `add` instead of `put` on the unbounded queues. They never block,
so no other behavior changes. Add regression tests to
NetworkChannelSpec.

Fixes issue #9845

Generated-by: Claude Opus 5.5
2026-10-02 11:01:07 -04:00
eugene yokota 7ffae8ce59 Merge pull request #9862 from eed3si9n/wip/backports
[2.0.x] Backports
2026-10-02 01:10:32 -04:00
eugene yokota 7938ed6004 [2.0.x] deps: sbtn 2.1.0-6eac8efa (#9861) 2026-10-02 00:37:13 -04:00
Eugene Yokota bb83c575ce [2.0.x] fix: Remove write permission from CAS
**Problem**
CAS currently allows write through.

**Solution**
This prevents it on POSIX systems.
2026-10-02 00:31:27 -04:00
Eugene Yokota b4dec2cf42 [2.0.x] deps: IO 1.13.4 2026-10-01 23:27:55 -04:00
Anatolii Kmetiuk f6e21bb78e [2.0.x] fix: Honor JAVA_HOME in the Unix launcher (#9825)
Problem: The Unix launcher ignores JAVA_HOME and selects Java from PATH when JAVACMD is absent.

Solution: Check JAVA_HOME/bin/java before falling back to PATH while preserving explicit --java-home and JAVACMD precedence.

Fixes #9794
2026-10-01 23:26:17 -04:00
Anatolii Kmetiuk 67b5386332 [2.0.x] fix: Read scripted pause from standard input (#9824)
Problem
The scripted pause handler assumes the JVM has a directly attached terminal. System.console() can return null when sbt runs in client-server mode or with redirected streams, causing pause to fail.

Solution
Use scala.io.StdIn.readLine() to read the configured input stream, which supports sbt client input forwarding. Add unit tests for waiting, line consumption, and EOF.
2026-10-01 23:24:41 -04:00
PhoenixmitX 56ff180cdf [2.0.x] fix: restore the pipelining early output on an action-cache hit (#9793)
Problem
compileIncremental declares the analysis file and the classes directory
as cache outputs, but not the early (pickle) jar or the early analysis.
A cache hit therefore leaves a subproject with a restored analysis and
no early jar. On the next incremental round Zinc has no jar to merge
scalac's pickles into, so the early jar ends up holding only that
round's TASTy/sig files, afterEarlyOutput(true) fires, and every
downstream subproject is compiled against it and fails with "Not found"
for each upstream type that was not just recompiled.

Solution
- Declare the early jar and the early analysis file as outputs of
  compileIncremental when exportPipelining produced them, so a hit
  restores them.
- Restored outputs are symlinks into the CAS, and Zinc rewrites the
  early jar in place when it merges a round's pickles. Replace a
  symlinked early jar by a real copy before Zinc runs so the cached
  blob is never modified.
- When a previous analysis exists but the early jar does not (a cache
  written before the jar was an output, exportPipelining switched on
  for an existing build, a deleted early directory), recompile the
  subproject from scratch, which writes a complete jar.
2026-10-01 23:19:35 -04:00
eugene yokota cf340eccc5 [2.0.x] Update user-agent to major.minor (#9818)
To avoid user-agent being used for tracking, use only major.minor.
2026-10-01 23:12:52 -04:00
eugene yokota 6ad195b249 [2.0.x] Custom user agent (#9786)
**Problem**
We want to track the network request created by sbt.

**Solution**
This sets both sbt version and Coursier version into the user agent.
2026-10-01 23:06:15 -04:00
eugene yokota 434828fb44 [2.0.x] deps: Update Coursier to 2.1.26 (#9852) 2026-10-01 23:01:29 -04:00
eugene yokota 52487d8057 [2.0.x] deps: Coursier 2.1.25 (#9784) 2026-10-01 23:00:34 -04:00
eugene yokota 3de8f9b791 [2.0.x] fix: Update to Gigahorse 0.9.6 2026-10-01 22:52:01 -04:00
eugene yokota 6165811ae4 Merge pull request #9759 from eed3si9n/bport2/bport
[2.0.x] Backports
v2.0.9
2026-09-14 00:50:45 -04:00
eugene yokota 82560d393e [2.0.x] Update sbtn to 2.1.0-M1 (#9755) 2026-09-14 00:07:22 -04:00
Eugene Yokota 56b20c2614 [2.0.x] IO 1.13.2 2026-09-14 00:06:08 -04:00
Alexander cee3208702 [2.0.x] fix: Fix sbt runner script not starting on openSUSE (#9753)
**Problem**
sbt fails to start on openSUSE, since OSTYPE=linux, not linux-gnu.
The startup script tries to add .ZIP extension, and fails to untar native client.

**Solution**
Modified startup script only check that OSTYPE starts with linux, instead of linux-gnu.
2026-09-13 23:47:24 -04:00
Stas Shevchenko 1bde2c0ab1 [2.0.x] fix: keep macro subprojects off the pipelined classpath (#9719) 2026-09-13 23:46:24 -04:00
Christian Harrington 621df1689f [2.x] fix: virtualize semanticdbTargetRoot in the compile cache key (#9711)
Problem
-------
SemanticdbPlugin.compileIncAndCacheSemanticdbTargetRootTask is a cached task
that reads semanticdbTargetRoot as a bare File, so its absolute path is hashed
into the action cache key:

  ((true,${OUT}/.../classes,${OUT}/.../classes.sbtdir.zip),/tmp/repro/target/out/.../meta)

Every other component of that key is virtualized. This one names one checkout
on one machine, so the entry can never be served to a second checkout, to a
colleague, or to CI. A monorepo we measured had 118 such keys, none of them
reachable across machines.

Fixes #9709

Solution
--------
Read the target root through semanticdbTargetRootVF, following the convention
sourcesVF and resourcesVF already set: an uncached task holding the virtualized
form of a File-typed key, so that a cached task hashes ${OUT}/.../meta rather
than the path behind it. A cached helper would key on the same bare File and
reintroduce the problem one level up.

The scripted test asserts the property the bug breaks: relocating
rootOutputDirectory must leave every key alone, so the second compile is a pure
cache hit. It pins Compile / semanticdbOptions, because -semanticdb-target
carries an absolute path into scalacOptions as well, which is a separate issue
and would otherwise mask this one.

Generated-by: Claude Opus 5
2026-09-13 23:43:30 -04:00
Anatolii Kmetiuk fb1183ec11 [2.0.x] Cache pipelined Java compilation 2026-09-13 23:41:49 -04:00
Anatolii Kmetiuk 2500707d68 [2.0.x] Fix Java output when export pipelining is disabled 2026-09-13 23:37:57 -04:00
Eugene Yokota 3127e8d689 sbt 2.0.8 v2.0.8 2026-08-27 22:55:39 -04:00
eugene yokota 039b3dbde2 Merge pull request #9673 from eed3si9n/bport2/bport
[2.0.x] Backports
2026-08-27 22:28:46 -04:00
eugene yokota 67df6f48ee [2.0.x] fix: Fixes Windows runner (#9680)
**Problem**
1. On Windows, sbt.bat re-parses its own already-received arguments a second time internally, via call/goto with an unquoted variable splice (call :run !SBT_ARGS!, and similarly for -D/-XX flags, several _SBT_OPTS-sourced flags, and the native-client dispatch path). That extra re-tokenization could let &, |, (, or ) inside an argument escape their quoting and run as separate shell commands.
2. The -D/-XX/-- argument handling spliced the raw argument value into a for /F ... in ("%g%") do ( ... ) construct nested up to four levels deep inside multi-line if blocks. Apparently, that confuses cmd to miscount the parentheses.

**Solution**
1. Call :run without the argument.
2. Avoid for /F
2026-08-26 18:40:38 -04:00
Stas Shevchenko 24324be9e5 [2.0.x] fix: keep worker classloader open for shutdown hooks (#9639) 2026-08-26 18:38:19 -04:00
eugene yokota 5cee896c5f [2.0.x] fix: Fixes ThisBuild-scoped bare settings (#9674)
**Problem**
ThisBuild scoped baresettings are treated as a common setting,
which results in duplicate appends etc.

**Solution**
Only treat This-project and ThisProject scoped setting as a common setting.
2026-08-25 02:30:10 -04:00
eugene yokota c30d16c6f6 [2.0.x] fix: Fixes JDK 17 domain socket deadlocks (#9671)
**Problem**
Channels.newInputStream/newOutputStream share a channel-wide lock,
which would deadlock for a duplex communication.

**Solution**
This implements an alternative DuplexChannels functions that's capable
of duplex communication expected of a "socket".

This also duplicates the Java implementation to the worker app,
so we can use JDK domain socket for forked test communication.
2026-08-25 02:30:10 -04:00
azdrojowa123andClaude Opus 5 ee5374c77b [2.0.x] fix: Fixes --addPluginSbtFile getting lost after reboot (#9669)
reboot restarts sbt with a fresh state, so the extra plugin sbt files registered in BasicKeys.extraMetaSbtFiles were dropped and their plugins disappeared. Prepend an early(addPluginSbtFile=<path>) command for each registered file to the arguments handed to the restarted sbt, so they are re-registered.

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
2026-08-24 15:54:40 -04:00
Dmitrii NaumenkoandCodex 6085d9e945 [2.0.x] fix: Restore public test result report types (#9655)
**Problem**
Commit c8737b8e4f, "refactor: Change the test type" (PR #8181, Eugene Yokota), made Tests.Output and SuiteResult private[sbt] while changing test tasks to return TestResult. The stated rationale was to type test tasks; it did not describe restricting TestResultLogger customization.

TestResultLogger remains a public, documented extension point, but its run method accepts Tests.Output. External plugins consequently cannot implement it in source. This was noticed while working on TW-102637.

**Solution**
Restore public visibility for Tests.Output, SuiteResult, and its companion. Add a scripted external-build regression test that implements TestResultLogger, uses Output.events as Iterable[SuiteResult], runs test, and observes the logger.

---------

Co-authored-by: Codex <[email protected]>
2026-08-24 15:53:59 -04:00
Dmitrii NaumenkoandCodex bfd744b2c7 [2.0.x] fix: Notify listeners before LinkageError escapes suites (#9667)
TestRunner now calls endGroup(name, error) before rethrowing an otherwise escaping LinkageError. This completes the TestReportListener lifecycle while preserving the original error propagation and non-zero task result.

Previously, the outer suite catch handled only NonFatal errors. A suite failing with ExceptionInInitializerError could therefore start a listener group and terminate without a terminal callback, forcing integrations to infer failure from rendered output. The direct TestRunner regression checks the error callback, absence of a normal result callback, and rethrow of the same error.

Co-authored-by: Codex <[email protected]>
2026-08-24 13:04:28 -04:00
Eugene Yokota 6913814ffd sbt 2.0.7 v2.0.7 2026-08-20 22:49:56 -04:00
eugene yokota 917a785975 Merge pull request #9647 from eed3si9n/bport2/bport
[2.0.x] Backports
2026-08-20 21:46:44 -04:00
stasimus bb8926ca0c [2.0.x] fix: disable BSP over TCP and gate requests before auth 2026-08-20 18:31:13 -04:00
eugene yokota 81ed7a82bd [2.0.x] Update sbtn to 2.0.0-8753a981 (#9630) 2026-08-20 17:11:09 -04:00
Christian Harrington f965e0afed [2.0.x] fix: Fixes filesystem traversal order affecting cache stability (#9646)
**Problem**
CompileInputs2.sources and packageBin / mappings are hashed positionally but arrive in
filesystem traversal order, which differs between APFS, ext4 and overlayfs. Two machines
hash an identical tree into different cache keys and cannot use each other's entries.

**Solution**
Sort sourcesVF by virtualized id, and mappings where packageConfigurationTask reads
it. Both are where the keys are built, so nothing appended later escapes the sort.

Generated-by: Claude Opus 5
2026-08-20 17:09:06 -04:00
Mai Huy HoàngandClaude Opus 5 0b18207f70 [2.0.x] perf: Stop re-converting the classpath in compileOptions (#9622)
Both compileOptions sites mapped the whole classpath through
converter.toPath -> converter.toVirtualFile. Going through toPath
defeats FileConverter.toVirtualFile(VirtualFileRef), which already
returns the ref unchanged when it is a VirtualFile, so every entry was
rebuilt from scratch. For a class directory that means walking the
entire output tree, once per dependent.

backendOutput is converted explicitly because it is a settingKey
evaluated once at project load, so reusing it would pin the listing
taken before anything compiled.

Co-authored-by: Claude Opus 5 <[email protected]>
2026-08-20 17:08:30 -04:00
eugene yokotaandAnatolii Kmetiuk a3c503ad88 [2.0.x] fix: Fixes -V parsing in sbt runners (#9636)
Problem: -V is consumed by the launcher instead of sbt in sbt tasks -V.

Solution: in the parser's -V behavior, lookback to see if there are commands going before it, in which case, forward -V to sbt.

Co-authored-by: Anatolii Kmetiuk <[email protected]>
2026-08-19 17:30:43 -04:00
8d2e582c34 [2.0.x] Add a resolvedScalacOptions task that resolves cache placeholders (#9629)
Add a resolvedScalacOptions task that resolves cache placeholders in scalacOptions to absolute machine paths.

Co-authored-by: azdrojowa123 <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
2026-08-19 13:04:12 -04:00
Dmitrii NaumenkoandCodex 6893ad9b43 [2.0.x] fix: Avoid rewriting unchanged plugin descriptors (#9612) (#9624)
Only rewrite generated plugin descriptors when their normalized lines change, preserving the descriptor timestamp and downstream cache inputs for unchanged plugin discovery.

Add unit coverage plus direct packageBin and assembly Scripted scenarios. The descriptor regressions fail with the former unconditional write and pass with this change; the packageBin fixture also preserves SBT 2’s existing cache-hit behavior.

Co-authored-by: Codex <[email protected]>
2026-08-19 05:13:45 -04:00
eugene yokotaandAlbert Meltzer 087513f4d9 [2.0.x] fix: Name the platform in CrossVersion(module, scalaModuleInfo) (#9621)
**Problem**
CrossVersion(module, scalaModuleInfo) is handed everything needed to name an
artifact, including ScalaModuleInfo.platform, and the name it returns is what
a caller publishes or resolves under. Nothing covers what it does with the
platform.

**Solution**
Name the artifact in full: platform suffix before cross suffix, matching the
coordinate (sbt/sbt#9117), through addPlatformSuffix, which already knows that
jvm contributes no suffix.

Generated-by: Claude Opus 5

Co-authored-by: Albert Meltzer <[email protected]>
2026-08-18 11:55:19 -04:00
eugene yokota abe1b26bb7 [2.0.x] fix: Guard diskcache against path traversal (#9616)
**Problem**
There are several places in diskcache where resolve is called
without guards.

**Solution**
This adds guards to prevent path traversal.
2026-08-17 15:52:05 -04:00
eugene yokota d27611674b [2.0.x] ci: Remove cla-checker v1 (#9570) (#9571) 2026-08-07 14:51:38 -04:00
Eugene Yokota 6e5f1ebf58 sbt 2.0.6 v2.0.6 2026-08-06 22:43:27 -04:00
Eugene Yokota f2c54d042a Merge branch 'bport2/fix-lsp' into 2.0.x 2026-08-06 22:04:26 -04:00