https://pantsbuild.org/ logo
#development
Title
# development
p

proud-dentist-22844

02/14/2023, 2:54 AM
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

ancient-vegetable-10556

02/14/2023, 4:42 AM
yeah, standard pants codegen
p

proud-dentist-22844

02/14/2023, 4:46 AM
Hmm. What happens if you do
./pants run path/to/some:adhoc_tool
? Does that (a) work and (b) materialize the output?
a

ancient-vegetable-10556

02/14/2023, 4:46 AM
Right now, you can’t
I think you can export-codegen though?
If not, you probably could make it so that you could
p

proud-dentist-22844

02/14/2023, 4:47 AM
Export-codegen is explicitly designed for codegen files that do not get committed to version control.
a

ancient-vegetable-10556

02/14/2023, 4:50 AM
Sure, I’ll take a look at the proposal in the nearish future, just to get context
👍 1
p

proud-dentist-22844

02/14/2023, 4:51 AM
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

ancient-vegetable-10556

02/14/2023, 5:06 AM
we have spoken about things that look like that; it might be a good approach?
p

proud-dentist-22844

02/14/2023, 5:20 AM
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

ancient-vegetable-10556

02/14/2023, 5:20 AM
No; it was in the context of the
experimental_wrap_as_*
targets
p

proud-dentist-22844

02/14/2023, 5:26 AM
7 Views