julman99/gson-fire

Add OSGi Support

abangerl opened this issue · 10 comments

As gson is OSGi compatible (see: https://github.com/google/gson/blob/master/gson/bnd.bnd) it would be great if gson-fire would add this support too. These two libraries are often used in combination and in the context of OSGi this is problematic currently because of the missing manifest entries in gson-fire.

Hello, sorry for the late response. I've never used OSGi, but I did a bit of research and was able to generate the following META-INF/MANIFEST.MF:

Manifest-Version: 1.0
Bnd-LastModified: 1581182168569
Bundle-ContactAddress: ${project.parent.url}
Bundle-Description: A java library that adds some very useful features
  to Gson, like Date serializing to unix timestamp or RFC3339, method 
 (getter) serialization, pre and post processors and many more. Check 
 out the documentation to learn how to use it!
Bundle-DocURL: http://gsonfire.io
Bundle-License: "The MIT License";link="http://opensource.org/licenses
 /MIT"
Bundle-ManifestVersion: 2
Bundle-Name: Gson on Fire!
Bundle-RequiredExecutionEnvironment: JavaSE-1.6, JavaSE-1.7, JavaSE-1.
 8
Bundle-SCM: url="git@github.com:julman99/gson-fire.git",connection="sc
 m:git:git@github.com:julman99/gson-fire.git",developer-connection="sc
 m:git:git@github.com:julman99/gson-fire.git",tag=HEAD
Bundle-SymbolicName: io.gsonfire
Bundle-Vendor: julman99
Bundle-Version: 1.8.3
Created-By: 1.8.0_232 (Amazon.com Inc.)
Export-Package: io.gsonfire;version="1.8.3";uses:="com.google.gson"
Import-Package: com.google.gson;version="[2.7,3)",com.google.gson.anno
 tations;version="[2.7,3)",com.google.gson.internal.bind,com.google.gs
 on.reflect;version="[2.7,3)",com.google.gson.stream;version="[2.7,3)"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.6))"
Tool: Bnd-5.0.0.202001221519

Is that what you are looking for? If that is the case I can release a new version right away

Hello, thank you for your reply! Looks good at first sight, I don't have time to test it at the moment. If you release it, I will give it a try as soon as I find time and let you know. Thank you!

Released 1.9.0-alpha1. Please validate if you have time. Thanks!
(Ignore this message, see next one)

Released 1.9.0-alpha2. Please validate if you have time. Thanks!

<dependency>
    <groupId>io.gsonfire</groupId>
    <artifactId>gson-fire</artifactId>
    <version>1.9.0-alpha2</version>
</dependency>

Hello julman99,
I have tested the OSGi Support of gsonfire on behalf of @abangerl. Switching to the version that you have released (1.9.0-alpha2) didn't seem to cause any problems for our project!

We have noticed a small difference in the Manifest considering the "Export-Package"s: Our old Version of gsonfire was exporting io.gsonfire.* (all packages), whereas the version you provided only seems to export classes under io.gsonfire

Generally speaking, every package which contains classes that are considered to be part of the "Public API" should be exported.

Best Regards

Ok great! I will fix the wildcard and release on Saturday

Thank you, I will give the official version a try as soon as it's released and report back to you!

I released as 1.8.4 since it does not have major changes. It may take an hour or so to appear in Maven Central.

Thanks again for your suggestion!

Works like a charm with the official version, thanks.

Awesome! Thanks for the suggestion