-
-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consider ways to configure (conflicting) codegen implementations #14041
Comments
Related point: We currently inject dependencies for codegen regardless of whether the generator is used or not. That behavior will need to match whatever is chosen for codegen generally. Alternatively, consider whether |
Added an additional point (5) regarding language-specific codegen target types. |
|
Hmmm, that sounds like a bug. |
my bug ... ugh |
This issue impacts #14258 which describes supporting compiled languages in codegen. |
#14751) This amends `ClasspathEntryRequest.for_targets` to accept a codegen source request target and output a `ClasspathEntryRequest` that corresponds to a relevant JVM compilation request. With this approach, it seems that any `GenerateSourcesRequest` with `output` that is compatible with a `ClasspathEntryRequest` will Just Work™. To demonstrate this in action, there's backend registration support for the Java and Scala protobuf generators included in this PR too. The main current limitation is when multiple language backends are enabled for a given codegen source type. A solution for this would address #14041, and realistically needs to take multiple JVM languages into account.
#14694 is a dupe of this one, but was opened after consensus was reached on adding a |
In #14030, the point came up that certain codegen implementation might conflict with one another if activated at the same time. In the case of that PR, the conflicting implementations would be the Apache Thrift and Scrooge Thrift code generators for Java.
Ideas for how to configure:
skip_GEN_NAME
fields to the applicable target types (e.g.,thrift_sources
) and have the codegen backends not run if their specific skip field is set. This is brittle to new codegen backends being enabled since it might require also updating lots of targets to have a skip field for the new backend.generators
field to the applicable target types (e.g.,thrift_sources
) that takes a list of strings that are generator names. Only those specific generators will be enabled for that target. This is probably more scalable than (2) since its semantics would not change if an additional codegen backend was enabled. Plus it will fail if a configured generator has its codegen backend disabled.dependencies=["src/thrift/foo!generator=scrooge_java"]
. This can be duplicative if every usage site had to declare thegenerator
label versus just putting fields on thethrift_sources
. Moreover, it would not work with dependency inference unless there were a way to specify which generator to use which leads back to (2) and (3). It could be useful as an override syntax though.protobuf_sources
to configure Protobuf-specific options. But there would also bepython_protobuf_sources
which would depend on a specificprotobuf_sources
target via asource_target
attribute (which would be inferred). This is where thepython_source_root
field would live. That could have agenerator
attribute to select which codegen backend to use where that makes sense (i.e., ajava_protobuf_sources
could select from Apache Thrift or Scrooge). This would allow having multiple LANG_protobuf_sources targets if there were a need to vary options. Consuming targets could then override dependency inference if there were any ambiguity in the usual way.The text was updated successfully, but these errors were encountered: