mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-10-26 08:06:09 +01:00
Fix handling of snapshot plugin dependencies
This commit is contained in:
@@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Changed
|
||||
- Centralise syntax highlighting ([#1382](https://github.com/scm-manager/scm-manager/pull/1382))
|
||||
|
||||
### Fixed
|
||||
- Handling of snapshot plugin dependencies ([#1384](https://github.com/scm-manager/scm-manager/pull/1384))
|
||||
|
||||
## [2.6.3] - 2020-10-16
|
||||
### Fixed
|
||||
- Missing default permission to manage public gpg keys ([#1377](https://github.com/scm-manager/scm-manager/pull/1377))
|
||||
|
||||
@@ -31,6 +31,8 @@ import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ComparisonChain;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -43,6 +45,8 @@ import java.util.Locale;
|
||||
public final class Version implements Comparable<Version>
|
||||
{
|
||||
|
||||
private static final Pattern MAVEN_UNIQUE_SNAPSHOT = Pattern.compile("-[0-9]{8}\\.[0-9]{6}-[0-9]+");
|
||||
|
||||
/**
|
||||
* Constructs a new version object
|
||||
*
|
||||
@@ -388,10 +392,15 @@ public final class Version implements Comparable<Version>
|
||||
{
|
||||
String qualifier = qualifierPart.trim().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (qualifier.contains("snapshot"))
|
||||
{
|
||||
if (qualifier.contains("snapshot")) {
|
||||
snapshot = true;
|
||||
qualifier = qualifier.replace("snapshot", "");
|
||||
} else {
|
||||
Matcher matcher = MAVEN_UNIQUE_SNAPSHOT.matcher(qualifier);
|
||||
if (matcher.matches()) {
|
||||
snapshot = true;
|
||||
qualifier = matcher.replaceAll("-");
|
||||
}
|
||||
}
|
||||
|
||||
if (qualifier.length() > 0)
|
||||
|
||||
@@ -145,4 +145,11 @@ class VersionTest {
|
||||
void testUnparseable() {
|
||||
assertThrows(VersionParseException.class, () -> Version.parse("aaaa"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldDetectUniqueMavenSnapshotVersion() {
|
||||
Version version = Version.parse("1.0.0-20201022.094711-15");
|
||||
assertThat(version.isSnapshot()).isTrue();
|
||||
assertThat(version).hasToString("1.0.0-SNAPSHOT");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +144,17 @@ class PluginInstallationVerifierTest {
|
||||
PluginInstallationVerifier.verify(context, descriptor);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("squid:S2699") // we are happy if no exception is thrown
|
||||
void shouldVerifyPluginWithSnapshotDependencies() {
|
||||
matchConditions();
|
||||
|
||||
PluginInstallationContext context = mockInstallationOf(IID_PLUGIN, "1.0.0-SNAPSHOT");
|
||||
mockDependingOf(IID_PLUGIN, "1.0.0-20201022.094711-15");
|
||||
|
||||
PluginInstallationVerifier.verify(context, descriptor);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("squid:S2699") // we are happy if no exception is thrown
|
||||
void shouldVerifyPluginWithOptionalDependency() {
|
||||
|
||||
Reference in New Issue
Block a user