#144 - Add support for Spring Data BOM.

This commit is contained in:
Mark Paluch
2020-05-18 15:29:30 +02:00
parent 8dfaa014e2
commit 7c999f9698
5 changed files with 36 additions and 37 deletions

View File

@@ -79,13 +79,14 @@ class MavenBuildSystem implements BuildSystem {
if (updater.isBuildProject()) {
updateBom(information, "bom/pom.xml", BUILD);
if (information.isBomInBuildProject()) {
updateBom(information, "bom/pom.xml", BUILD);
}
updateParentPom(information);
} else if (updater.isBomProject()) {
updateBom(information, "pom.xml", BOM);
updateBom(information, "bom/pom.xml", BOM);
} else {
execute(workspace.getFile(POM_XML, updater.getProject()), pom -> {
@@ -219,10 +220,22 @@ class MavenBuildSystem implements BuildSystem {
CommandLine goals = CommandLine.of(goal("versions:set"), goal("versions:commit"));
mvn.execute(project, goals.and(arg("newVersion").withValue(information.getProjectVersionToSet(project)))
.and(arg("generateBackupPoms").withValue("false")));
if (BOM.equals(project)) {
if (BUILD.equals(project)) {
mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainVersion())) //
.and(arg("generateBackupPoms").withValue("false")));
mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainVersion())) //
.and(arg("generateBackupPoms").withValue("false")) //
.and(arg("processAllModules").withValue("true")) //
.and(Argument.of("-pl").withValue("bom")));
} else {
mvn.execute(project, goals.and(arg("newVersion").withValue(information.getProjectVersionToSet(project)))
.and(arg("generateBackupPoms").withValue("false")));
}
if (BUILD.equals(project) && !module.getTrain().usesCalver()) {
mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainNameVersion())) //
.and(arg("generateBackupPoms").withValue("false")) //
@@ -232,16 +245,6 @@ class MavenBuildSystem implements BuildSystem {
mvn.execute(project, CommandLine.of(Goal.INSTALL));
}
if (BOM.equals(project)) {
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-bom")));
mvn.execute(project, CommandLine.of(Goal.INSTALL));
}
return module;
}

View File

@@ -40,7 +40,7 @@ public class UpdateInformation {
/**
* Returns the {@link ArtifactVersion} to be set for the given {@link Project}.
*
*
* @param dependency must not be {@literal null}.
* @return will never be {@literal null}.
*/
@@ -64,7 +64,7 @@ public class UpdateInformation {
/**
* Returns the {@link ArtifactVersion} to be set for the parent reference.
*
*
* @return will never be {@literal null}.
*/
public ArtifactVersion getParentVersionToSet() {
@@ -85,7 +85,7 @@ public class UpdateInformation {
/**
* Returns the {@link Repository} to use (milestone or release).
*
*
* @return will never be {@literal null}.
*/
public Repository getRepository() {
@@ -94,7 +94,7 @@ public class UpdateInformation {
/**
* Returns the version {@link String} to be used to describe the release train.
*
*
* @return will never be {@literal null}.
*/
public String getReleaseTrainNameVersion() {
@@ -119,7 +119,7 @@ public class UpdateInformation {
/**
* Returns the version {@link String} to be used to describe the release train.
*
*
* @return will never be {@literal null}.
*/
public String getReleaseTrainVersion() {
@@ -141,4 +141,8 @@ public class UpdateInformation {
throw new IllegalStateException("Unexpected phase detected " + phase + " detected!");
}
public boolean isBomInBuildProject() {
return !train.getTrain().usesCalver();
}
}

View File

@@ -63,11 +63,11 @@ public class ReleaseTrains {
new Module(MONGO_DB, "3.0"), //
new Module(JDBC, "2.0"), //
new Module(R2DBC, "1.1")) //
.filterModules(module -> !module.getProject().equals(GEMFIRE))
.withIterations(new Train.Iterations(M1, M2, M3, M4, RC1, RC2, GA, SR1, SR2, SR3, SR4, SR5));
.filterModules(module -> !module.getProject().equals(GEMFIRE));
OCKHAM = NEUMANN.next("Ockham", Transition.MINOR).withCalver("2020.0.0")
.withIterations(new Train.Iterations(M1, M2, M3, M4, RC1, RC2, GA, SR1, SR2, SR3, SR4, SR5));
OCKHAM = NEUMANN.next("Ockham", Transition.MINOR, //
new Module(BOM, "2020.0.0") //
).withCalver("2020.0.0").withIterations(new Train.Iterations(M1, M2, RC1, RC2, GA, SR1, SR2, SR3, SR4, SR5));
// Trains

View File

@@ -78,7 +78,7 @@ public class TrainIteration implements Streamable<ModuleIteration> {
if (getTrain().usesCalver()) {
if (getIteration().isMilestone() || getIteration().isReleaseCandidate()) {
return String.format("%s-%s", getCalver(), iteration);
return String.format("%s-%s", getCalver().toMajorMinorBugfix(), iteration);
}
return getCalver().toString();

View File

@@ -43,18 +43,10 @@ class DeploymentOperationsIntegrationTests extends AbstractIntegrationTests {
@Test
void testname() {
Train train = ReleaseTrains.HOPPER;
ModuleIteration buildModule = train.getModuleIteration(Projects.BUILD, Iteration.M1);
Train train = ReleaseTrains.OCKHAM;
ModuleIteration buildModule = train.getModuleIteration(Projects.BOM, Iteration.M1);
git.update(train);
build.prepareVersion(buildModule, Phase.PREPARE);
DeploymentInformation information = build.buildAndDeployRelease(buildModule);
try {
deployment.promote(information);
} finally {
client.deleteArtifacts(information);
}
}
}