pants: Add st2_shell_sources_and_resources()
macro to pants-plugins/macros.py
#5890
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_distribution
targets (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_globs
inpants.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