rdf4j icon indicating copy to clipboard operation
rdf4j copied to clipboard

Add better OSGi support on each module/jar

Open stbischof opened this issue 3 years ago • 8 comments

  • use bnd to generate manifest
  • define Exported packages using @Export in package-info.java

Signed-off-by: Stefan Bischof [email protected]


PR Author Checklist (see the contributor guidelines for more details):

  • [x] my pull request is self-contained
  • [ ] I've added tests for the changes I made
  • [ ] I've applied code formatting (you can use mvn process-resources to format from the command line)
  • [x] I've squashed my commits where necessary
  • [ ] every commit message starts with the issue number (GH-xxxx) followed by a meaningful description of the change

stbischof avatar Mar 15 '22 01:03 stbischof

This looks really interesting. I wasn't even aware that the annotation org.osgi.annotation.bundle.Export exists.

I just want to mention that it may also be possible to use a base bnd.bnd file with -exportcontents as we do in KOMMA: https://github.com/komma/komma/blob/master/bnd.bnd

The individual properties can then be overwritten by specific bnd.bnd files within the modules: https://github.com/komma/komma/blob/master/bundles/ui/net.enilink.commons.ui/bnd.bnd

kenwenzel avatar Mar 15 '22 16:03 kenwenzel

Yes there are a lot of more powerful opportunities. But i would not push this project to hard and this is especially if most package-info.java files exist the best way.

Export-Package: is the best way when using a bnd.bnd file. But in this project layout most yould be done with annotations. Will show you in further commits.

There is an little issue in Handling war files so that the test will fail at ine Point but i am on fixings this.

stbischof avatar Mar 15 '22 20:03 stbischof

I haven't tested your code yet but I have seen that you don't use the annotation org.osgi.annotation.versioning.Version to specify the package versions. Are version numbers correctly added to the manifest by Bnd?

kenwenzel avatar Mar 16 '22 07:03 kenwenzel

Spec:

The package must also be annotation with the [Version](https://osgi.github.io/osgi/core/framework.api.html#org.osgi.annotation.versioning.Version) annotation to specify the export version of the package.

https://osgi.github.io/osgi/core/framework.api.html#org.osgi.annotation.bundle.Export

But bnd takes the version from the bundle.

Export-Package: org.eclipse.rdf4j;uses:="org.eclipse.rdf4j.common.tran
 saction,org.eclipse.rdf4j.model";version="3.7.6",org.eclipse.rdf4j.ex
 ceptions;uses:="org.eclipse.rdf4j.common.annotation,org.eclipse.rdf4j
 .model";version="3.7.6",org.eclipse.rdf4j.model.datatypes;uses:="java
 x.xml.datatype,javax.xml.namespace,org.eclipse.rdf4j.model";version="
 3.7.6",org.eclipse.rdf4j.model.impl;uses:="javax.xml.datatype,org.ecl
 ipse.rdf4j.model,org.eclipse.rdf4j.model.base,org.eclipse.rdf4j.model
 .vocabulary";version="3.7.6",org.eclipse.rdf4j.model.util;uses:="java
 x.xml.datatype,org.eclipse.rdf4j,org.eclipse.rdf4j.common.annotation,
 org.eclipse.rdf4j.model,org.eclipse.rdf4j.model.vocabulary";version="
 3.7.6"

stbischof avatar Mar 16 '22 09:03 stbischof

Thanks for submitting this @stbischof. Could you please also log an issue in our tracker that describes this enhancement, and link it to your PR? Also, given that this is an enhancement rather than a bug fix, if would be good if you could rebase this against the develop branch.

abrokenjester avatar Mar 19 '22 22:03 abrokenjester

Marked this as stale to signal that the PR hasn't been active for a while and that we should consider closing it.

hmottestad avatar Jul 24 '22 07:07 hmottestad

@laeubi could you take this?

stbischof avatar Jul 25 '22 13:07 stbischof

Export-Package: is the best way when using a bnd.bnd file.

I'm currently adding support for @Export and @Version to PDE so soon there will be no excuse not to use these annotation everywhere :-)

laeubi avatar Jul 25 '22 13:07 laeubi