Skip to content

[internal] Make more explicit when adding dependencies on siblings for generated file-level targets#12906

Merged
Eric-Arellano merged 6 commits intopantsbuild:mainfrom
Eric-Arellano:sibling-deps
Sep 17, 2021
Merged

[internal] Make more explicit when adding dependencies on siblings for generated file-level targets#12906
Eric-Arellano merged 6 commits intopantsbuild:mainfrom
Eric-Arellano:sibling-deps

Conversation

@Eric-Arellano
Copy link
Copy Markdown
Contributor

@Eric-Arellano Eric-Arellano commented Sep 15, 2021

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() and resources() 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 original files() 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]

…r generated file-level targets

[ci skip-build-wheels]
[ci skip-rust]
Comment on lines +58 to +59
# TODO(#12790): set to false when dependency inference is disabled.
add_dependencies_on_all_siblings=True,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Contributor

tdyas commented Sep 17, 2021

I definitely like the direction this takes of making targets more explicit!

@Eric-Arellano
Copy link
Copy Markdown
Contributor Author

I definitely like the direction this takes of making targets more explicit!

Thanks! This has been my favorite part of target generation so far: how much more readable graph.py becomes when you use the language of "target generator" instead of "BUILD target".

# 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]
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 participants