https://pantsbuild.org/ logo
#general
Title
# general
g

great-diamond-82230

07/30/2022, 8:55 PM
I'm trying to do both java and scala codegen from thrift files. I have specified separate namespaces for each language. With the java codegen backend alone,
export-codegen
produces the java: dist/codegen/src/thrift/thrift_example/thriftjava/Person.java but with both java and scala enabled, it produces only the scala: dist/codegen/src/thrift/thrift_example/thriftscala/Person.scala https://github.com/mgedigian-etsy/pants-jvm-codegen/compare/codegen?expand=1
I am also wondering how to specify the scala and thrift codegen as dependencies of other targets. If I list the "/src/thrift:thrift", I get a
ClasspathSourceAmbiguity
error. Do they have separate identifiers I can reference? Or is there a way to explicitly define separate targets in order to obtain separate identifiers?
Copy code
./pants check src/jvm/org/pantsbuild/example/lib
13:49:13.85 [ERROR] 1 Exception encountered:

  ClasspathSourceAmbiguity: More than one JVM classpath provider (CompileJavaSourceRequest, CompileScalaSourceRequest, CoursierFetchRequest, DeployJarClasspathEntryRequest, JvmResourcesRequest) was compatible with the inputs:
  * src/thrift:thrift (thrift_sources)
h

hundreds-father-404

08/01/2022, 4:36 PM
hm @fast-nail-55400 I remember you and I were thinking about this a few months ago, but don't remember exactly where we landed. Do you?
f

fast-nail-55400

08/01/2022, 4:54 PM
It is a case like this that made me favor separate explicit targets to represent codegen outputs (e.g.,
java_protobuf_sources
to represent the Java output from generating Java from Protobuf sources).
There was a bunch of discussion on how we would provide a way to select which sources are produced.
I don't recall a resolution of the discussion other than to not resolve at that time.
6 Views