proud-dentist-22844
06/13/2022, 11:16 PMambitious-actor-36781
06/14/2022, 5:25 AMambitious-actor-36781
06/14/2022, 5:25 AMcurved-television-6568
06/14/2022, 5:25 AMambitious-actor-36781
06/14/2022, 6:45 AMcurved-television-6568
06/14/2022, 6:47 AMambitious-actor-36781
06/14/2022, 6:47 AMSingleSourceField
subclass for my input on my GenerateSourcesRequest
(I guess you'd use PythonSourceField
) (Note: This file doesn't need to exist)
2. Used PythonSourceField
as my output. (At a guess you'll need to create a FrobulatorIniSourceField
)
3. Did Step #3 for the Union rule
4. For step #4 you can stick whatever you want in your @rule
you just need to generate a Snapshot
containing the files as you'd expect to see them on disk. (i.e. src/python/foo.py
which I calculated with: f"{target.address.spec_path}/{target.address.target_name}.py"
Because my 'codegen' code was pure-python, I just did it directly in the @rule
.
Less than 100 lines to:
• get the target and it's files deps
• strip the files source-roots
• retrieve the contents of the files
• parse the python
• spit out a Digest
& Snapshot
ambitious-actor-36781
06/14/2022, 7:04 AMambitious-actor-36781
06/14/2022, 7:16 AMambitious-actor-36781
06/14/2022, 7:16 AMcurved-television-6568
06/14/2022, 7:17 AMambitious-actor-36781
06/14/2022, 7:17 AMambitious-actor-36781
06/14/2022, 7:17 AMproud-dentist-22844
06/14/2022, 2:24 PMproud-dentist-22844
06/14/2022, 3:48 PMcurved-television-6568
06/14/2022, 4:44 PMGenerateSourcesRequest
for a setup of target/destination source field types. So whenever the sources for a target is hydrated, the engine looks for any such subclasses that can translate what you have into the target source type (provided that codegen is enabled on the source hydrate request).proud-dentist-22844
06/14/2022, 5:25 PMproud-dentist-22844
06/14/2022, 5:30 PMasdf\n
to test outputing a "generated" file. But ./pants export-codegen
puts it under dist/codegen
- is there a way to get that written (or moved/copied) to the actual workspace?
edit: that's a generic question. I'll post it as a new top-level question