#155 - Fix calver version bump after conclude.

This commit is contained in:
Mark Paluch
2020-10-29 10:42:31 +01:00
parent 6a689a2473
commit d20a245f82
6 changed files with 75 additions and 37 deletions

View File

@@ -242,7 +242,7 @@ class MavenBuildSystem implements BuildSystem {
if (BUILD.equals(project)) {
if (!module.getTrain().usesCalver()) {
mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainNameVersion())) //
mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainVersion())) //
.and(arg("generateBackupPoms").withValue("false")) //
.and(arg("groupId").withValue("org.springframework.data")) //
.and(arg("artifactId").withValue("spring-data-releasetrain")));

View File

@@ -92,31 +92,6 @@ public class UpdateInformation {
return new Repository(train.getIteration());
}
/**
* Returns the version {@link String} to be used to describe the release train.
*
* @return will never be {@literal null}.
*/
public String getReleaseTrainNameVersion() {
boolean usesCalver = train.getTrain().usesCalver();
switch (phase) {
case PREPARE:
return train.getReleaseTrainNameAndVersion();
case CLEANUP:
case MAINTENANCE:
if (usesCalver) {
return String.format("%s-SNAPSHOT", train.getNextBugfixName());
}
return String.format("%s-BUILD-SNAPSHOT", train.getName());
}
throw new IllegalStateException("Unexpected phase detected " + phase + " detected!");
}
/**
* Returns the version {@link String} to be used to describe the release train.
*
@@ -129,10 +104,19 @@ public class UpdateInformation {
switch (phase) {
case PREPARE:
return train.getReleaseTrainNameAndVersion();
case CLEANUP:
case MAINTENANCE:
if (usesCalver) {
return String.format("%s-SNAPSHOT", train.getNextBugfixName());
}
case CLEANUP:
if (usesCalver) {
if (train.getIteration().isGAIteration()) {
return String.format("%s-SNAPSHOT", train.getNextIterationName());
}
return String.format("%s-SNAPSHOT", train.getNextBugfixName());
}

View File

@@ -73,7 +73,7 @@ class ReleaseCommands extends TimedCommand {
git.prepare(iteration);
// build.runPreReleaseChecks(iteration);
build.runPreReleaseChecks(iteration);
misc.prepareChangelogs(iteration);
misc.updateResources(iteration);

View File

@@ -81,7 +81,7 @@ public class TrainIteration implements Streamable<ModuleIteration> {
return String.format("%s-%s", getCalver().toMajorMinorBugfix(), iteration);
}
return getCalver().toString();
return getCalver().toMajorMinorBugfix();
}
if (iteration.isGAIteration()) {
@@ -104,20 +104,24 @@ public class TrainIteration implements Streamable<ModuleIteration> {
Version version = getTrain().getCalver();
if (getIteration().isServiceIteration()) {
return version.withBugfix(getIteration().getBugfixValue());
}
return version;
return version.withBugfix(getIteration().getBugfixValue());
}
public String getNextBugfixName() {
Version version = getTrain().getCalver();
if (getIteration().isServiceIteration()) {
if (getIteration().isGAIteration() || getIteration().isServiceIteration()) {
return version.withBugfix(getIteration().getBugfixValue() + 1).toMajorMinorBugfix();
}
return version.toMajorMinorBugfix();
}
public String getNextIterationName() {
Version version = getTrain().getCalver().nextMinor();
return version.toMajorMinorBugfix();
}
}