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

Replace project APIs using antiquated Equinox resolver's VersionRange #1340

Merged

Conversation

HannesWell
Copy link
Member

@HannesWell HannesWell commented Jul 14, 2024

Provide alternatives that are using org.osgi.framework.VersionRange and deprecate the existing methods for removal.

This is extracted from #1163 handling only the simple cases.

Part of #1069.

Copy link
Member Author

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

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

@laeubi or @merks or anyone else, are you interested in reviewing this?

Comment on lines 42 to 43
VersionRange getVersion();
// TODO: alternatively name it getHostVersionRange() ?
Copy link
Member Author

Choose a reason for hiding this comment

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

Since only the return type changes from org.eclipse.osgi.service.resolver.VersionRange to org.osgi.framework.VersionRange to we have to find a new name for the method.
The OSGi spec only talks about the version of a requirement (e.g. host, package or bundle) although technically it can be a version range. With that in mind I found naming the new method just getVersion() a good choice, especially since there is no need to reflect the exact return type in a method name. The method name should reflect the semantic of a method.
Alternatively we could name it for example getHostVersionRange(). But not only would this 'duplicate' the return type information from the method signature but also the information of the containing class.

The same applies for IPackageImportDescription.getVersion() and IRequiredBundleDescription.getVersion().

Copy link
Contributor

Choose a reason for hiding this comment

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

What about getRange()? or we can folow the record semantics and name it versionRange() even though it is a bit unusual at the first place, I found this often convenient to have an interface and use a record as the implementation, then these interface methods are automatically implemented.

Copy link
Member Author

Choose a reason for hiding this comment

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

For me getRange() is not more clear than getVersion().
The point about records is true and actually I like using records but since the implementations are not records we don't have an immediate benefit from that and would would just be a single method with a different style.
But I still find this idea interesting and created #1341 to explore it further.

In the meantime my suggestion is to continue with getVersion(). Since we have enough time to complete that in this release cycle we can immediately replace that method e.g. by version() or versionRange() in #1341.

Copy link

github-actions bot commented Jul 14, 2024

Test Results

   291 files  ±0     291 suites  ±0   56m 33s ⏱️ +49s
 3 580 tests ±0   3 504 ✅ ±0   76 💤 ±0  0 ❌ ±0 
11 037 runs  ±0  10 806 ✅ ±0  231 💤 ±0  0 ❌ ±0 

Results for commit 2db5265. ± Comparison against base commit a37e0a1.

♻️ This comment has been updated with latest results.

@HannesWell HannesWell force-pushed the replace-resolver-VersionRange-APIs branch from b4c63b0 to 56322aa Compare July 14, 2024 08:06
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.pde.doc.user; singleton:=true
Bundle-Version: 3.15.300.qualifier
Bundle-Version: 3.15.400.qualifier
Copy link
Member Author

Choose a reason for hiding this comment

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

Btw. does anybody know the policy when to bump the minor and when to bump the micro/service version of a doc bundle? Because it is usually not used from code (isn't it?) that bundle itself does not really have an API and versioning according to that not really possible, I think?

Copy link
Contributor

Choose a reason for hiding this comment

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

At one point in the history is was 3.14.2200.qualifier suggesting 22 +100 increments. I doubt there is ever a compelling reason to increment the minor version.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's right. Just incrementing the service version forever does not look suitable.
We could just increment the minor version when new API is added or some is removed after the deprecation period. But this could mean that the minor version also raises relatively quickly since the doc is some kind of an aggregator. Again on the other hand it still wouldn't be higher than the aggregator features since they are incremented every time.

Copy link
Contributor

Choose a reason for hiding this comment

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

One could think about just increment the minor version on each release and therefore reset the micro version to zero.

Copy link
Member Author

Choose a reason for hiding this comment

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

That would be possible, but for this change I think it is sufficient if we agree to bump the minor version.

Copy link
Contributor

Choose a reason for hiding this comment

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

What if we align the version of PDE Doc bundle with the version of org.eclipse.pde feature? The argument could be: PDE Doc bundle content should be in sync with a content of main PDE feature.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point.
Although this means that I had to bump the minor version of the o.e.pde feature.
I assumed the p2 version checker would suggest to bump a feature's minor version if a plugin's minor has changed. 🤔
But maybe I confused this.

@HannesWell HannesWell force-pushed the replace-resolver-VersionRange-APIs branch 2 times, most recently from 61a07b6 to d5079fd Compare July 14, 2024 12:48
Provide alternatives that are using org.osgi.framework.VersionRange and
deprecate the existing methods for removal.

Part of eclipse-pde#1069
@HannesWell
Copy link
Member Author

As a follow up I have created #1343 to replace the methods deprecated here in the PDE code base.

If objections are raised I plan to submit this tomorrow Tuesday (European) evening.

@HannesWell
Copy link
Member Author

Thanks to everyone involved.
The new deprecation warnings will be fixed in #1343

@HannesWell HannesWell merged commit 029c7d7 into eclipse-pde:master Jul 16, 2024
14 of 17 checks passed
@HannesWell HannesWell deleted the replace-resolver-VersionRange-APIs branch July 16, 2024 21:33
HannesWell added a commit to HannesWell/eclipse.pde that referenced this pull request Jul 21, 2024
HannesWell added a commit to HannesWell/eclipse.pde that referenced this pull request Jul 21, 2024
HannesWell added a commit to HannesWell/eclipse.pde that referenced this pull request Jul 21, 2024
HannesWell added a commit that referenced this pull request Jul 21, 2024
fedejeanne pushed a commit to fedejeanne/eclipse.pde that referenced this pull request Jul 31, 2024
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.

4 participants