-
Notifications
You must be signed in to change notification settings - Fork 1k
[2.x] Task returns a file when the cache is empty, as opposed to a symlink #8445
Description
Steps
- Empty the disk cache, or I guess point at a fresh directory.
show scalaCompilerBridgeBin
sbt:aaa> show scalaCompilerBridgeBin
[info] * ${OUT}/jvm/scala-3.8.0-RC5/aaa/compiler-bridge/scala3-sbt-bridge-3.8.0-RC5.jar
[success] elapsed time: 0 s, cache 0%, 4 onsite tasksProblem
The compiler bridge is backed by a real file:
$ ls -ls target/out/jvm/scala-3.8.0-RC5/aaa/compiler-bridge/scala3-sbt-bridge-3.8.0-RC5.jar
64 -rw-r--r-- 1 xxxx xxxx 31768 Jan 7 14:24 target/out/jvm/scala-3.8.0-RC5/aaa/compiler-bridge/scala3-sbt-bridge-3.8.0-RC5.jarExpectation
We expect the task result to be same as clean-rerun version, which returns a symlink:
sbt:aaa> clean
[success] elapsed time: 0 s, cache 100%, 2 disk cache hits
sbt:aaa> show scalaCompilerBridgeBin
[info] * ${OUT}/jvm/scala-3.8.0-RC5/aaa/compiler-bridge/scala3-sbt-bridge-3.8.0-RC5.jar>sha256-0cd5fbfb7be6e053c42ae4db2d0a7b0cd5241d427ed9ff44ce8565167f8c173b/31768
[success] elapsed time: 0 s, cache 100%, 4 disk cache hitsNotice that the compiler bridge JAR is now a symlink:
$ ls -ls target/out/jvm/scala-3.8.0-RC5/aaa/compiler-bridge/scala3-sbt-bridge-3.8.0-RC5.jar
0 lrwxr-xr-x 1 xxxx xxxx 118 Jan 7 14:27 target/out/jvm/scala-3.8.0-RC5/aaa/compiler-bridge/scala3-sbt-bridge-3.8.0-RC5.jar@ -> /Users/xxxx/Library/Caches/sbt/v2/cas/sha256-0cd5fbfb7be6e053c42ae4db2d0a7b0cd5241d427ed9ff44ce8565167f8c173b-31768Original report
I noticed a small issue/inconsistency with this implementation - when there is a fresh project with no disk cache at all (I manually removed the AC & CAS directories), the target/out/jvm/scala-3.6.2/some-name/compiler-bridge directory contains the actual bridge jar (not a symlink). However, if I remove the target directory and run the scalaCompilerBridgeBin task again, the compiler-bridge directory then contains a symlink to the CAS store.
Because of this, I've been experiencing some flaky tests in the IntelliJ Scala plugin - sometimes the jar is in the project directory, and other times it's in the CAS store. I can try to handle this flakiness, but do you think it's okay that this behavior isn't consistent?
Originally posted by @azdrojowa123 in #8377 (comment)