Rohde Fischer
03/29/2025, 9:00 AMcompileJava it does not find the corresponding code, I get the following:
/home/rohdef/git/protobuf/producer/src/main/java/dk/rohdef/protobuf/Foo.java:5: error: package GreeterGrpc does not exist
public final class Foo extends GreeterGrpc.GreeterImplBase
I can confirm that the generated class does exist as expected in build/generated/source/proto/main/java and build/generated/source/proto/main/grpc
I have added in `build.gradle.kts`:
sourceSets {
main {
java {
project.logger.error("${protobuf.generatedFilesBaseDir}/main/grpc")
project.logger.error("${protobuf.generatedFilesBaseDir}/main/java")
srcDirs(
"${protobuf.generatedFilesBaseDir}/main/grpc",
"${protobuf.generatedFilesBaseDir}/main/java",
)
}
}
}
and through the logs confirmed that the paths are indeed correct and the files in the added source directories are indeed .java files
so I'm at a bit of a loss here, it seems to me that the underlying javac is getting run with a wrong/bad setup. How do I best debug this? How do I get gradle to actually include my source sets and not only expose them to IntelliJ?Vampire
03/29/2025, 12:23 PMdependsOn is very bad practice and only partly working.
Assuming the task that generates those files properly declares is outputs, just use the task itself as srcDir, then the outputs become source files and any consumer of source files automatically has the necessary task dependency.