From 5a4de581557ce6915f86838b22dfcd3919133be7 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 | 15 ++++++++++ .../consumer.open/META-INF/MANIFEST.MF | 8 +++++ .../version_ranges/consumer.open/pom.xml | 15 ++++++++++ .../consumer.wide/META-INF/MANIFEST.MF | 8 +++++ .../version_ranges/consumer.wide/pom.xml | 15 ++++++++++ .../set-version/version_ranges/pom.xml | 30 +++++++++++++++++++ .../provider.bundle/META-INF/MANIFEST.MF | 7 +++++ .../version_ranges/provider.bundle/pom.xml | 15 ++++++++++ .../DefaultVersionRangeUpdateStrategy.java | 4 +-- .../tycho/versions/engine/VersionsEngine.java | 2 +- .../targetplatform/pom.xml_expected | 2 +- 12 files changed, 125 insertions(+), 4 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..8bde19cd5f --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.narrow/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + + org.tycho.its + parent + 1.0.0-SNAPSHOT + ../parent + + 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..f679b8c738 --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.open/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + + org.tycho.its + parent + 1.0.0-SNAPSHOT + ../parent + + 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..a77057d033 --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/consumer.wide/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + + org.tycho.its + parent + 1.0.0-SNAPSHOT + ../parent + + 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..c5b3912f15 --- /dev/null +++ b/tycho-its/projects/tycho-version-plugin/set-version/version_ranges/provider.bundle/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + + org.tycho.its + parent + 1.0.0-SNAPSHOT + ../parent + + 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; diff --git a/tycho-versions-plugin/src/test/resources/projects/targetplatform/targetplatform/pom.xml_expected b/tycho-versions-plugin/src/test/resources/projects/targetplatform/targetplatform/pom.xml_expected index 23049465b8..defa41f08e 100644 --- a/tycho-versions-plugin/src/test/resources/projects/targetplatform/targetplatform/pom.xml_expected +++ b/tycho-versions-plugin/src/test/resources/projects/targetplatform/targetplatform/pom.xml_expected @@ -2,7 +2,7 @@ 4.0.0 targetplatform targetplatform - 0.1.0-SNAPSHOT + 0.2.0-SNAPSHOT pom