Closed clo-vis closed 10 months ago
Does it still fail if you remove the Eclipse sourceSets configuration? I'm suspicious of it. This is a very basic use-case, and it hasn't been failing elsewhere.
No, it doesn't fail without the Eclipse sourceSets configuration.
I figured it out. There is no eclipse
configuration in that configuration. EclipseModel (the thing at project.eclipse
) has no sourceSets
:
https://docs.gradle.org/current/dsl/org.gradle.plugins.ide.eclipse.model.EclipseModel.html
That means the sourceSets is just being applied to project, so it is the same as:
sourceSets {
main {
java.srcDirs += ["build/generated/source/proto/main/java"]
}
}
And that is clearly broken, as it adds a folder generated by the task without the task.
Modifying sourceSets shouldn't be necessary any more for Eclipse. Just applying the eclipse plugin should be enough. So I'd recommend just deleting that eclipse
block.
True! I just copied the first answer from StackOverflow that worked - it might be clearly broken but no error/warning is issued and it worked until ... it stopped working 🤷♂️
Just applying the eclipse plugin should be enough.
Perhaps it should. But it's not. I'm using noweclipse.classpath.file.whenMerged { classpath -> ... }
and hoping it will work longer than the last answer I copied from StackOverflow.
Perhaps it should. But it's not.
How was it breaking?
build/generated/source/proto/main/java is not added as source folder to .classpath, that is,
<classpathentry kind="src" path="build/generated/source/proto/main/java">
is missing in the file.
If added manually, it is removed whenever the project is refreshed (with "Refresh Gradle project")
But this behavior, right or wrong, has nothing to do with this issue, which can be closed.
Hmm... That should have been improved by https://github.com/google/protobuf-gradle-plugin/pull/601 (add directories to sourceSet), and then fully fixed with https://github.com/google/protobuf-gradle-plugin/pull/590 (eagerly make the output directories) . I wonder if they had a recent behavior change. We do have a test that is passing, so we may need to try different versions.
Feel free to open another issue for that eclipse issue.
gradle version: 7.4.2
src/main/java/Foo.java
src/main/proto/example.proto
build.gradle
Output of
gradle build
:Partial output of
gradle build --info
:Partial output of
gradle build --info
when using com.google.protobuf version 0.8.3: