pants: Add st2_shell_sources_and_resources() macro to pants-plugins/macros.py#5890
Merged
cognifloyd merged 6 commits intomasterfrom Feb 14, 2023
Merged
pants: Add st2_shell_sources_and_resources() macro to pants-plugins/macros.py#5890cognifloyd merged 6 commits intomasterfrom
st2_shell_sources_and_resources() macro to pants-plugins/macros.py#5890cognifloyd merged 6 commits intomasterfrom
Conversation
eb6902f to
1ab013c
Compare
rush-skills
approved these changes
Feb 7, 2023
bc603d8 to
54ec32b
Compare
Member
Author
|
Rebased and added |
auto-merge was automatically disabled
February 9, 2023 20:11
Merge queue setting changed
auto-merge was automatically disabled
February 9, 2023 20:24
Merge queue setting changed
Pants macros are used to define functions that can be used in BUILD files to inject additional functions that can add multiple targets to the BUILD file at once. These functions look like "targets" without building a whole plugin for them.
54ec32b to
96a3c8a
Compare
nzlosh
approved these changes
Feb 14, 2023
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.
Background
This is another part of introducing pants, as discussed in various TSC meetings.
Related PRs can be found in:
Overview of this PR
This PR adds our first pants macro:
st2_shell_sources_and_resources()I'm planning to add 3 more macros to help with building our
python_distributiontargets (for buildling wheels) in future PRs. This just introduces the concept of macros.Macros
https://www.pantsbuild.org/docs/macros
Our macro file is
pants-plugins/macros.py, and we tell pants about it with[GLOBAL].build_file_prelude_globsinpants.toml:st2/pants.toml
Line 11 in eb6902f
This PR only introduces one macro. The key parts of this macro function are
shell_sources(...)andresources(...)- ie, that's where our macro adds the normal pants targets using the kwargs passed to it.st2/pants-plugins/macros.py
Lines 16 to 28 in eb6902f
And then we use the macro just like a regular target in a BUILD file:
st2/st2actions/bin/BUILD
Lines 8 to 12 in eb6902f