fix(mix): scope dep library names relative to the project - #3983
Open
sh41 wants to merge 3 commits into
Open
Conversation
The absolute content-root URL in a dep library's name is also its file name under .idea/libraries and what every <orderEntry> repeats, so none of it survived a different checkout path. $PROJECT_DIR$ cannot help: path macros only collapse a path at the start of a value, and the file name is derived before serialization. Names written by older versions are replaced on the next sync. Only the "<dep> [<token>]" shape this plugin writes is ever touched.
Libraries are rebuilt only from deps/ and _build/ events or a first-time project setup, so a project whose libraries are wrong has no way back: deps.get over already-fetched deps changes nothing on disk, and reopening does not re-sync.
A deps/ directory removed while the IDE was closed leaves libraries pointing at nothing and nothing notices: an already-configured project enqueues no sync at open, and the entries stay valid so pruning ignores them. The check reads only in-memory library state and escalates to a full sync just on disagreement, keeping the deps/_build scan off the healthy path. It waits for the JPS model, which the IDE applies over the cached one seconds after open and which would otherwise discard the sync.
Test ResultsCommit ✅ Required legs: 0 failing tests, all 12 ran to completion.
Required legs
Counts only - for which tests failed, open a leg’s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the absolute path reported in #3926.
A Mix dep's project library was named
<dep> [<absolute content root URL>]. That name is also the file name the platform derives for.idea/libraries, and what every<orderEntry>repeats, so none of it survived a different checkout path.$PROJECT_DIR$cannot help: path macros only collapse a path at the start of an attribute value, and the file name is derived before serialization. The scope is now relative to the project base directory — the same anchor$PROJECT_DIR$resolves to.Names written by older versions are replaced on the next sync. Only the
<dep> [<token>]shape this plugin writes is ever touched; a bare name may be a user's own library and is left alone.Also here, because the rename is not usable without them:
deps/change or first-time project setup could rebuild libraries, leaving a project with wrong ones no way back..imlover the cached model seconds after open, and would otherwise discard the sync.Verified against two real WSL projects: a single-root one migrated 43 old-scheme entries and persisted without a manual save; a two-root umbrella with an out-of-tree sibling module produced
.and../<sibling>scopes.This is enough for the reporter to test. Remaining clean-up — order entries left by deps removed from
mix.exs, and orphaned libraries scoped outside every content root — is deferred to #3927.