flat-zoo-31952
10/16/2020, 12:02 AMfiles
field included in the fieldset, but I'm no longer sure what rule transitions i need to go through to get there. I remember I had found the source of a rule in the pants repo that was really similar to mine that I was adapting, but I can't find this anymore. I thought it was the archive
rule but it doesn't look like what I want. Any help I can get to lead me in the right direction?hundreds-father-404
10/16/2020, 1:24 AMarchive
target. That target has a files
field and a packages
field. Both subclass SpecialCasedDependencies
This is in core/target_types.py
flat-zoo-31952
10/16/2020, 1:38 AMpackage_archive_target
flat-zoo-31952
10/16/2020, 1:40 AMHydratedSources
? is that only for code generation?hundreds-father-404
10/16/2020, 1:52 AMGet(HydratedSources, HydrateSourcesRequest)
or the convenience Get(SourceFiles, SourceFilesRequest)
to get a digest for source files.
The only reason I used HydratedSources
there, rather than SourceFiles
, is to avoid a possible import cycle with core.util_rules.source_files
. For you, you can replace the MultiGet(Get(HydratedSources))
with Get(SourceFiles)
- they do the same thing
We set enable_codegen=True
in case any plugin authors wrote plugins that generate FilesSources
. (Pants itself uses codegen for the relocated_files
targets, which only only works if the callsite sets enable_codegen=True
).
Because we enabled codegen, we also need to say what types of sources we’re getting back. This is so that, for example, a Python test doesn’t result in Java sources getting generated, which it doesn’t use. Pants only generates what is relevant.
https://www.pantsbuild.org/docs/rules-api-and-target-api#the-sources-field