Supports x.y.z releases and service releases.
Versions such as 3.0.0 or 3.1.1
This commit is contained in:
@@ -417,14 +417,16 @@ public class ProjectVersion implements Comparable<ProjectVersion>, Serializable
|
||||
if (!StringUtils.hasText(this.version)) {
|
||||
return false;
|
||||
}
|
||||
if (this.version.contains("RELEASE")) {
|
||||
return true;
|
||||
}
|
||||
SplitVersion splitVersion = assertVersion();
|
||||
log.info("isRelease split version: " + splitVersion);
|
||||
if (splitVersion.calverReleaseTrain()) {
|
||||
if (StringUtils.isEmpty(splitVersion.suffix)) { // this is an x.y.z release
|
||||
if (Integer.parseInt(splitVersion.patch) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return this.version.contains("RELEASE");
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isReleaseTrain() {
|
||||
@@ -445,13 +447,16 @@ public class ProjectVersion implements Comparable<ProjectVersion>, Serializable
|
||||
if (!StringUtils.hasText(this.version)) {
|
||||
return false;
|
||||
}
|
||||
if (this.version.matches(".*.SR[0-9]+")) {
|
||||
return true;
|
||||
}
|
||||
SplitVersion splitVersion = assertVersion();
|
||||
if (splitVersion.calverReleaseTrain()) {
|
||||
if (StringUtils.isEmpty(splitVersion.suffix)) { // this is an x.y.z release
|
||||
if (Integer.parseInt(splitVersion.patch) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return this.version.matches(".*.SR[0-9]+");
|
||||
return false;
|
||||
}
|
||||
|
||||
private ReleaseType toReleaseType() {
|
||||
@@ -773,15 +778,12 @@ public class ProjectVersion implements Comparable<ProjectVersion>, Serializable
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringCreator(this)
|
||||
.append("major", major)
|
||||
.append("minor", minor)
|
||||
.append("patch", patch)
|
||||
.append("delimiter", delimiter)
|
||||
.append("suffix", suffix)
|
||||
.toString();
|
||||
return new ToStringCreator(this).append("major", major).append("minor", minor)
|
||||
.append("patch", patch).append("delimiter", delimiter)
|
||||
.append("suffix", suffix).toString();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class TrainVersionNumber implements Comparable<TrainVersionNumber> {
|
||||
|
||||
@@ -115,6 +115,8 @@ public class ProjectVersionTests {
|
||||
then(ProjectVersion.isValid("1.0.1-SNAPSHOT")).isTrue();
|
||||
then(ProjectVersion.isValid("1.0.3-RC1")).isTrue();
|
||||
then(ProjectVersion.isValid("1.0.4-M1")).isTrue();
|
||||
then(ProjectVersion.isValid("3.0.0")).isTrue();
|
||||
then(ProjectVersion.isValid("3.1.1")).isTrue();
|
||||
then(ProjectVersion.isValid("Finchley-SNAPSHOT")).isTrue();
|
||||
then(ProjectVersion.isValid("Finchley.RELEASE")).isTrue();
|
||||
then(ProjectVersion.isValid("Finchley-SR1")).isTrue();
|
||||
@@ -155,6 +157,8 @@ public class ProjectVersionTests {
|
||||
then(projectVersion("2020.0.0-M1").major()).isEqualTo("2020");
|
||||
then(projectVersion("2020.0.0").major()).isEqualTo("2020");
|
||||
then(projectVersion("2021.1.1").major()).isEqualTo("2021");
|
||||
then(projectVersion("3.0.0").major()).isEqualTo("3");
|
||||
then(projectVersion("3.1.1").major()).isEqualTo("3");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -271,6 +275,10 @@ public class ProjectVersionTests {
|
||||
String newReleaseSuffixVersion = "2020.0.0";
|
||||
|
||||
then(projectVersion(newReleaseSuffixVersion).isRelease()).isTrue();
|
||||
|
||||
newReleaseSuffixVersion = "3.0.0";
|
||||
|
||||
then(projectVersion(newReleaseSuffixVersion).isRelease()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -282,6 +290,10 @@ public class ProjectVersionTests {
|
||||
String newServiceReleaseVersion = "2020.0.1";
|
||||
|
||||
then(projectVersion(newServiceReleaseVersion).isServiceRelease()).isTrue();
|
||||
|
||||
newServiceReleaseVersion = "3.0.1";
|
||||
|
||||
then(projectVersion(newServiceReleaseVersion).isServiceRelease()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user