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

bundle plugin added with embedded mandatory dependencies #104

Merged
merged 3 commits into from
Feb 22, 2022

Conversation

balazsjonas
Copy link
Contributor

The goal of this pull request to make easier to use rtee in osgi environments.

Example can be find here:
https://github.com/balazsjonas/RtreeKarafTest

@codecov-io
Copy link

codecov-io commented May 10, 2020

Codecov Report

Merging #104 into master will increase coverage by 4.98%.
The diff coverage is 38.09%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #104      +/-   ##
============================================
+ Coverage     75.88%   80.86%   +4.98%     
+ Complexity      824      802      -22     
============================================
  Files            72       72              
  Lines          2322     2101     -221     
  Branches        312      282      -30     
============================================
- Hits           1762     1699      -63     
+ Misses          472      318     -154     
+ Partials         88       84       -4     
Impacted Files Coverage Δ Complexity Δ
...avidmoten/rtree/geometry/internal/PointDouble.java 54.76% <31.57%> (-19.16%) 21.00 <3.00> (+3.00) ⬇️
...ithub/davidmoten/rtree/internal/RectangleUtil.java 58.00% <100.00%> (+2.00%) 20.00 <3.00> (+3.00)
.../davidmoten/rtree/internal/util/PriorityQueue.java 0.00% <0.00%> (-18.23%) 0.00% <0.00%> (-15.00%)
...m/github/davidmoten/rtree/geometry/Intersects.java 53.22% <0.00%> (-1.47%) 1.00% <0.00%> (-1.00%)
.../java/com/github/davidmoten/rtree/Serializers.java 56.75% <0.00%> (-0.39%) 5.00% <0.00%> (-1.00%)
...github/davidmoten/rtree/fbs/FlatBuffersHelper.java 90.55% <0.00%> (-0.15%) 35.00% <0.00%> (-1.00%)
...main/java/com/github/davidmoten/rtree/Entries.java 100.00% <0.00%> (ø) 1.00% <0.00%> (-1.00%)
...in/java/com/github/davidmoten/rtree/Factories.java 100.00% <0.00%> (ø) 1.00% <0.00%> (-1.00%)
...n/java/com/github/davidmoten/rtree/ImageSaver.java 100.00% <0.00%> (ø) 2.00% <0.00%> (-1.00%)
...java/com/github/davidmoten/rtree/Backpressure.java 100.00% <0.00%> (ø) 13.00% <0.00%> (-1.00%)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed05112...35a0b4c. Read the comment docs.

Copy link
Owner

@davidmoten davidmoten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, I haven't made bundles before so this is new territory for me.

I ran mvn clean install and saw some warnings:

[INFO] --- maven-bundle-plugin:4.2.1:bundle (default-bundle) @ rtree ---
[WARNING] Bundle com.github.davidmoten:rtree:bundle:0.8.8-SNAPSHOT : Export com.github.davidmoten.rtree,  has 4,  private references [com.github.davidmoten.guavamini, com.github.davidmoten.rtree.internal, rx, rx.functions]
[WARNING] Bundle com.github.davidmoten:rtree:bundle:0.8.8-SNAPSHOT : Export com.github.davidmoten.rtree.geometry,  has 1,  private references [rx.functions]
[WARNING] Bundle com.github.davidmoten:rtree:bundle:0.8.8-SNAPSHOT : Export com.github.davidmoten.rtree.fbs,  has 1,  private references [rx.functions]
[WARNING] Bundle com.github.davidmoten:rtree:bundle:0.8.8-SNAPSHOT : Export com.github.davidmoten.rtree.kryo,  has 1,  private references [rx.functions]

What should we do about them?

@balazsjonas
Copy link
Contributor Author

Thanks for the contribution, I haven't made bundles before so this is new territory for me.
I ran mvn clean install and saw some warnings:
[INFO] --- maven-bundle-plugin:4.2.1:bundle (default-bundle) @ rtree ---
[WARNING] Bundle com.github.davidmoten:rtree:bundle:0.8.8-SNAPSHOT : Export com.github.davidmoten.rtree, has 4, private references [com.github.davidmoten.guavamini, com.github.davidmoten.rtree.internal, rx, rx.functions]
[WARNING] Bundle com.github.davidmoten:rtree:bundle:0.8.8-SNAPSHOT : Export com.github.davidmoten.rtree.geometry, has 1, private references [rx.functions]
[WARNING] Bundle com.github.davidmoten:rtree:bundle:0.8.8-SNAPSHOT : Export com.github.davidmoten.rtree.fbs, has 1, private references [rx.functions]
[WARNING] Bundle com.github.davidmoten:rtree:bundle:0.8.8-SNAPSHOT : Export com.github.davidmoten.rtree.kryo, has 1, private references [rx.functions]

What should we do about them?

I made a huge mistake. An invalid tag left in the code instead of Export-Package.

About your question. I think the first part of the warning is valid and I committed the correction. But I have to check this.
In the example some classes from rtree.geometry were used.

The second part of the warning guava-mini and rxjava is embeded which means these will be available on classpath at runtime.

The third part is about optional dependencies. I think the user of the library should provide these.

pom.xml Outdated
<Export-Package>
com.github.davidmoten.rtree;
com.github.davidmoten.rtree.geometry;
com.github.davidmoten.rtree.internal;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we export an internal package?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why aren't we exporting all public packages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Some classes have reference to internal classes, which should also be available to the users. Eg. Geometries refers to classes in rtree.geometry.internal.
  2. The easiest way seems to export all public packages. This is the least invasive. I think we can use wildcard '*'.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at RxJava bundle and it looks like this:

'Export-Package': '!io.reactivex.rxjava3.internal.*, io.reactivex.rxjava3.*'

I assume that ! means don't export the internal stuff. We should do the same.

Copy link
Contributor Author

@balazsjonas balazsjonas May 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something like this should work:
com.github.davidmoten.rtree.*;

Also guava is similar to rxjava's exporting.
We will still have warnings but only for optional dependencies. Without packages optional and geometry bundles using them cannot be activated and we would get error like this:

Error executing command: Error installing bundles:
	Unable to start bundle mvn:bjonas/RtreeKarafTest/1.0-SNAPSHOT: org.osgi.framework.BundleException: Unable to resolve bjonas.RtreeKarafTest [50](R 50.0): missing requirement [bjonas.RtreeKarafTest [50](R 50.0)] osgi.wiring.package; (&(osgi.wiring.package=com.github.davidmoten.rtree.geometry)(version>=0.8.0)(!(version>=1.0.0))) Unresolved requirements: [[bjonas.RtreeKarafTest [50](R 50.0)] osgi.wiring.package; (&(osgi.wiring.package=com.github.davidmoten.rtree.geometry)(version>=0.8.0)(!(version>=1.0.0)))]

Co-authored-by: Balázs Jónás <43934292+balazsjonas@users.noreply.github.com>
Copy link
Owner

@davidmoten davidmoten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Righto, let's run with what you've got, thanks

@davidmoten davidmoten merged commit c0f6673 into davidmoten:master Feb 22, 2022
davidmoten added a commit that referenced this pull request Feb 22, 2022
@davidmoten
Copy link
Owner

resolved in 0.9 on Maven Central now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants