#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();
|
Project project = iteration.getProject();
|
||||||
Repository repository = new Repository(iteration.getIteration());
|
Repository repository = new Repository(iteration.getIteration());
|
||||||
ArtifactVersion commonsVersion = updateInformation.getIteration().getModuleVersion(COMMONS);
|
ArtifactVersion commonsVersion = updateInformation.getTrain().getModuleVersion(COMMONS);
|
||||||
ArtifactVersion buildVersion = updateInformation.getIteration().getModuleVersion(BUILD);
|
ArtifactVersion buildVersion = updateInformation.getTrain().getModuleVersion(BUILD);
|
||||||
|
|
||||||
workspace.processFile(GRADLE_PROPERTIES, project, (line, number) -> {
|
workspace.processFile(GRADLE_PROPERTIES, project, (line, number) -> {
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class MavenBuildSystem implements BuildSystem {
|
|||||||
|
|
||||||
private void updateBom(UpdateInformation updateInformation) {
|
private void updateBom(UpdateInformation updateInformation) {
|
||||||
|
|
||||||
TrainIteration iteration = updateInformation.getIteration();
|
TrainIteration iteration = updateInformation.getTrain();
|
||||||
|
|
||||||
logger.log(BUILD, "Updating BOM pom.xml…");
|
logger.log(BUILD, "Updating BOM pom.xml…");
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import lombok.NonNull;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import org.springframework.data.release.model.ArtifactVersion;
|
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.Phase;
|
||||||
import org.springframework.data.release.model.Project;
|
import org.springframework.data.release.model.Project;
|
||||||
import org.springframework.data.release.model.TrainIteration;
|
import org.springframework.data.release.model.TrainIteration;
|
||||||
@@ -35,7 +36,7 @@ import org.springframework.util.Assert;
|
|||||||
@RequiredArgsConstructor(staticName = "of")
|
@RequiredArgsConstructor(staticName = "of")
|
||||||
public class UpdateInformation {
|
public class UpdateInformation {
|
||||||
|
|
||||||
private final @NonNull @Getter TrainIteration iteration;
|
private final @NonNull @Getter TrainIteration train;
|
||||||
private final @NonNull @Getter Phase phase;
|
private final @NonNull @Getter Phase phase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,7 +49,7 @@ public class UpdateInformation {
|
|||||||
|
|
||||||
Assert.notNull(dependency, "Project must not be null!");
|
Assert.notNull(dependency, "Project must not be null!");
|
||||||
|
|
||||||
ArtifactVersion dependencyVersion = iteration.getModuleVersion(dependency);
|
ArtifactVersion dependencyVersion = train.getModuleVersion(dependency);
|
||||||
|
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case PREPARE:
|
case PREPARE:
|
||||||
@@ -69,7 +70,7 @@ public class UpdateInformation {
|
|||||||
*/
|
*/
|
||||||
public ArtifactVersion getParentVersionToSet() {
|
public ArtifactVersion getParentVersionToSet() {
|
||||||
|
|
||||||
ArtifactVersion version = iteration.getModuleVersion(BUILD);
|
ArtifactVersion version = train.getModuleVersion(BUILD);
|
||||||
|
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case PREPARE:
|
case PREPARE:
|
||||||
@@ -89,7 +90,7 @@ public class UpdateInformation {
|
|||||||
* @return will never be {@literal null}.
|
* @return will never be {@literal null}.
|
||||||
*/
|
*/
|
||||||
public Repository getRepository() {
|
public Repository getRepository() {
|
||||||
return new Repository(iteration.getIteration());
|
return new Repository(train.getIteration());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,12 +100,15 @@ public class UpdateInformation {
|
|||||||
*/
|
*/
|
||||||
public String getReleaseTrainVersion() {
|
public String getReleaseTrainVersion() {
|
||||||
|
|
||||||
|
String version = train.getTrain().getName();
|
||||||
|
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case PREPARE:
|
case PREPARE:
|
||||||
return iteration.toVersionString();
|
Iteration iteration = train.getIteration();
|
||||||
|
return String.format("%s-%s", version, iteration.isGAIteration() ? "RELEASE" : iteration.getName());
|
||||||
case CLEANUP:
|
case CLEANUP:
|
||||||
case MAINTENANCE:
|
case MAINTENANCE:
|
||||||
return iteration.getTrain().getName().concat("-BUILD-SNAPSHOT");
|
return version.concat("-BUILD-SNAPSHOT");
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalStateException("Unexpected phase detected " + phase + " detected!");
|
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());
|
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)
|
* (non-Javadoc)
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
|
|||||||
@@ -70,4 +70,18 @@ public class UpdateInformationUnitTests {
|
|||||||
updateInformation = UpdateInformation.of(hopperM1, Phase.CLEANUP);
|
updateInformation = UpdateInformation.of(hopperM1, Phase.CLEANUP);
|
||||||
assertThat(updateInformation.getProjectVersionToSet(Projects.JPA).toString(), is("1.10.0.BUILD-SNAPSHOT"));
|
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