diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.micro/META-INF/MANIFEST.MF b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.micro/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..b607d50bb6
--- /dev/null
+++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.micro/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Bundle
+Bundle-SymbolicName: consumer.micro
+Bundle-Version: 1.0.0.qualifier
+Import-Package: my.pkg;version="[1.0.0,1.0.1)"
+Require-Bundle: provider.bundle;bundle-version="[1.0.0,1.0.1)"
+
diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.micro/pom.xml b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.micro/pom.xml
new file mode 100644
index 0000000000..a537103dd8
--- /dev/null
+++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.micro/pom.xml
@@ -0,0 +1,14 @@
+
+
+ 4.0.0
+
+
+ org.tycho.its
+ parent
+ 1.0.0-SNAPSHOT
+
+ consumer.micro
+ eclipse-plugin
+
diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/pom.xml b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/pom.xml
index 51bc05f3bb..893b0e6ed1 100644
--- a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/pom.xml
+++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/pom.xml
@@ -10,6 +10,7 @@
pom
provider.bundle
+ consumer.micro
consumer.narrow
consumer.wide
consumer.open
diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/versionsplugin/TychoVersionsPluginTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/versionsplugin/TychoVersionsPluginTest.java
index 1c6453a866..4d992bb387 100644
--- a/tycho-its/src/test/java/org/eclipse/tycho/test/versionsplugin/TychoVersionsPluginTest.java
+++ b/tycho-its/src/test/java/org/eclipse/tycho/test/versionsplugin/TychoVersionsPluginTest.java
@@ -150,6 +150,7 @@ public void updateVersionRanges() throws Exception {
String expectedNewMavenVersion = "1.1.0-SNAPSHOT";
String expectedNewOSGiVersion = "1.1.0.qualifier";
String expectedPackageVersion = "1.1.0";
+ String expectedMicroVersionRange = "[" + expectedPackageVersion + ",1.1.1)";
String expectedNarrowVersionRange = "[" + expectedPackageVersion + ",1.2.0)";
String expectedWideVersionRange = "[" + expectedPackageVersion + ",2)";
// example call:
@@ -187,6 +188,13 @@ public void updateVersionRanges() throws Exception {
assertVersionRange(consumerNarrow, expectedNarrowVersionRange, Constants.IMPORT_PACKAGE);
assertVersionRange(consumerNarrow, expectedNarrowVersionRange, Constants.REQUIRE_BUNDLE);
}
+ {// check micro version range is updated
+ Manifest consumerNarrow = getManifest(verifier, "consumer.micro");
+ assertEquals("version in manifest was not updated for micro consumer bundle!", expectedNewOSGiVersion,
+ consumerNarrow.getMainAttributes().getValue(Constants.BUNDLE_VERSION));
+ assertVersionRange(consumerNarrow, expectedMicroVersionRange, Constants.IMPORT_PACKAGE);
+ assertVersionRange(consumerNarrow, expectedMicroVersionRange, Constants.REQUIRE_BUNDLE);
+ }
}
private Manifest getManifest(Verifier verifier, String bundle) throws IOException, FileNotFoundException {
diff --git a/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/engine/DefaultVersionRangeUpdateStrategy.java b/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/engine/DefaultVersionRangeUpdateStrategy.java
index 82af6bfd22..b20e57ce0e 100644
--- a/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/engine/DefaultVersionRangeUpdateStrategy.java
+++ b/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/engine/DefaultVersionRangeUpdateStrategy.java
@@ -49,7 +49,12 @@ private VersionRange computeNewVersionRange(VersionRange versionRange, Version o
Version newReferencedVersion, Version newArtifactVersion) {
VersionRange newVersionRange;
if (updateMatchingBounds) {
- if (isProviderRange(versionRange)) {
+ if (isMicroRange(versionRange)) {
+ return new VersionRange(
+ VersionRange.LEFT_CLOSED, newReferencedVersion, new Version(newReferencedVersion.getMajor(),
+ newReferencedVersion.getMinor(), newReferencedVersion.getMicro() + 1),
+ VersionRange.RIGHT_OPEN);
+ } else if (isProviderRange(versionRange)) {
return new VersionRange(VersionRange.LEFT_CLOSED, newReferencedVersion,
new Version(newReferencedVersion.getMajor(), newReferencedVersion.getMinor() + 1, 0),
VersionRange.RIGHT_OPEN);
@@ -62,6 +67,19 @@ private VersionRange computeNewVersionRange(VersionRange versionRange, Version o
newArtifactVersion);
}
+ private boolean isMicroRange(VersionRange versionRange) {
+ if (versionRange.getLeftType() == VersionRange.LEFT_CLOSED
+ && versionRange.getRightType() == VersionRange.RIGHT_OPEN) {
+ Version right = versionRange.getRight();
+ if (right != null) {
+ Version left = versionRange.getLeft();
+ return left.getMajor() == right.getMajor() && left.getMinor() == right.getMinor()
+ && right.getMicro() > left.getMicro();
+ }
+ }
+ return false;
+ }
+
private boolean isProviderRange(VersionRange versionRange) {
if (versionRange.getLeftType() == VersionRange.LEFT_CLOSED
&& versionRange.getRightType() == VersionRange.RIGHT_OPEN) {