fast-school-44220
09/02/2025, 8:54 PMfast-school-44220
09/02/2025, 9:15 PMFirstPartyPythonMappingImpl
? How does one extend that for non-python code?happy-kitchen-89482
09/02/2025, 10:25 PMhappy-kitchen-89482
09/02/2025, 10:25 PMsrc/python/pants/backend/codegen/protobuf
happy-kitchen-89482
09/02/2025, 10:25 PMrules.py
happy-kitchen-89482
09/02/2025, 10:26 PMfast-school-44220
09/02/2025, 11:27 PMhappy-kitchen-89482
09/03/2025, 12:42 AMhappy-kitchen-89482
09/03/2025, 12:43 AMhappy-kitchen-89482
09/03/2025, 12:44 AMclass GeneratePythonFromProtobufRequest(GenerateSourcesRequest):
input = ProtobufSourceField
output = PythonSourceField
happy-kitchen-89482
09/03/2025, 12:46 AMhappy-kitchen-89482
09/03/2025, 12:46 AMfast-school-44220
09/03/2025, 1:03 AMexport-codegen
I get the files generated. Getting concrete, I'm successfully generating foo.h
. I have a source file that #includes foo.h, but I can't find a way to add the generated foo.h into the inferred dependencies. It worked fine when I had it as a source file, but after switching to generated, it's not in AllTatgets.fast-school-44220
09/03/2025, 3:16 PM#include foo.h
and determines that there isn't a foo.h target, it should look for possible upstream sources that could turn into a foo.h and infer the dependency on those?fast-school-44220
09/03/2025, 3:17 PMfast-school-44220
09/03/2025, 6:45 PMFor generated first-party addresses, use
`./` for the file path, e.g. `./main.py:tgt`; for all other generated targets,
use `:tgt#generated_name`.
fast-school-44220
09/03/2025, 8:00 PMfast-school-44220
09/03/2025, 8:01 PMhappy-kitchen-89482
09/03/2025, 9:14 PMhappy-kitchen-89482
09/03/2025, 9:15 PMhappy-kitchen-89482
09/03/2025, 9:17 PM#include foo.h
, determines that foo.h
isn’t provided by checked-in source, but can be provided by the code generator, and adds a dep on foo.proto
(or more precisely the relevant target containing it as a source).fast-school-44220
09/03/2025, 9:22 PMfast-school-44220
09/03/2025, 9:24 PMhappy-kitchen-89482
09/03/2025, 9:56 PM.proto
and figure out which deps it generates.happy-kitchen-89482
09/03/2025, 9:57 PMdependencies=
field of the protobuf_sources
target?fast-school-44220
09/03/2025, 10:02 PMfast-school-44220
09/03/2025, 10:06 PMfast-school-44220
09/03/2025, 10:08 PMfast-school-44220
09/03/2025, 10:13 PMhappy-kitchen-89482
09/03/2025, 10:19 PMhappy-kitchen-89482
09/03/2025, 10:21 PMhappy-kitchen-89482
09/03/2025, 10:21 PMfast-school-44220
09/03/2025, 10:27 PMfast-school-44220
09/03/2025, 10:31 PMfast-school-44220
09/03/2025, 10:33 PMfast-school-44220
09/03/2025, 10:35 PMfast-school-44220
09/03/2025, 10:36 PMfast-school-44220
09/03/2025, 10:39 PMfast-school-44220
09/03/2025, 10:40 PMfast-school-44220
09/03/2025, 11:18 PMhappy-kitchen-89482
09/04/2025, 4:44 PMcc_binary()
target (or similar, I’m pretending that your code is C/C++ for simplicity) that has explicit dependencies
on its entry point, and then dep inference can take over.happy-kitchen-89482
09/04/2025, 4:45 PMmain.c
not depend on anything? I would have assumed it must #include
and invoke the code in the lib?happy-kitchen-89482
09/04/2025, 4:45 PMfast-school-44220
09/04/2025, 4:50 PMhappy-kitchen-89482
09/04/2025, 4:50 PMfast-school-44220
09/04/2025, 4:51 PMhappy-kitchen-89482
09/04/2025, 4:51 PM.o
builds entirely independently after the preprocessor runs, since the result of the preprocessor is a single file translation unit that can be compiled with no further inputs. You only bring everything together at link time.happy-kitchen-89482
09/04/2025, 4:51 PMhappy-kitchen-89482
09/04/2025, 4:52 PMhappy-kitchen-89482
09/04/2025, 4:53 PMhappy-kitchen-89482
09/04/2025, 4:53 PMfast-school-44220
09/04/2025, 4:54 PMhappy-kitchen-89482
09/04/2025, 4:55 PMhappy-kitchen-89482
09/04/2025, 4:55 PMhappy-kitchen-89482
09/04/2025, 4:55 PMhappy-kitchen-89482
09/04/2025, 4:56 PMfast-school-44220
09/04/2025, 4:57 PMhappy-kitchen-89482
09/04/2025, 5:03 PMhappy-kitchen-89482
09/04/2025, 5:03 PMfast-school-44220
09/04/2025, 5:03 PMfast-school-44220
09/04/2025, 5:04 PMhappy-kitchen-89482
09/04/2025, 5:10 PMhappy-kitchen-89482
09/04/2025, 5:13 PMfast-school-44220
09/04/2025, 5:14 PMhappy-kitchen-89482
09/04/2025, 5:15 PMhappy-kitchen-89482
09/04/2025, 5:15 PMfast-school-44220
09/04/2025, 5:16 PMfast-school-44220
09/04/2025, 5:17 PMhappy-kitchen-89482
09/04/2025, 5:18 PMProcess
, those are applied to ithappy-kitchen-89482
09/04/2025, 5:18 PMhappy-kitchen-89482
09/04/2025, 5:19 PMhappy-kitchen-89482
09/04/2025, 5:19 PMhappy-kitchen-89482
09/04/2025, 5:20 PMTarget
instances for every source file your preprocessor creates. You could just track files directly.happy-kitchen-89482
09/04/2025, 5:21 PMfast-school-44220
09/04/2025, 5:23 PMfast-school-44220
09/04/2025, 5:24 PMhappy-kitchen-89482
09/04/2025, 6:06 PMTarget
or Field
class of any kind, is my point.happy-kitchen-89482
09/04/2025, 6:06 PMhappy-kitchen-89482
09/04/2025, 6:07 PMcc_binary()
-like target type to represent the binary, an actual one in a BUILD file. And you need a cc_sources()
-like target type to represent the sources on diskhappy-kitchen-89482
09/04/2025, 6:07 PMhappy-kitchen-89482
09/04/2025, 6:13 PMhappy-kitchen-89482
09/04/2025, 6:13 PMhappy-kitchen-89482
09/04/2025, 6:13 PMGet
until we iron those outfast-school-44220
09/04/2025, 6:17 PMhappy-kitchen-89482
09/04/2025, 6:30 PMGet
resolves, then that is likely the recursive issuehappy-kitchen-89482
09/04/2025, 6:30 PM