Ensure packaged artefacts are fully replaced in dist/#18930
Merged
huonw merged 3 commits intopantsbuild:mainfrom May 8, 2023
Merged
Ensure packaged artefacts are fully replaced in dist/#18930huonw merged 3 commits intopantsbuild:mainfrom
huonw merged 3 commits intopantsbuild:mainfrom
Conversation
43558d2 to
1eb18a2
Compare
kaos
approved these changes
May 8, 2023
AlexTereshenkov
approved these changes
May 8, 2023
Contributor
Author
|
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.
This patch has the package goal clear out the artefact(s) it is about to write to
dist/, if they already exists.For instance, if running
pants package path/to:targeton apex_binary(outputtingpath.to/target.pex), pants will now first remove anything that's already atdist/path.to/target.pexbefore writing the new output.This resolves two problems:
dist/and writing a file), the package call would explode. For instance, switching a target likepex_binary(..., format="zipapp")(file) topex_binary(..., format="packed")(directory).dist/would remain. For instance, apex_binary(..., format="packed")where a file was removed.This fixes #17758 and fixes #18849, respectively.
This only fixes
package, not any other goals that also write to fixed paths (likeexportandexport-codegen). In #18871, I start onexport-codegen, but it's a bit fiddlier (requires propagating "this is the artefact" paths around) and it's best to land the infrastructure in this PR first. I'll file follow-up issues covering them specifically.Commits are individually reviewable.