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

Add OSGi support #176

Merged
merged 2 commits into from
Jul 22, 2019
Merged

Add OSGi support #176

merged 2 commits into from
Jul 22, 2019

Conversation

io7m
Copy link
Contributor

@io7m io7m commented Jul 22, 2019

This change moves to using the biz.aQute.bnd Gradle plugin to
produce OSGi-compatible manifests in jar files. Currently, only the
org.agrona.core module has been updated to provide OSGi metadata
because the Agrona agent should never need to be visible inside an
OSGi container. Care has been taken to preserve the existing defined
manifest fields (Automatic-Module-Name, Implementation-Title, etc).

io7m added 2 commits July 22, 2019 14:27
This change moves to using the biz.aQute.bnd Gradle plugin to
produce OSGi-compatible manifests in jar files. Currently, only the
org.agrona.core module has been updated to provide OSGi metadata
because the Agrona agent should never need to be visible inside an
OSGi container. Care has been taken to preserve the existing defined
manifest fields (Automatic-Module-Name, Implementation-Title, etc).
This switches to using commands from Bnd that attempt to provide
a reproducible manifest, rather than manually removing properties.

Thanks @bjhargrave
@io7m
Copy link
Contributor Author

io7m commented Jul 22, 2019

I think static.javadoc.io is having problems today. I saw a couple of failures like this when I built locally, but they stopped occurring when I built on my own Travis CI account.

@mjpt777
Copy link
Contributor

mjpt777 commented Jul 22, 2019

what does this mean for the manifest in the normal Jar?

@io7m
Copy link
Contributor Author

io7m commented Jul 22, 2019

what does this mean for the manifest in the normal Jar?

I've preserved the properties you were using in the jar and this adds extra OSGi headers on top. This was your old jar manifest (agrona 1.0.3):

$ bnd print agrona-1.0.3.jar 
[MANIFEST agrona-1.0.3]
Automatic-Module-Name                    org.agrona.core                         
Implementation-Title                     Agrona                                  
Implementation-Vendor                    Real Logic Limited                      
Implementation-Version                   1.0.3                                   
Manifest-Version                         1.0

This is the manifest now:

$ bnd print ./agrona/build/libs/agrona-1.0.4-SNAPSHOT.jar
[MANIFEST agrona-1.0.4-SNAPSHOT]
Automatic-Module-Name                    org.agrona.core                         
Bundle-ManifestVersion                   2                                       
Bundle-Name                              org.agrona.core                         
Bundle-SymbolicName                      org.agrona.core                         
Bundle-Version                           1.0.4.SNAPSHOT                          
Export-Package                           org.agrona;uses:="org.agrona.concurrent,sun.misc";version="1.0.4",org.agrona.collections;version="1.0.4",org.agrona.concurrent;uses:="org.agrona,org.agrona.concurrent.status";version="1.0.4",org.agrona.concurrent.broadcast;uses:="org.agrona,org.agrona.concurrent";version="1.0.4",org.agrona.concurrent.errors;uses:="org.agrona,org.agrona.concurrent";version="1.0.4",org.agrona.concurrent.ringbuffer;uses:="org.agrona,org.agrona.concurrent";version="1.0.4",org.agrona.concurrent.status;uses:="org.agrona,org.agrona.collections,org.agrona.concurrent";version="1.0.4",org.agrona.console;version="1.0.4",org.agrona.generation;uses:="javax.tools";version="1.0.4",org.agrona.hints;version="1.0.4",org.agrona.io;uses:="org.agrona";version="1.0.4",org.agrona.nio;version="1.0.4",org.agrona.sbe;uses:="org.agrona";version="1.0.4"
Implementation-Title                     Agrona                                  
Implementation-Vendor                    Real Logic Limited                      
Implementation-Version                   1.0.4-SNAPSHOT                          
Import-Package                           javax.tools,org.agrona,org.agrona.collections,org.agrona.concurrent,org.agrona.concurrent.status,org.agrona.hints,sun.misc,sun.nio.ch
Manifest-Version                         1.0                                     
Require-Capability                       osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"

All of these properties are ignored by anything that isn't either an OSGi tool, or an OSGi container. By publishing an Automatic-Module-Name entry, you're implicitly stating that all packages are exported, so I exported all packages via OSGi's Export-Package header too.

@mjpt777
Copy link
Contributor

mjpt777 commented Jul 22, 2019

Thanks. That makes sense. I'm merge when javadoc.io lets the tests complete.

@mjpt777 mjpt777 merged commit 458f1c9 into real-logic:master Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants