Esri / geometry-api-java

The Esri Geometry API for Java enables developers to write custom applications for analysis of spatial data. This API is used in the Esri GIS Tools for Hadoop and other 3rd-party data processing solutions.
Apache License 2.0
694 stars 260 forks source link

Add OSGi package information #300

Closed tcalmant closed 1 year ago

tcalmant commented 1 year ago

Hi,

This PR adds the generation of OSGi metadata in the Manifest file. Added dependency is only declaring annotations, i.e. it doesn't add a runtime requirement.

stolstov commented 1 year ago

@randallwhitman Could you review?

randallwhitman commented 1 year ago

Hi @tcalmant - thanks for offering this contribution. Can you please explain a bit the objective of adding this to geometry-api-java - thanks in advance.

tcalmant commented 1 year ago

Hi @randallwhitman

This addition generates the Import-Package and Export-Package entries in the MANIFEST.MF of the library's JAR file. This allows it to be considered an OSGi bundle and to be installed/used in an OSGi application by other bundles. Without those metadata, other bundles can't load classes from the library as they are considered private by default.

Here is the specification of OSGi: https://docs.osgi.org/specification/osgi.core/8.0.0/framework.introduction.html

randallwhitman commented 1 year ago

Thanks. Will it require any changes to applications not using the OSGi framework?

tcalmant commented 1 year ago

No changes required for other applications. The annotations added in the package-info.java files, Export and Version, are of CLASS retention policy, which means they are accessible reading the .class file directly, but are not loaded at runtime and therefore don't require new runtime libraries.

Note that it is useful to update the Version annotations when updating the library, as it allows the OSGi applications to know if they are compatible with a given JAR file.

randallwhitman commented 1 year ago

OK, sounds reasonable, thanks.

stolstov commented 1 year ago

@tcalmant Thakn you for contribution. @randallwhitman Thank you for review.