Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 477328

Summary: set-version mojo should update version ranges
Product: z_Archived Reporter: Sebastien Arod <sebastien.arod>
Component: TychoAssignee: Jan Sievers <jan.sievers>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: jan.sievers, Martin.SCHREIBER, michael, sebastien.arod, vincent.guignot
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/57228
https://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=bd715d9dc044256e9298a8b71cbab2b910f6623c
Whiteboard:
Attachments:
Description Flags
Sample project to play with set-version none

Description Sebastien Arod CLA 2015-09-14 04:00:32 EDT
Created attachment 256545 [details]
Sample project to play with set-version

I'm using tycho set-version to change my version numbers.

The documentation states that "it consistently updates the version strings in the project's configuration files (e.g. pom.xml and META-INF/MANIFEST.MF) and all references to that project (e.g. in a feature.xml)."

However references from other bundles (using Require-Bundle) and references from fragment (using Fragment-Host) for which the lower bound matches the current version are not updated.

It would be nice to have an option to update matching lower bounds version.
Comment 1 Martin Schreiber CLA 2015-09-25 04:55:40 EDT
I think exact versions must be updated anyway, e.g.

Fragment-Host: thehostbundle;bundle-version="1.0.0"

should be updated without having such an option - right?

The option might be something like "updateVersionBounds" which can be

updateVersionBounds=lower
updateVersionBounds=upper
updateVersionBounds=both

and according to the value, the lower, upper or both version bounds are updated for Required-Bundle and Fragment-Hosts are updated if the old version matches that bound.

What do you think about that?
Comment 2 Jan Sievers CLA 2015-09-29 05:14:06 EDT
(In reply to Martin Schreiber from comment #1)
> I think exact versions must be updated anyway, e.g.
> 
> Fragment-Host: thehostbundle;bundle-version="1.0.0"
> 
> should be updated without having such an option - right?

not sure if that is actually a lower bound only (at least for Require-Bundle a single bundle-version is a shorthand for a lower bound without upper bound IIRC) need to check the OSGi spec.

> 
> The option might be something like "updateVersionBounds" which can be
> 
> updateVersionBounds=lower
> updateVersionBounds=upper
> updateVersionBounds=both
> 
> and according to the value, the lower, upper or both version bounds are
> updated for Required-Bundle and Fragment-Hosts are updated if the old
> version matches that bound.
> 
> What do you think about that?

generally speaking, the problem occurs only if the new (increased) version is outside of the dependency version range. In the normal case (version increase) this means only the upper bound (if any) must be increased. Updating both upper and lower bound may also make sense if you want a perfect version match.

Not sure if updating the lower bound only makes sense. The only scenario I can imagine where this may be needed is if you decrease the version; that is a strange usecase IMHO.
Comment 3 Sebastien Arod CLA 2015-09-29 05:56:57 EDT
(In reply to Jan Sievers from comment #2)
> (In reply to Martin Schreiber from comment #1)
> > I think exact versions must be updated anyway, e.g.
> > 
> > Fragment-Host: thehostbundle;bundle-version="1.0.0"
> > 
> > should be updated without having such an option - right?
> 
> not sure if that is actually a lower bound only (at least for Require-Bundle
> a single bundle-version is a shorthand for a lower bound without upper bound
> IIRC) need to check the OSGi spec.


If a single version is specified it is a lower bound:
From the OSGI spec https://osgi.org/download/r5/osgi.core-5.0.0.pdf#G5.3189033
"If a version range is specified as a single version, it must be interpreted as the range [version,∞)"
Comment 4 Sebastien Arod CLA 2015-09-29 09:55:29 EDT
Would you accept contribution on this enhancement?
Comment 5 Jan Sievers CLA 2015-09-29 10:24:34 EDT
(In reply to Sebastien Arod from comment #4)
> Would you accept contribution on this enhancement?

sure. See https://wiki.eclipse.org/Tycho/Contributor_Guide on how to contribute

you may also want to update the bug title to

"set-version mojo should update version ranges if new version is outside range" (at least this is what I understood from the discussion)
Comment 6 Sebastien Arod CLA 2015-09-29 12:45:48 EDT
IMHO

Changing version when newVersion starts being outside of the range should be automatic otherwise the project will stop compiling after set-version execution.
In practice this can happen when
* Ranges with lower bounds and upper bounds are used and version is set outside the range
* Use lower bounds only and use set-version to set a lower version number. This is probably quite rare.

However it is also useful to support configuring set-version to update the lower bound if it matches to keep it "in sync" with the referenced bundle.
This was my original use-case.

So we would probably need a boolean option alwaysUpdateMatchingBounds to keep in sync lower bounds and upper bounds if they were matching the original version regardless of newVersion being in or out of scope.

WDYT?
Comment 7 Eclipse Genie CLA 2015-10-01 11:51:02 EDT
New Gerrit change created: https://git.eclipse.org/r/57228

WARNING: this patchset contains 1370 new lines of code and may require a Contribution Questionnaire (CQ) if the author is not a committer on the project. Please see:https://wiki.eclipse.org/Project_Management_Infrastructure/Creating_A_Contribution_Questionnaire
Comment 8 Sebastien Arod CLA 2015-10-01 11:53:57 EDT
I pushed a change proposal to Gerrit based what I wrote in my last comment.
Comment 9 Sebastien Arod CLA 2015-10-12 03:21:01 EDT
Hi I pushed the changes to gerrit 10 days ago and didn't get any feedback. 

I tried to explain the best I could in the commit message what I add to change and why. Let me know if anything needs to be clarified or if you need more information to facilitate the review.
Comment 10 Jan Sievers CLA 2015-10-12 04:02:35 EDT
(In reply to Sebastien Arod from comment #9)
> Hi I pushed the changes to gerrit 10 days ago and didn't get any feedback. 
> 
> I tried to explain the best I could in the commit message what I add to
> change and why. Let me know if anything needs to be clarified or if you need
> more information to facilitate the review.

I was simply busy. will try to find the time this week.
Comment 11 Eclipse Genie CLA 2015-10-17 16:46:34 EDT
WARNING: this patchset contains 1489 new lines of code and requires a Contribution Questionnaire (CQ), as author sebastien.arod@gmail.com is not a committer on tycho/org.eclipse.tycho. Please see:https://wiki.eclipse.org/Project_Management_Infrastructure/Creating_A_Contribution_Questionnaire
Comment 12 Sebastien Arod CLA 2015-10-20 11:05:23 EDT
Are you waiting for something from me?
I tried to follow the link to the CQ but it requires a committer login.
Comment 13 Jan Sievers CLA 2015-10-20 11:52:14 EDT
(In reply to Sebastien Arod from comment #12)
> Are you waiting for something from me?
> I tried to follow the link to the CQ but it requires a committer login.

no, it's now up to the eclipse IP team to review the patch from a legal point of view and give the OK. Once we have the OK we can submit. Sorry for the process overhead but this is how the eclipse IP process works.

I'd like to get this into 0.24.0 next week but I cannot influence how quick the IP team will do the review, let's see.

hint for next time: smaller patches (< 1000 LOC) do not require CQ
Comment 14 Jan Sievers CLA 2015-11-19 04:29:36 EST
CQ 10277 was approved 

I will merge now
Comment 16 Jan Sievers CLA 2015-11-20 03:28:50 EST
thanks for your patch Sebastien and sorry for the delay in IP review!
Comment 17 Sebastien Arod CLA 2015-11-20 11:35:14 EST
No problem thanks for the merge. 
Next time I'll try to make smaller contributions :)