Skip to content

[2.x] fix: Fixes dependency lock file url#8744

Merged
eed3si9n merged 5 commits intosbt:developfrom
bitloi:fix/8741-dependency-lock-file-url
Feb 15, 2026
Merged

[2.x] fix: Fixes dependency lock file url#8744
eed3si9n merged 5 commits intosbt:developfrom
bitloi:fix/8741-dependency-lock-file-url

Conversation

@bitloi
Copy link
Copy Markdown
Contributor

@bitloi bitloi commented Feb 15, 2026

Fixes #8741

When using Coursier for dependency resolution, the dependency lock file was sometimes writing absolute file:// URLs pointing at the local cache (e.g. file:///home/runner/.cache/coursier/...). That made the lock file machine-specific and broke portability.

This PR normalizes those cache URLs so the lock file stays portable. File URLs from the Coursier cache are converted to a stable form (e.g. ${CSR_CACHE}) before being written to the lock file, and converted back when reading. Path handling is normalized so Windows and Unix both behave correctly.


Also in this PR: Action cache was occasionally failing in CI with IncompleteParseException: exhausted input when reading cached task values (e.g. in the dotty-sandwich scripted test). We now treat invalid or empty cached JSON as a cache miss and re-run the task instead of failing.

bitloi and others added 5 commits February 15, 2026 05:12
- Add CacheUrlConversion in lm-coursier internal to convert cache file
  paths back to original repository URLs (single place for logic).
- CoursierDependencyResolution delegates to CacheUrlConversion.
- DependencyLockManager.createFromUpdateReport now accepts optional
  cacheDir; when an artifact has a file URL it either converts via
  cache dir (Coursier layout) or fails with a clear message.
- dependencyLock task passes csrCacheDirectory so lock file gets
  portable HTTPS URLs instead of machine-specific cache paths.

Expectation 1: Lock file contains original Maven Central (or repo) URLs.
Expectation 2: If conversion is not possible, lock creation fails.
- CacheUrlConversion: normalize paths for comparison (forward slashes)
  and strip leading slash on Windows file URIs so cache matching works.
- Apply scalafmt to touched files.
Catch parse errors when reading cached values and return Left(None)
so the task is re-run instead of failing with IncompleteParseException.
Fixes plugins/dotty-sandwich scripted test flake.
@bitloi
Copy link
Copy Markdown
Contributor Author

bitloi commented Feb 15, 2026

@eed3si9n Would you mind reviewing the PR?

@eed3si9n eed3si9n changed the title Fix/8741 dependency lock file url [2.x] fix: Fixes dependency lock file url Feb 15, 2026
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.

Thanks!

@eed3si9n eed3si9n merged commit f132dc0 into sbt:develop Feb 15, 2026
15 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.x] dependencyLock captures file URL

2 participants