-
-
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
Implement support for codegen with multiple languages x multiple resolves #14694
Comments
It's also worth noting that even before |
Hm: another very important issue (which may have made closing #14041 premature, sorry @tdyas) is that injected runtime dependencies can conflict between implementations. For example, enabling both 12:47:43.36 [ERROR] 1 Exception encountered:
ClasspathSourceMissing: No JVM classpath providers (from: CompileJavaSourceRequest, CompileScalaSourceRequest, CoursierFetchRequest, DeployJarClasspathEntryRequest, JvmResourcesRequest) were compatible with the combination of inputs:
* 3rdparty/python#protobuf (python_requirement)
...which is valid (although you could also argue that a target should ignore dependencies that it doesn't understand). It might be the case that these injected dependencies should be "classified" / scoped (via #12794)... or that multiple target types (or at least instantiations, maybe via target generators) are necessary. In the v2 engine experiments, this was addressed by declaring dependencies on fields (called "configurations" at that point) rather than on targets itself (i.e. |
And also complicated if users want to run Java and Scala protobuf generators in the same code base. |
I am also running into this issue using Pants 2.15.0rc6, same error as above when trying to codegen protobuf with both Python and Java:
I have a minimal reproduction of the issue here: https://github.com/gniemann/pants-proto-test |
After running into the same issue as in https://github.com/gniemann/pants-proto-test, I've attempted to fix it for java/python repos. I narrowed it down to filtering out the This builds working jars with both the required protobuf/grpc artifacts and generated protobuf modules, without error, but it fails pre-commit hooks with pants.engine.internals.dep_rules.DependencyRuleActionDeniedError: src/python/pants/jvm/compile.py has 1 dependency violation:
* src/python/pants/jvm -> src/python/pants/backend/BUILD[!*] : DENY
python_sources src/python/pants/jvm/compile.py -> python_sources src/python/pants/backend/python/target_types.py Presumably because this sort of cross backend dependency is frowned upon, which makes sense considering it's very specific. I tried various combinations of filtering via JVM I'm unsure of where to go from here being a few hours into reading the code base, maybe modify codegen itself? |
The second part of this comment #14484 (comment), along with the solutions proposed below it to use
configurations
+ agenerators
field.Implementing this will look like:
configurations
genericallygenerators
field, which also solves consider ways to configure (conflicting) codegen implementations #14041The text was updated successfully, but these errors were encountered: