Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency inference: can disambiguate modules with multiple owners via ! ignores #11786

Merged

Conversation

Eric-Arellano
Copy link
Contributor

We are soon adding a warning when dependency inference fails because >1 target exports the same module. For users to silence that warning, they either must explicitly depend on one of the ambiguous modules or ignore some/all of them. Why allow ignores? A user might end up wanting to ignore all of the ambiguous modules so that the module is never included.

To be consistent, because we allow ignoring all ambiguous modules to turn off dep inference for that module, ignoring all but one of the ambiguous targets will disambiguate the inference. (In practice, we expect it to be more likely users will opt-in to the specific ambiguous target they want, rather than opting out of all but one.)

[ci skip-rust]
[ci skip-build-wheels]

…ia `!` ignores

[ci skip-rust]
[ci skip-build-wheels]
Copy link
Sponsor Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Great stuff!

@Eric-Arellano Eric-Arellano merged commit b4eb76c into pantsbuild:main Mar 24, 2021
@Eric-Arellano Eric-Arellano deleted the ignores-can-fix-ambiguity branch March 24, 2021 00:32
Eric-Arellano added a commit that referenced this pull request Mar 24, 2021
…ed via an include (#11789)

If a user has already chosen which target to use for a module with >1 owning targets, then we should not attempt to further infer dependencies - it would be confusing if we end up inferring a dep different than their include, resulting in two owning targets for the same module.

Fixes an edge case from #11786.

[ci skip-rust]
[ci skip-build-wheels]
stuhood pushed a commit that referenced this pull request Mar 25, 2021
Followup to #11792 and #11786. 

BUILD targets serve the purpose of disambiguating, only are less precise than using a file address. The prior behavior was surprising.

[ci skip-rust]
[ci skip-build-wheels]
@stuhood stuhood mentioned this pull request Mar 25, 2021
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.

None yet

2 participants