Spring Cloud Release versions are automatically added upon version setting

This commit is contained in:
Marcin Grzejszczak
2018-06-25 15:13:13 +02:00
parent 909f212713
commit 997f4bd98f
5 changed files with 47 additions and 8 deletions

View File

@@ -152,7 +152,7 @@ You will see a help screen looking like more or less like this
----
Here you can find the list of tasks in order
[updatePoms,build,commit,deploy,docs,snapshots,push,closeMilestone,createTemplates,updateSagan,updateGuides,updateDocumentation]
[release,releaseVerbose,metaRelease,postRelease,updatePoms,build,commit,deploy,docs,snapshots,push,closeMilestone,updateSagan,createTemplates,updateGuides,updateDocumentation]
Option Description
@@ -164,12 +164,13 @@ Option Description
-b, --build [String] Build the project
-c, --commit [String] Commit, tag and push the tag
-d, --deploy [String] Deploy the artifacts
-f, --full-release [Boolean] Do you want to do the full release
(default: false)
-f, --full-release [Boolean] Do you want to do the full release of a
single project? (default: false)
-g, --updateSagan [String] Updating Sagan with release info
-h, --help [String]
-i, --interactive <Boolean> Do you want to set the properties from
the command line (default: true)
the command line of a single project?
(default: true)
-m, --closeMilestone [String] Close the milestone at Github
-o, --docs [String] Publish the docs
-p, --push [String] Push the commits
@@ -182,10 +183,14 @@ Option Description
-s, --snapshots [String] Go back to snapshots and bump
originalVersion by patch
-t, --createTemplates [String] Create email / blog / tweet etc. templates
--task-names, --tn <String> Starts all release task for the given
task names
-u, --updatePoms [String] Update poms with versions from Spring
Cloud Release
--ud, --updateDocumentation [String] Updating documentation repository
--ug, --updateGuides [String] Updating Spring Guides
-x, --meta-release <Boolean> Do you want to do the meta release?
(default: false)
Examples of usage:

View File

@@ -98,9 +98,10 @@ class SCReleasePomParser {
Versions springCloudVersions() {
Model model = pom(this.dependenciesPomPath);
String buildArtifact = model.getParent().getArtifactId();
log.debug("[{}] artifact id is equal to [{}]", SpringCloudConstants.CLOUD_DEPENDENCIES_ARTIFACT_ID, buildArtifact);
if (!SpringCloudConstants.CLOUD_DEPENDENCIES_ARTIFACT_ID.equals(buildArtifact)) {
throw new IllegalStateException("The pom doesn't have a [" + SpringCloudConstants.CLOUD_DEPENDENCIES_ARTIFACT_ID + "] artifact id");
log.debug("[{}] artifact id is equal to [{}]", SpringCloudConstants.CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID, buildArtifact);
if (!SpringCloudConstants.CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID.equals(buildArtifact)) {
throw new IllegalStateException("The pom doesn't have a [" + SpringCloudConstants.CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID
+ "] artifact id");
}
String buildVersion = model.getParent().getVersion();
log.debug("Spring Cloud Build version is equal to [{}]", buildVersion);

View File

@@ -21,11 +21,14 @@ package org.springframework.cloud.release.internal.pom;
*/
final class SpringCloudConstants {
static final String SPRING_BOOT = "spring-boot";
static final String CLOUD_DEPENDENCIES_ARTIFACT_ID = "spring-cloud-dependencies";
static final String BOOT_STARTER_ARTIFACT_ID = "spring-boot-starter";
static final String BOOT_STARTER_PARENT_ARTIFACT_ID = BOOT_STARTER_ARTIFACT_ID + "-parent";
static final String BOOT_DEPENDENCIES_ARTIFACT_ID = "spring-boot-dependencies";
static final String CLOUD_DEPENDENCIES_ARTIFACT_ID = "spring-cloud-dependencies-parent";
static final String CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID = "spring-cloud-dependencies-parent";
static final String BUILD_ARTIFACT_ID = "spring-cloud-build";
static final String SPRING_CLOUD_RELEASE = "spring-cloud-release";
static final String SPRING_CLOUD = "spring-cloud";
private SpringCloudConstants() {
throw new IllegalStateException("Don't instantiate a utility class");

View File

@@ -23,7 +23,10 @@ import java.util.stream.Collectors;
import static org.springframework.cloud.release.internal.pom.SpringCloudConstants.BOOT_DEPENDENCIES_ARTIFACT_ID;
import static org.springframework.cloud.release.internal.pom.SpringCloudConstants.BOOT_STARTER_PARENT_ARTIFACT_ID;
import static org.springframework.cloud.release.internal.pom.SpringCloudConstants.BUILD_ARTIFACT_ID;
import static org.springframework.cloud.release.internal.pom.SpringCloudConstants.CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID;
import static org.springframework.cloud.release.internal.pom.SpringCloudConstants.CLOUD_DEPENDENCIES_ARTIFACT_ID;
import static org.springframework.cloud.release.internal.pom.SpringCloudConstants.SPRING_CLOUD;
import static org.springframework.cloud.release.internal.pom.SpringCloudConstants.SPRING_CLOUD_RELEASE;
/**
* Represents versions taken out from Spring Cloud Release pom
@@ -49,6 +52,7 @@ class Versions {
Versions(String scBuildVersion, Set<Project> projects) {
this.scBuildVersion = scBuildVersion;
this.projects.add(new Project(BUILD_ARTIFACT_ID, scBuildVersion));
this.projects.add(new Project(CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID, scBuildVersion));
this.projects.add(new Project(CLOUD_DEPENDENCIES_ARTIFACT_ID, scBuildVersion));
this.projects.addAll(projects);
}
@@ -61,6 +65,7 @@ class Versions {
this.projects.add(new Project(BOOT_DEPENDENCIES_ARTIFACT_ID, bootVersion));
this.projects.add(new Project(BUILD_ARTIFACT_ID, scBuildVersion));
this.projects.add(new Project(CLOUD_DEPENDENCIES_ARTIFACT_ID, scBuildVersion));
this.projects.add(new Project(CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID, scBuildVersion));
this.projects.addAll(projects);
}
@@ -129,12 +134,22 @@ class Versions {
break;
case BUILD_ARTIFACT_ID:
case CLOUD_DEPENDENCIES_ARTIFACT_ID:
case CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID:
this.scBuildVersion = version;
remove(BUILD_ARTIFACT_ID);
remove(CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID);
remove(CLOUD_DEPENDENCIES_ARTIFACT_ID);
this.projects.add(new Project(BUILD_ARTIFACT_ID, version));
this.projects.add(new Project(CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID, version));
this.projects.add(new Project(CLOUD_DEPENDENCIES_ARTIFACT_ID, version));
break;
case SPRING_CLOUD_RELEASE:
case SPRING_CLOUD:
remove(SPRING_CLOUD_RELEASE);
remove(SPRING_CLOUD);
this.projects.add(new Project(SPRING_CLOUD_RELEASE, version));
this.projects.add(new Project(SPRING_CLOUD, version));
break;
default:
remove(projectName);
this.projects.add(new Project(projectName, version));

View File

@@ -108,11 +108,26 @@ public class VersionsTests {
then(versions.versionForProject("spring-cloud-build")).isEqualTo("3.0.0");
then(versions.versionForProject("spring-cloud-dependencies-parent")).isEqualTo("3.0.0");
then(versions.versionForProject("spring-cloud-dependencies")).isEqualTo("3.0.0");
versions = mixedVersions().setVersion("spring-cloud-dependencies-parent", "3.0.0");
then(versions.versionForProject("spring-cloud-build")).isEqualTo("3.0.0");
then(versions.versionForProject("spring-cloud-dependencies-parent")).isEqualTo("3.0.0");
then(versions.versionForProject("spring-cloud-dependencies")).isEqualTo("3.0.0");
}
@Test
public void should_update_projects_for_spring_cloud_release() {
Versions versions = mixedVersions().setVersion("spring-cloud", "3.0.0");
then(versions.versionForProject("spring-cloud")).isEqualTo("3.0.0");
then(versions.versionForProject("spring-cloud-release")).isEqualTo("3.0.0");
versions = mixedVersions().setVersion("spring-cloud-release", "3.0.0");
then(versions.versionForProject("spring-cloud")).isEqualTo("3.0.0");
then(versions.versionForProject("spring-cloud-release")).isEqualTo("3.0.0");
}
@Test