Skip to content

Commit

Permalink
Add testcase for version ranges in version-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Jan 10, 2024
1 parent 50864c6 commit 5a4de58
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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)"

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.tycho.its</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>consumer.narrow</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
@@ -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"

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.tycho.its</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>consumer.open</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
@@ -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)"

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.tycho.its</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>consumer.wide</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.tycho.its</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>provider.bundle</module>
<module>consumer.narrow</module>
<module>consumer.wide</module>
<module>consumer.open</module>
</modules>
<properties>
<tycho-version>5.0.0-SNAPSHOT</tycho-version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -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"

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.tycho.its</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>provider.bundle</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ 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;
}
return handleNewlyOutOfScopeVersions(newVersionRange, originalReferencedVersion, newReferencedVersion,
newArtifactVersion);
}

private VersionRange handleMatchingBouds(VersionRange versionRange, Version originalReferencedVersion,
private VersionRange handleMatchingBounds(VersionRange versionRange, Version originalReferencedVersion,
Version newReferencedVersion) {
Version newLeft;
if (versionRange.getLeft().equals(originalReferencedVersion)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>targetplatform</groupId>
<artifactId>targetplatform</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
<packaging>pom</packaging>

<build>
Expand Down

0 comments on commit 5a4de58

Please sign in to comment.