<@U021C96KUGJ>: I’m getting the following error wh...
# development
f
@ancient-vegetable-10556: I’m getting the following error when trying to get a scala protobuf project working:
Copy code
ClasspathSourceMissing: No JVM classpath providers (from: CompileScalaSourceRequest, CoursierFetchRequest, DeployJarClasspathEntryRequest, JvmResourcesRequest) were compatible with the combination of inputs:
  * src/protobuf/simple_example:simple_example	(protobuf_sources)
👀 1
a
looooking
f
and https://github.com/pantsbuild/pants/pull/14407 restores codegen backends registration
a
ok
f
I ran
./pants_from_sources check src/jvm/org/pantsbuild/example/codegen/scala::
probably easier to debug if we land https://github.com/pantsbuild/pants/pull/14407 first
👍 1
a
Did you specify the dependency correctly?
Actually, I guess it says that it’s a
protobuf_sources
, so it must be
sigh
maybe it is an issue with dep on the generator?
which I thought Eric had fixed
a
Does it work if you enable the Java rules instead of the Scala rules?
(by “work”, I mean “does the generator run”, not “does it compile”)
f
I could run
export-codegen
but I don’t think that has much bearing on the compilation rules working, right?
and this is Scala code, so for Java rules, I’ll need to write some Java example code first
so let me do that and see what happens
yup still fails with java:
Copy code
ClasspathSourceMissing: No JVM classpath providers (from: CompileJavaSourceRequest, CompileScalaSourceRequest, CoursierFetchRequest, DeployJarClasspathEntryRequest, JvmResourcesRequest) were compatible with the combination of inputs:
  * src/protobuf/simple_example:simple_example	(protobuf_sources)
I’ll try a file target dep
different error with
java_sources(dependencies=["src/protobuf/simple_example/person.proto"])
Copy code
ClasspathSourceAmbiguity: More than one JVM classpath provider (CompileJavaSourceRequest, CompileScalaSourceRequest, CoursierFetchRequest, DeployJarClasspathEntryRequest, JvmResourcesRequest) was compatible with the inputs:
  * src/protobuf/simple_example/person.proto	(protobuf_source)
a
and that was with Java switched on but Scala switched off?
(only one generator can work)
And for what it’s worth, Scala sources can rely on generated Java code, though the interface may be different and the compile will fail
I’m mostly interested in whether the generator is working for Java at all
f
ah that was with both switched on
with scala switched off I get:
Copy code
ClasspathSourceMissing: No JVM classpath providers (from: CompileJavaSourceRequest, CompileScalaSourceRequest, CoursierFetchRequest, DeployJarClasspathEntryRequest, JvmResourcesRequest) were compatible with the combination of inputs:
  * 3rdparty/python#protobuf	(python_requirement)
a
blink
f
and switching off python will require removing some python fields on that protobuf_sources, hold on
a
You just need to remove the python dependencies of the protobuf
f
the compiler at least now gets invoked, although it says there an error but doesn’t show the error:
Copy code
$ ./pants_from_sources check src/jvm/org/pantsbuild/example/codegen/java::
DEPRECATED: option 'use_deprecated_python_macros' in global scope will be removed in version 2.12.0.dev0.

In Pants 2.12, the deprecated Python macros like `python_requirements` will be replaced with improved target generators, which are now enabled by default.

If you already migrated by setting `use_deprecated_python_macros = false`, simply delete the option.

Otherwise, when you are ready to upgrade, follow these steps:

  1. Run `./pants update-build-files --fix-python-macros`
  2. Check the logs for an ERROR log to see if you have to manually add `name=` anywhere.
  3. Remove `use_deprecated_python_macros = true` from `[GLOBAL]` in pants.toml.

(Why upgrade from the old macro mechanism to target generation? Among other benefits, it makes sure that the Pants daemon is properly invalidated when you change `requirements.txt` and `pyproject.toml`.)
18:20:42.77 [INFO] Starting new nailgun server with cmd: "/bin/bash", args ["__jdk/jdk.sh", "__java_home/bin/java", "-cp", "__jdk/com.martiansoftware_nailgun-server_0.9.1.jar:__java_home/lib/tools.jar", "com.martiansoftware.nailgun.NGServer", ":0"], in cwd /private/var/folders/md/0q71p41n0rbgwhnc8npjjzg00000gn/T/process-executionzT7L2w
18:20:43.95 [ERROR] Completed: Check javac compilation - javac failed (exit code 1).

✕ javac failed.
a
Hrrrrm, looks like we need to propagate the Javac error 😄
f
should I open some tickets or did you want to?
a
but that’s what I expected — we haven’t supplied the protobuf support library as a dependency so the compile failed
So the issues are: 1.
javac
errors need to be logged to console 2. Scala protobuf targets aren’t presently getting treated as compilable
f
and also we need to inject the protobuf library requirement
a
Yeah
f
also it looks like you added a java protobuf backend in src/python/pants/backend/codegen/protobuf/java
but I restored the
experiemental
package
will send a PR to delete the non-experimental one
https://github.com/pantsbuild/pants/issues/14869 for missing jdk field on a protobuf_source target
a
@fast-nail-55400 14869 addressed here: https://github.com/pantsbuild/pants/pull/14891
@fast-nail-55400 14868 addressed here: https://github.com/pantsbuild/pants/pull/14893