Skip to content

Add OSGi package information#300

Merged
stolstov merged 1 commit into
Esri:masterfrom
tcalmant:osgi
Feb 13, 2023
Merged

Add OSGi package information#300
stolstov merged 1 commit into
Esri:masterfrom
tcalmant:osgi

Conversation

@tcalmant

@tcalmant tcalmant commented Feb 9, 2023

Copy link
Copy Markdown
Contributor

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

stolstov commented Feb 9, 2023

Copy link
Copy Markdown
Member

@randallwhitman Could you review?

@randallwhitman

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor

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

@tcalmant

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor

OK, sounds reasonable, thanks.

@stolstov stolstov merged commit e237fc0 into Esri:master Feb 13, 2023
@stolstov

Copy link
Copy Markdown
Member

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

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