-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Protobuf v3 osgi #29172
Protobuf v3 osgi #29172
Conversation
Thank you for your pull request! After a quick sanity check one of the team will reply with 'OK TO TEST' to kick off our automated validation on Jenkins. This compiles the project, runs the tests, and checks for things like binary compatibility and source code formatting. When two team members have also manually reviewed and (perhaps after asking for some amendments) accepted your contribution, it should be good to be merged. For more details about our contributing process, check out CONTRIBUTING.md - and feel free to ask! |
Test FAILed. |
Test PASSed. |
project/OSGi.scala
Outdated
configImport(), | ||
"*"), | ||
OsgiKeys.exportPackage := Seq("akka.protobufv3.internal.*"), | ||
OsgiKeys.privatePackage := Seq("com.google.protobuf") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we're embedding the com.google.protobuf
package here. Is this intentional? Shouldn't we import these instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was indeed intentional, but it should be google.protobuf.*
instead of com.google.protobuf
, to include the *.proto
files instead, no? At least that reflects the current jar's contents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the question is rather if it is intentional to include the classes from (com.)google.protobuf in the akka protobuf jar . With your instruction you are saying, please include that package in my own jar file, but do not export it to the out side world. If there are bundles that require the google protobuf API, they won't see it from the akka bundle (again, which might be was you are intending to do).
There is another thing that strikes me, but it might be ok: You are exporting a package that is marked as "internal". It might be required to make bundles that depend on the protobuf bundle work, but it looks strange. In our own project we never export "internal" packages as they are not for public consumption.
Perhaps you can validate that your bundle works in Karaf - then the suggested changes are ok from my side as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick scan here, it looks like there's JAR shading going on in the build, in combination with the OSGi embedding, has anyone confirmed that com.google.protobuf
is not being included twice at separate package roots? EDIT: I see that the packaging was changed to only include the protobuf descriptors in b765835.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@atooni It was indeed intended to include the protobuf descriptors in the jar, since that was the existing behaviour. As of why they are in there to begin with, I'm not sure. My guess would be the included compiler needs them for adhoc stuff, so I don't see a problem such keeping them in the private package.
I did a small test of creating an akka cluster with 2 nodes each running in a different bundle inside karaf and that works just fine. If needed I can provide a features.xml
I assembled to make it run locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this was for me, my original comment was to make sure there was not two copies of the dependency contents, one shaded and one not. Since it's just the descriptors, an oversight is less of a big deal IMO. Correctness is best tho and it would be good to dump the jar and make sure nothing unexpected is duplicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, why do we export the *.proto
files again? Aren't these only useful at compile time? If we only need them to be present in the jar file they can also be marked as Private-Package
. I don't see the need for exporting them at runtime.
@barthorre You might be aware of #28304. I would be curious about your use case of using akka in OSGi. If you have a minute or two, perhaps you could leave a comment in the issue quoted as we are currently investigating how we can continue with Akka under OSGi in our own project. |
Test PASSed. |
I checked the protobuf-v3 bundle produced with these changes with my setup based on Apache Felix and can confirm that it is working as expected. So the content of the bundle and the meta data seem to be fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After it has been confirmed that the suggested change works in an OSGi container I am happy with the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for checking!
I compared the contents of the jar from this PR with corresponding jar in master. Looking good. Only difference is MANIFEST.MF before (master):
after (this PR):
The google/protobuf contains some .proto files, and those are probably not important. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I noticed OSGi header information was missing from the Manifest when installing akka-protobuf-v3 (to be used with akka-cluster) in apache karaf.
I managed to fix my issue with the following changes, but I am quiet new to writing code in SBT, meaning any pointers, concerns, best practices etc. are most welcome