From 8a9d8fa1c07cdc7fa197fa6985ddbce449f40e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Wed, 10 Jan 2024 12:49:41 +0100 Subject: [PATCH] Add testcase for version ranges in version-plugin --- .../consumer.narrow/META-INF/MANIFEST.MF | 8 +++++ .../version_ranges/consumer.narrow/pom.xml | 14 +++++++++ .../consumer.open/META-INF/MANIFEST.MF | 8 +++++ .../version_ranges/consumer.open/pom.xml | 14 +++++++++ .../consumer.wide/META-INF/MANIFEST.MF | 8 +++++ .../version_ranges/consumer.wide/pom.xml | 14 +++++++++ .../set-version/version_ranges/pom.xml | 30 +++++++++++++++++++ .../provider.bundle/META-INF/MANIFEST.MF | 7 +++++ .../version_ranges/provider.bundle/pom.xml | 14 +++++++++ .../DefaultVersionRangeUpdateStrategy.java | 4 +-- .../tycho/versions/engine/VersionsEngine.java | 2 +- 11 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.narrow/META-INF/MANIFEST.MF create mode 100644 tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.narrow/pom.xml create mode 100644 tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.open/META-INF/MANIFEST.MF create mode 100644 tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.open/pom.xml create mode 100644 tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.wide/META-INF/MANIFEST.MF create mode 100644 tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.wide/pom.xml create mode 100644 tycho-its/projects/tycho-version-plugin/set-version/version_ranges/pom.xml create mode 100644 tycho-its/projects/tycho-version-plugin/set-version/version_ranges/provider.bundle/META-INF/MANIFEST.MF create mode 100644 tycho-its/projects/tycho-version-plugin/set-version/version_ranges/provider.bundle/pom.xml diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.narrow/META-INF/MANIFEST.MF b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.narrow/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..e6f03b5ea7 --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.narrow/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Test Bundle +Bundle-SymbolicName: consumer.narrow +Bundle-Version: 1.0.0.qualifier +Import-Package: my.pkg;version="[1.0.0,1.1.0)" +Require-Bundle: provider.bundle;bundle-version="[1.0.0,1.1.0)" + diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.narrow/pom.xml b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.narrow/pom.xml new file mode 100644 index 0000000000..04a3011c43 --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.narrow/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + + org.tycho.its + parent + 1.0.0-SNAPSHOT + + consumer.narrow + eclipse-plugin + diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.open/META-INF/MANIFEST.MF b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.open/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..0eb3ef6540 --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.open/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Test Bundle +Bundle-SymbolicName: consumer.open +Bundle-Version: 1.0.0.qualifier +Import-Package: my.pkg;version="1.0.0" +Require-Bundle: provider.bundle;bundle-version="1.0.0" + diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.open/pom.xml b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.open/pom.xml new file mode 100644 index 0000000000..7946f45536 --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.open/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + + org.tycho.its + parent + 1.0.0-SNAPSHOT + + consumer.open + eclipse-plugin + diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.wide/META-INF/MANIFEST.MF b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.wide/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..aca62a2769 --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.wide/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Test Bundle +Bundle-SymbolicName: consumer.wide +Bundle-Version: 1.0.0.qualifier +Import-Package: my.pkg;version="[1.0.0,2.0.0)" +Require-Bundle: provider.bundle;bundle-version="[1.0.0,2.0.0)" + diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.wide/pom.xml b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.wide/pom.xml new file mode 100644 index 0000000000..1b29ad9d6f --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.wide/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + + org.tycho.its + parent + 1.0.0-SNAPSHOT + + consumer.wide + 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 new file mode 100644 index 0000000000..51bc05f3bb --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + org.tycho.its + parent + 1.0.0-SNAPSHOT + pom + + provider.bundle + consumer.narrow + consumer.wide + consumer.open + + + 5.0.0-SNAPSHOT + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho-version} + true + + + + diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/provider.bundle/META-INF/MANIFEST.MF b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/provider.bundle/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..f19a740983 --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/provider.bundle/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Test Bundle +Bundle-SymbolicName: provider.bundle +Bundle-Version: 1.0.0.qualifier +Export-Package: my.pkg;version="1.0.0" + diff --git a/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/provider.bundle/pom.xml b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/provider.bundle/pom.xml new file mode 100644 index 0000000000..a1869a8c1b --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/provider.bundle/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + + org.tycho.its + parent + 1.0.0-SNAPSHOT + + provider.bundle + eclipse-plugin + 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 23b619f909..78df8d5f92 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,7 @@ private VersionRange computeNewVersionRange(VersionRange versionRange, Version o Version newReferencedVersion, Version newArtifactVersion) { VersionRange newVersionRange; if (updateMatchingBounds) { - newVersionRange = handleMatchingBouds(versionRange, originalReferencedVersion, newReferencedVersion); + newVersionRange = handleMatchingBounds(versionRange, originalReferencedVersion, newReferencedVersion); } else { newVersionRange = versionRange; } @@ -57,7 +57,7 @@ private VersionRange computeNewVersionRange(VersionRange versionRange, Version o newArtifactVersion); } - private VersionRange handleMatchingBouds(VersionRange versionRange, Version originalReferencedVersion, + private VersionRange handleMatchingBounds(VersionRange versionRange, Version originalReferencedVersion, Version newReferencedVersion) { Version newLeft; if (versionRange.getLeft().equals(originalReferencedVersion)) { diff --git a/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/engine/VersionsEngine.java b/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/engine/VersionsEngine.java index ce8258f40e..5da2490aeb 100644 --- a/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/engine/VersionsEngine.java +++ b/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/engine/VersionsEngine.java @@ -112,7 +112,7 @@ public void reset() { public void apply() throws IOException { VersionChangesDescriptor versionChangeContext = new VersionChangesDescriptor(originalVersionChanges, - new DefaultVersionRangeUpdateStrategy(updateVersionRangeMatchingBounds), projects); + new DefaultVersionRangeUpdateStrategy(isUpdateVersionRangeMatchingBounds()), projects); // collecting secondary changes boolean newChanges = true;