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

Fix packaged file names for pex_binaries target generator #14269

Merged
merged 2 commits into from Jan 26, 2022

Conversation

Eric-Arellano
Copy link
Contributor

@Eric-Arellano Eric-Arellano commented Jan 26, 2022

#13910 added the very useful pex_binaries target generator, but we missed that the output_path was still always using the target name to calculate the default. With generated targets, they all share the same target_name, so this was causing ./pants package build-support/bin: to crash due to a merge conflict with MergeDigests.

Now:

12:26:02.50 [INFO] Wrote dist/build-support.bin/_generate_all_lockfiles_helper_py.pex
12:26:02.50 [INFO] Wrote dist/build-support.bin/_release_helper_py.pex
12:26:02.50 [INFO] Wrote dist/build-support.bin/changelog_py.pex
12:26:02.50 [INFO] Wrote dist/build-support.bin/check_banned_imports_py.pex

It also caused ./pants run to be a bit confusing, saying that it was building bin.pex rather than changelog_py.pex.

With generated targets, they all share the same target_name, so this was causing ./pants package build-support/bin: to crash.

We still risk crashes if the user defines two pex_binaries over the same entry points (file names) in the same directory (i.e. same Address.spec_path). To truly make this robust, we need to use the Address.spec_path, Address.target_name, and Address.generated_name. Should we do that? It makes the result much more verbose.

[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]
@Eric-Arellano Eric-Arellano requested review from stuhood, benjyw and thejcannon and removed request for benjyw January 26, 2022 19:32
Copy link
Member

@thejcannon thejcannon left a comment

Choose a reason for hiding this comment

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

Looks good to my novice eyes

# 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]
@Eric-Arellano Eric-Arellano merged commit bae865c into pantsbuild:main Jan 26, 2022
@Eric-Arellano Eric-Arellano deleted the fix-pex-binaries-names branch January 26, 2022 20:49
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

3 participants