Skip to content

[2.x] Always create symlinks to the cache in the target locations #8445#8461

Merged
eed3si9n merged 3 commits intosbt:developfrom
azdrojowa123:always-create-symlinks
Jan 13, 2026
Merged

[2.x] Always create symlinks to the cache in the target locations #8445#8461
eed3si9n merged 3 commits intosbt:developfrom
azdrojowa123:always-create-symlinks

Conversation

@azdrojowa123
Copy link
Copy Markdown
Contributor

@azdrojowa123 azdrojowa123 commented Jan 10, 2026

The problem described in #8445 is not only tied to scalaCompilerBridgeBin, for which it was initially reported, but also affects other tasks like exportedProductJars, packageBin, and likely more.

I've tested the proposed approach, and it seems to work - it always creates symlinks.
However, I think I don't have enough broad knowledge to confidently say that it won't have negative side effects in some other use cases.

@azdrojowa123 azdrojowa123 force-pushed the always-create-symlinks branch from ba59dee to e773000 Compare January 10, 2026 17:59
Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azdrojowa123 Thanks for the contribution. Overall LGTM! We just have to figure out why the scripted test is failing. Maybe there's already some hermeticity bug somewhere along the run task.

azdrojowa123 added a commit to azdrojowa123/sbt that referenced this pull request Jan 12, 2026
azdrojowa123 added a commit to azdrojowa123/sbt that referenced this pull request Jan 12, 2026
@azdrojowa123 azdrojowa123 force-pushed the always-create-symlinks branch from 186b96b to 009d060 Compare January 12, 2026 20:39
… if `zipPath` in `sbt.util.ActionCache.packageDirectory` is a symlink to the CAS, in later calls, this path in the CAS gets overridden by the new sources.

- in this test, after "run 1" in line 15, the produced file "target/out/jvm/scala-3.7.4/a/classes.sbtdir.zip" is a symlink to the CAS, let's call it SH1.
- when "run 3" is executed, `IO.zip` saves the new value to `zipPath`, which is "target/out/jvm/scala-3.7.4/a/classes.sbtdir.zip -> SH1", so SH1 gets overridden.
- when the last "run 1" is executed, the cache retrieves SH1, but it contains the data from "run 3" (the test fails with "actual A.x is 3").
@azdrojowa123 azdrojowa123 force-pushed the always-create-symlinks branch from 009d060 to 3dd1127 Compare January 12, 2026 21:15
@azdrojowa123
Copy link
Copy Markdown
Contributor Author

azdrojowa123 commented Jan 12, 2026

Is ModuleResolversTest a flaky test?
Locally on my machine it works fine.

@eed3si9n
Copy link
Copy Markdown
Member

Any lm tests are subject to the Internet weather I guess.

@eed3si9n eed3si9n changed the title Always create symlinks to the cache in the target locations #8445 [2.x] Always create symlinks to the cache in the target locations #8445 Jan 13, 2026
@eed3si9n eed3si9n merged commit 106b8b9 into sbt:develop Jan 13, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants