#22 - UpdateInformation now produces correct version for release train BOM on GA releases.
This commit is contained in:
@@ -77,8 +77,8 @@ class GradleBuildSystem implements BuildSystem {
|
||||
|
||||
Project project = iteration.getProject();
|
||||
Repository repository = new Repository(iteration.getIteration());
|
||||
ArtifactVersion commonsVersion = updateInformation.getIteration().getModuleVersion(COMMONS);
|
||||
ArtifactVersion buildVersion = updateInformation.getIteration().getModuleVersion(BUILD);
|
||||
ArtifactVersion commonsVersion = updateInformation.getTrain().getModuleVersion(COMMONS);
|
||||
ArtifactVersion buildVersion = updateInformation.getTrain().getModuleVersion(BUILD);
|
||||
|
||||
workspace.processFile(GRADLE_PROPERTIES, project, (line, number) -> {
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class MavenBuildSystem implements BuildSystem {
|
||||
|
||||
private void updateBom(UpdateInformation updateInformation) {
|
||||
|
||||
TrainIteration iteration = updateInformation.getIteration();
|
||||
TrainIteration iteration = updateInformation.getTrain();
|
||||
|
||||
logger.log(BUILD, "Updating BOM pom.xml…");
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.Phase;
|
||||
import org.springframework.data.release.model.Project;
|
||||
import org.springframework.data.release.model.TrainIteration;
|
||||
@@ -35,7 +36,7 @@ import org.springframework.util.Assert;
|
||||
@RequiredArgsConstructor(staticName = "of")
|
||||
public class UpdateInformation {
|
||||
|
||||
private final @NonNull @Getter TrainIteration iteration;
|
||||
private final @NonNull @Getter TrainIteration train;
|
||||
private final @NonNull @Getter Phase phase;
|
||||
|
||||
/**
|
||||
@@ -48,7 +49,7 @@ public class UpdateInformation {
|
||||
|
||||
Assert.notNull(dependency, "Project must not be null!");
|
||||
|
||||
ArtifactVersion dependencyVersion = iteration.getModuleVersion(dependency);
|
||||
ArtifactVersion dependencyVersion = train.getModuleVersion(dependency);
|
||||
|
||||
switch (phase) {
|
||||
case PREPARE:
|
||||
@@ -69,7 +70,7 @@ public class UpdateInformation {
|
||||
*/
|
||||
public ArtifactVersion getParentVersionToSet() {
|
||||
|
||||
ArtifactVersion version = iteration.getModuleVersion(BUILD);
|
||||
ArtifactVersion version = train.getModuleVersion(BUILD);
|
||||
|
||||
switch (phase) {
|
||||
case PREPARE:
|
||||
@@ -89,7 +90,7 @@ public class UpdateInformation {
|
||||
* @return will never be {@literal null}.
|
||||
*/
|
||||
public Repository getRepository() {
|
||||
return new Repository(iteration.getIteration());
|
||||
return new Repository(train.getIteration());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,12 +100,15 @@ public class UpdateInformation {
|
||||
*/
|
||||
public String getReleaseTrainVersion() {
|
||||
|
||||
String version = train.getTrain().getName();
|
||||
|
||||
switch (phase) {
|
||||
case PREPARE:
|
||||
return iteration.toVersionString();
|
||||
Iteration iteration = train.getIteration();
|
||||
return String.format("%s-%s", version, iteration.isGAIteration() ? "RELEASE" : iteration.getName());
|
||||
case CLEANUP:
|
||||
case MAINTENANCE:
|
||||
return iteration.getTrain().getName().concat("-BUILD-SNAPSHOT");
|
||||
return version.concat("-BUILD-SNAPSHOT");
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Unexpected phase detected " + phase + " detected!");
|
||||
|
||||
@@ -66,15 +66,6 @@ public class TrainIteration implements Streamable<ModuleIteration> {
|
||||
return train.getModuleIteration(previousIteration, module.getProject().getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the version string to be used for the train iteration.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String toVersionString() {
|
||||
return toString().replace(' ', '-');
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
|
||||
@@ -70,4 +70,18 @@ public class UpdateInformationUnitTests {
|
||||
updateInformation = UpdateInformation.of(hopperM1, Phase.CLEANUP);
|
||||
assertThat(updateInformation.getProjectVersionToSet(Projects.JPA).toString(), is("1.10.0.BUILD-SNAPSHOT"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #22
|
||||
*/
|
||||
@Test
|
||||
public void returnsCorrectReleaseTrainVersions() {
|
||||
|
||||
TrainIteration hopperGa = new TrainIteration(ReleaseTrains.HOPPER, Iteration.GA);
|
||||
TrainIteration hopperSr1 = new TrainIteration(ReleaseTrains.HOPPER, Iteration.SR1);
|
||||
|
||||
assertThat(UpdateInformation.of(hopperGa, Phase.PREPARE).getReleaseTrainVersion(), is("Hopper-RELEASE"));
|
||||
assertThat(UpdateInformation.of(hopperM1, Phase.PREPARE).getReleaseTrainVersion(), is("Hopper-M1"));
|
||||
assertThat(UpdateInformation.of(hopperSr1, Phase.PREPARE).getReleaseTrainVersion(), is("Hopper-SR1"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user