An idea to create a generic `generate` goal for ve...
# development
p
An idea to create a generic
generate
goal for version-controlled generated files: https://github.com/pantsbuild/pants/discussions/18235 wdyt?
@ancient-vegetable-10556 for
adhoc_tool
the
output_files
and
output_directories
are standard pants codegen right? Or does the output get materialized in the build root so that it can be committed to version control?
a
yeah, standard pants codegen
p
Hmm. What happens if you do
./pants run path/to/some:adhoc_tool
? Does that (a) work and (b) materialize the output?
a
Right now, you can’t
I think you can export-codegen though?
If not, you probably could make it so that you could
p
Export-codegen is explicitly designed for codegen files that do not get committed to version control.
a
Sure, I’ll take a look at the proposal in the nearish future, just to get context
👍 1
p
Just mulling over the different extant features that could contribute to the idea in that proposal. I really like the idea of using
adhoc_tool
for generated stuff, and then another target that owns the generated files and makes them materialize in the build root when someone runs the
generate
goal
But then if a target depends on the adhoc_tool it will get the codegen version while something that depends on the generated-files owning target will get the in-repo version. Oh bother. Hmm
What if we could use a target as the value for another target's field? That would make it be "anonymous" and only accessible via that target.
Copy code
something_generated(
    generator=adhoc_tool(
        runnable=...,
    )
)
a
we have spoken about things that look like that; it might be a good approach?
p
Have any of those discussions explored the feasibility of using targets as values like that? Or just discussed the potential syntax? Got any links handy?
a
No; it was in the context of the
experimental_wrap_as_*
targets
p