[internal] Make more explicit when adding dependencies on siblings for generated file-level targets#12906
Merged
Eric-Arellano merged 6 commits intopantsbuild:mainfrom Sep 17, 2021
Merged
Conversation
…r generated file-level targets [ci skip-build-wheels] [ci skip-rust]
Eric-Arellano
commented
Sep 15, 2021
Comment on lines
+58
to
+59
| # TODO(#12790): set to false when dependency inference is disabled. | ||
| add_dependencies_on_all_siblings=True, |
Contributor
Author
There was a problem hiding this comment.
FYI @chrisjrn and @patricklaw , this TODO is meant for you.
# Conflicts: # src/python/pants/engine/internals/build_files_test.py # src/python/pants/engine/target.py # src/python/pants/engine/target_test.py # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
# Conflicts: # src/python/pants/engine/target.py # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
tdyas
approved these changes
Sep 17, 2021
Contributor
|
I definitely like the direction this takes of making targets more explicit! |
Contributor
Author
Thanks! This has been my favorite part of target generation so far: how much more readable |
[ci skip-rust] [ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
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.
Due to #10582, we automatically were adding dependencies on all sibling files from a target generator (aka "build target") if that target did not have dependency inference, or its inference did not support inferring deps on siblings. This is important because users expect with languages like Python that every file in
python_library()would automatically depend on every other file if it weren't for dependency inference.But our heuristic was not fully accurate. For example,
files()andresources()should never infer deps on siblings because there is no notion of a file depending on another file. If you need all the files, depend on the originalfiles()target: only use file targets if you just need that single file. (That will be fixed in a followup.)[ci skip-build-wheels]
[ci skip-rust]