Skip to content

Comments

fix(cli): Prioritize local packages over registry versions#9540

Merged
fortmarek merged 2 commits intotuist:mainfrom
fdiaz:fd/local-over-registry
Feb 20, 2026
Merged

fix(cli): Prioritize local packages over registry versions#9540
fortmarek merged 2 commits intotuist:mainfrom
fdiaz:fd/local-over-registry

Conversation

@fdiaz
Copy link
Contributor

@fdiaz fdiaz commented Feb 20, 2026

Resolves this issue

Summary

This PR fixes an issue in Tuist’s SwiftPM graph loading where a registry package could take precedence over a local/path dependency when the same package is present from multiple sources (local, registry, and/or SCM). In practice, this could cause the generated Xcode project to link against the registry version even when a local dependency was explicitly declared.

Tuist now selects a single package per "identity group" using the following precedence:

  1. Local (path / fileSystem / local source control)
  2. Registry
  3. Source Control (SCM)

This matches SwiftPM’s expected behavior:

“A local package dependency will override any regular dependency in the package graph that has the same package name.”
Package Manager Local Dependencies

and the behavior introduced on #7518

How I tested

  • Added a unit test (currently asserting via a nil hash — open to suggestions if there’s a better assertion to use here).
  • Verified manually by running tuist run generate --path ... on a project reproducing the scenario described in the forum link above, and confirmed the generated project uses the local package rather than the registry one after the fix.

@dosubot dosubot bot added size:L For issues that take up to a day to implement type:bug Something isn't working labels Feb 20, 2026
@dosubot
Copy link

dosubot bot commented Feb 20, 2026

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@fdiaz fdiaz force-pushed the fd/local-over-registry branch from dae89d3 to ea41551 Compare February 20, 2026 00:18
@fdiaz fdiaz changed the title fix(cli) Prioritize local packages over registry versions fix(cli): Prioritize local packages over registry versions Feb 20, 2026
Replace force unwrap with compactMap and refactor test to use
.inTemporaryDirectory and .withMockedDependencies traits.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Thanks! Made just some minor adjustments, otherwise, looks great 💯

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 20, 2026
@fortmarek fortmarek merged commit 626c148 into tuist:main Feb 20, 2026
18 of 19 checks passed
@fdiaz fdiaz deleted the fd/local-over-registry branch February 20, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L For issues that take up to a day to implement type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants