Skip to content
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

Automatically add Protobuf output source directories to classpath #2189

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

jdneo
Copy link
Contributor

@jdneo jdneo commented Aug 16, 2022

A Gradle init script is added as a patch to automatically add Protobuf
output source directories to clsspath. The script works for Gradle
'com.google.protobuf' plugin 0.8.4 or higher.

The init script will be extracted as a sibling file of the bundle jars.

As a side effect, the Protobuf output source directories will be created
beforehand, due to an issue of Buildship.
See: eclipse-buildship/buildship#1196.

Related issues

This should mitigate some complains about protobuf support:

I also raised a PR at the protobuf plugin repo to support Eclipse classpath: google/protobuf-gradle-plugin#596.

How to test this PR

  1. Import https://github.com/square/retrofit
  2. the protobuf output directories are automatically added into the sub module: retrofit-converters/protobuf's .classpath file.
  3. Run ./gradlew generateTestProto, those type not found errors disappear.

requires: redhat-developer/vscode-java#2629

Signed-off-by: sheche [email protected]

@jdneo
Copy link
Contributor Author

jdneo commented Aug 18, 2022

I just append a new commit to make the default value of protobuf support false at server side, which means only the client explicitly set that preference to true will the server side do the enhancement.

Copy link
Contributor

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I think this is fine. I just noticed a few things in the storage of the init script worth addressing.

@rgrunber rgrunber changed the title Automatically add Protobuf output source directories to clsspath Automatically add Protobuf output source directories to classpath Aug 18, 2022
@rgrunber
Copy link
Contributor

Feel free to squash & merge when ready. If you use the top commit, don't forget to fix the typo, clsspath. Otherwise, the only thing left is to finalize the name of the setting.

A Gradle init script is added as a patch to automatically add Protobuf
output source directories to classpath. The script works for Gradle
'com.google.protobuf' plugin 0.8.4 or higher.

The init script will be extracted to a cache folder.

As a side effect, the Protobuf output source directories will be created
beforehand, due to an issue of Buildship.
See: eclipse-buildship/buildship#1196.

Signed-off-by: sheche <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants