#155 - Fix calver version bump after conclude.
This commit is contained in:
@@ -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")));
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class ReleaseCommands extends TimedCommand {
|
||||
|
||||
git.prepare(iteration);
|
||||
|
||||
// build.runPreReleaseChecks(iteration);
|
||||
build.runPreReleaseChecks(iteration);
|
||||
|
||||
misc.prepareChangelogs(iteration);
|
||||
misc.updateResources(iteration);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,11 @@
|
||||
package org.springframework.data.release.build;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.assertj.core.api.Assumptions.assumeThat;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
@@ -91,6 +93,10 @@ class MavenIntegrationTests extends AbstractIntegrationTests {
|
||||
@Test
|
||||
void findsSnapshotDependencies() throws Exception {
|
||||
|
||||
Pom pom = projection.io().file(workspace.getFile("pom.xml", Projects.BUILD)).read(Pom.class);
|
||||
File file = workspace.getFile("pom.xml", Projects.BUILD);
|
||||
|
||||
assumeThat(file).exists();
|
||||
|
||||
Pom pom = projection.io().file(file).read(Pom.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.data.release.model.TrainIteration;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link UpdateInformation}.
|
||||
*
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@@ -74,6 +74,17 @@ class UpdateInformationUnitTests {
|
||||
assertThat(updateInformation.getProjectVersionToSet(Projects.JPA).toString()).isEqualTo("1.10.0.BUILD-SNAPSHOT");
|
||||
}
|
||||
|
||||
@Test // #155
|
||||
void calculatesProjectCalverVersionToSetCorrectly() {
|
||||
|
||||
TrainIteration ockhamGa = new TrainIteration(ReleaseTrains.OCKHAM, Iteration.GA);
|
||||
|
||||
assertThat(UpdateInformation.of(ockhamGa, Phase.CLEANUP).getProjectVersionToSet(Projects.BOM).toString())
|
||||
.isEqualTo("2020.1.0-SNAPSHOT");
|
||||
assertThat(UpdateInformation.of(ockhamGa, Phase.MAINTENANCE).getProjectVersionToSet(Projects.BOM).toString())
|
||||
.isEqualTo("2020.0.1-SNAPSHOT");
|
||||
}
|
||||
|
||||
@Test // #22
|
||||
void returnsCorrectReleaseTrainVersions() {
|
||||
|
||||
@@ -84,4 +95,37 @@ class UpdateInformationUnitTests {
|
||||
assertThat(UpdateInformation.of(hopperM1, Phase.PREPARE).getReleaseTrainVersion()).isEqualTo("Hopper-M1");
|
||||
assertThat(UpdateInformation.of(hopperSr1, Phase.PREPARE).getReleaseTrainVersion()).isEqualTo("Hopper-SR1");
|
||||
}
|
||||
|
||||
@Test // #155
|
||||
void returnsCorrectReleaseTrainCalverVersions() {
|
||||
|
||||
TrainIteration ockhamGa = new TrainIteration(ReleaseTrains.OCKHAM, Iteration.GA);
|
||||
TrainIteration ockhamM1 = new TrainIteration(ReleaseTrains.OCKHAM, Iteration.M1);
|
||||
TrainIteration ockhamSr1 = new TrainIteration(ReleaseTrains.OCKHAM, Iteration.SR1);
|
||||
|
||||
assertThat(UpdateInformation.of(ockhamGa, Phase.PREPARE).getReleaseTrainVersion()).isEqualTo("2020.0.0");
|
||||
assertThat(UpdateInformation.of(ockhamM1, Phase.PREPARE).getReleaseTrainVersion()).isEqualTo("2020.0.0-M1");
|
||||
assertThat(UpdateInformation.of(ockhamSr1, Phase.PREPARE).getReleaseTrainVersion()).isEqualTo("2020.0.1");
|
||||
}
|
||||
|
||||
@Test // #155
|
||||
void returnsCorrectCleanupReleaseTrainCalverVersions() {
|
||||
|
||||
TrainIteration ockhamGa = new TrainIteration(ReleaseTrains.OCKHAM, Iteration.GA);
|
||||
TrainIteration ockhamM1 = new TrainIteration(ReleaseTrains.OCKHAM, Iteration.M1);
|
||||
TrainIteration ockhamSr1 = new TrainIteration(ReleaseTrains.OCKHAM, Iteration.SR1);
|
||||
|
||||
assertThat(UpdateInformation.of(ockhamGa, Phase.CLEANUP).getReleaseTrainVersion()).isEqualTo("2020.1.0-SNAPSHOT");
|
||||
assertThat(UpdateInformation.of(ockhamM1, Phase.CLEANUP).getReleaseTrainVersion()).isEqualTo("2020.0.0-SNAPSHOT");
|
||||
assertThat(UpdateInformation.of(ockhamSr1, Phase.CLEANUP).getReleaseTrainVersion()).isEqualTo("2020.0.2-SNAPSHOT");
|
||||
}
|
||||
|
||||
@Test // #155
|
||||
void returnsCorrectMaintenanceReleaseTrainCalverVersions() {
|
||||
|
||||
TrainIteration ockhamGa = new TrainIteration(ReleaseTrains.OCKHAM, Iteration.GA);
|
||||
|
||||
assertThat(UpdateInformation.of(ockhamGa, Phase.MAINTENANCE).getReleaseTrainVersion())
|
||||
.isEqualTo("2020.0.1-SNAPSHOT");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user