hundreds-father-404
12/31/2021, 2:24 AMdeploy_jar
generate ResourceSourceField
so that when you depend on it, it's like depending on resource
but where it gets generated by ~running ./pants package
first
https://www.pantsbuild.org/docs/plugins-codegen
To do this, you'll want to add a private sources
field to deploy_jar
like this: https://github.com/pantsbuild/pants/blob/fe112bf20e9e7cfe4a2c746316ebc2655c428697/src/python/pants/core/target_types.py#L142-L145. You're just doing this to hook into codegen. Use a "plugin field" to extend the existing deploy_jar
target: https://www.pantsbuild.org/docs/target-api-extending-targets
Then, in your codegen rule, you'll call await Get(BuiltPackage, DeployJarFieldSet, field_set)
I think. This essentially calls ./pants package
. You can then return the resulting BuiltPackage.digest
in the GeneratedSources
for your codegen rule
We're happy to help more if you have questions along the way 🙂 Feel free to ask questions here or in #plugins
We may want to generalize that cross-language relationship in core Pants, but in the meantime