nice-florist-55958
01/24/2023, 5:10 PMhigh-yak-85899
01/24/2023, 5:13 PMnice-florist-55958
01/24/2023, 5:28 PMhappy-kitchen-89482
01/24/2023, 5:30 PMnice-florist-55958
01/24/2023, 5:36 PMancient-vegetable-10556
01/24/2023, 6:01 PMexperimental_shell_command
features to build up an initial support base, and then work to factor out some of the more repetitive steps you encounter into pluginsnice-florist-55958
04/05/2023, 12:22 PMpython_sources
depending on those resources
. (Of course this would be done anyway, regardless of the individual developer's use of Pants, because CI, which uses Pants for packaging PEX files, would need this configuration.)
Finally, those same python_resources
would also depend on a `shell_command`** that invokes the above build script and declares as output_directories
the built assets. That build script also checks if the assets were already manually placed (bundled as said resources above) and skip the build script if so. This speeds up local workflows because the build script can take a long time to run and currently there's no caching of the results of shell_command
(at least it does not seem that way). If a developer wanted to check the full build and packaging process locally before CI, they could then delete the placed resources or rename them or comment out the dependency in their BUILD file.
This redundant dependency means developers have the option of placing built assets directly or allowing Pants to build them at package time. In general, they would place them locally, but not in SCM/CI.
* The main reason for sharing this update --*
To achieve this, we had to add a new target shell_command_rc
when emits resources
instead of files
since Pants won't bundle files
with pex_binary
. We also implemented relocated_resources
following relocated_files
. Technically, the relocated_resources
are what the python_sources
are depending on, which in turn depend on the shell_commmand_rc
. I wonder if this should be something Pants officially adds though? Right now it's a local plugin for us, but it seems this would be broadly useful. Finally, could shell_command
support caching? I know one of the stated purposes in the documentation is to generate side-effects, but could a provided option indicate that it's for generating resources instead and that it is deterministic (no_side_effects=True
)?ancient-vegetable-10556
04/05/2023, 3:41 PMadhoc_tool
)shell_command
as resources instead of files, try experimental_wrap_as_resources
, available as of 2.16