Fresh copy of releaser properties for each project in meta release; fixes gh-96
This commit is contained in:
@@ -235,6 +235,15 @@ public class ReleaserProperties {
|
||||
public void setFetchVersionsFromGit(boolean fetchVersionsFromGit) {
|
||||
this.fetchVersionsFromGit = fetchVersionsFromGit;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "Git{" + "springCloudReleaseGitUrl='" + this.springCloudReleaseGitUrl + '\''
|
||||
+ ", documentationUrl='" + this.documentationUrl + '\''
|
||||
+ ", documentationBranch='" + this.documentationBranch + '\''
|
||||
+ ", cloneDestinationDir='" + this.cloneDestinationDir + '\''
|
||||
+ ", fetchVersionsFromGit=" + this.fetchVersionsFromGit
|
||||
+ ", numberOfCheckedMilestones=" + this.numberOfCheckedMilestones + '}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class Pom {
|
||||
@@ -271,6 +280,10 @@ public class ReleaserProperties {
|
||||
this.ignoredPomRegex = ignoredPomRegex;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "Pom{" + "branch='" + this.branch + '\'' + ", ignoredPomRegex="
|
||||
+ this.ignoredPomRegex + '}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class Maven {
|
||||
@@ -348,6 +361,13 @@ public class ReleaserProperties {
|
||||
public void setSystemProperties(String systemProperties) {
|
||||
this.systemProperties = systemProperties;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "Maven{" + "buildCommand='" + this.buildCommand + '\'' + ", deployCommand='"
|
||||
+ this.deployCommand + '\'' + ", publishDocsCommands=" + Arrays
|
||||
.toString(this.publishDocsCommands) + ", waitTimeInMinutes="
|
||||
+ this.waitTimeInMinutes + '}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class Gradle {
|
||||
@@ -391,6 +411,11 @@ public class ReleaserProperties {
|
||||
public void setIgnoredGradleRegex(List<String> ignoredGradleRegex) {
|
||||
this.ignoredGradleRegex = ignoredGradleRegex;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "Gradle{" + "gradlePropsSubstitution=" + this.gradlePropsSubstitution
|
||||
+ ", ignoredGradleRegex=" + this.ignoredGradleRegex + '}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class Sagan {
|
||||
@@ -406,6 +431,10 @@ public class ReleaserProperties {
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "Sagan{" + "baseUrl='" + this.baseUrl + '\'' + '}';
|
||||
}
|
||||
}
|
||||
|
||||
public String getWorkingDir() {
|
||||
@@ -472,4 +501,11 @@ public class ReleaserProperties {
|
||||
public void setSagan(Sagan sagan) {
|
||||
this.sagan = sagan;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "ReleaserProperties{" + "workingDir='" + this.workingDir + '\'' + ", git=" + this.git
|
||||
+ ", pom=" + this.pom + ", maven=" + this.maven + ", gradle=" + this.gradle + ", sagan="
|
||||
+ this.sagan + ", fixedVersions=" + this.fixedVersions + ", metaRelease="
|
||||
+ this.metaRelease + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class ProjectBuilder implements ReleaserPropertiesAware {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
private static final Logger log = LoggerFactory.getLogger(ProjectBuilder.class);
|
||||
private static final String VERSION_MUSTACHE = "{{version}}";
|
||||
|
||||
private ReleaserProperties properties;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.springframework.cloud.release.internal.options;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
@@ -20,9 +20,18 @@ public class Options {
|
||||
this.metaRelease = metaRelease;
|
||||
this.fullRelease = fullRelease;
|
||||
this.interactive = interactive;
|
||||
this.taskNames = taskNames;
|
||||
this.startFrom = startFrom;
|
||||
this.range = range;
|
||||
this.taskNames = taskNames.stream()
|
||||
.map(this::removeQuotingChars).collect(
|
||||
Collectors.toList());
|
||||
this.startFrom = removeQuotingChars(startFrom);
|
||||
this.range = removeQuotingChars(range);
|
||||
}
|
||||
|
||||
private String removeQuotingChars(String string) {
|
||||
if (string.startsWith("'") && string.endsWith("'")) {
|
||||
return string.substring(1, string.length() - 1);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.YamlMapFactoryBean;
|
||||
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.boot.context.properties.source.MapConfigurationPropertySource;
|
||||
@@ -31,6 +30,7 @@ class ReleaserPropertiesUpdater {
|
||||
|
||||
void updateProperties(ReleaserProperties properties, File clonedProjectFromOrg) {
|
||||
ReleaserProperties props = updatePropertiesFromFile(properties, clonedProjectFromOrg);
|
||||
log.info("Updated properties [\n\n{}\n\n]", props);
|
||||
updateProperties(props);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ class ReleaserPropertiesUpdater {
|
||||
catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
} else {
|
||||
log.info("No config/releaser.yml found. Will NOT update the current properties");
|
||||
}
|
||||
log.info("Updating working directory to [{}]", clonedProjectFromOrg.getAbsolutePath());
|
||||
copy.setWorkingDir(clonedProjectFromOrg.getAbsolutePath());
|
||||
|
||||
@@ -58,9 +58,8 @@ public class SpringReleaser {
|
||||
if (options.metaRelease) {
|
||||
log.info("Meta Release picked. Will iterate over all projects and perform release of each one");
|
||||
this.properties.getGit().setFetchVersionsFromGit(false);
|
||||
ReleaserProperties copy = clonePropertiesForProject();
|
||||
metaReleaseProjects(options)
|
||||
.forEach(project -> processProjectForMetaRelease(copy, options, project));
|
||||
.forEach(project -> processProjectForMetaRelease(clonePropertiesForProject(), options, project));
|
||||
} else {
|
||||
log.info("Single project release picked. Will release only the current project");
|
||||
File projectFolder = projectFolder();
|
||||
@@ -70,6 +69,7 @@ public class SpringReleaser {
|
||||
}
|
||||
|
||||
private void processProjectForMetaRelease(ReleaserProperties copy, Options options, String project) {
|
||||
log.info("Original properties [\n\n{}\n\n]", copy);
|
||||
File clonedProjectFromOrg = this.releaser.clonedProjectFromOrg(project);
|
||||
updatePropertiesIfCustomConfigPresent(copy, clonedProjectFromOrg);
|
||||
log.info("Successfully cloned the project [{}] to [{}]", project, clonedProjectFromOrg);
|
||||
@@ -103,7 +103,6 @@ public class SpringReleaser {
|
||||
log.info("List of all projects to clone before filtering {}", filteredProjects);
|
||||
if (StringUtils.hasText(options.startFrom)) {
|
||||
log.info("Start from option provided [{}]", options.startFrom);
|
||||
options.startFrom = removeQuotingChars(options.startFrom);
|
||||
int projectIndex = filteredProjects.indexOf(options.startFrom);
|
||||
if (projectIndex < 0) throw new IllegalStateException("Project [" + options.startFrom + "] not found");
|
||||
if (log.isDebugEnabled()) {
|
||||
@@ -113,11 +112,7 @@ public class SpringReleaser {
|
||||
options.startFrom = "";
|
||||
enforceFullRelease(options);
|
||||
} else if (!options.taskNames.isEmpty()) {
|
||||
log.info("Task names provided provided {}", options.taskNames);
|
||||
options.taskNames = new ArrayList<>(options.taskNames)
|
||||
.stream()
|
||||
.map(this::removeQuotingChars)
|
||||
.collect(Collectors.toList());
|
||||
log.info("Task names provided {}", options.taskNames);
|
||||
filteredProjects = filteredProjects.stream()
|
||||
.filter(project -> options.taskNames.contains(project))
|
||||
.collect(Collectors.toList());
|
||||
@@ -128,13 +123,6 @@ public class SpringReleaser {
|
||||
return filteredProjects;
|
||||
}
|
||||
|
||||
private String removeQuotingChars(String string) {
|
||||
if (string.startsWith("'") && string.endsWith("'")) {
|
||||
return string.substring(1, string.length() - 1);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
protected void enforceFullRelease(Options options) {
|
||||
options.fullRelease = true;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.springframework.cloud.release.internal.spring;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -251,6 +250,19 @@ public class OptionsProcessorTests {
|
||||
then(this.third.executed).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_remove_single_quotes() throws Exception {
|
||||
Options options = interactiveOpts().fullRelease(true)
|
||||
.range("'1-2'")
|
||||
.startFrom("'c'")
|
||||
.taskNames(Arrays.asList("'a'", "'b'"))
|
||||
.options();
|
||||
|
||||
then(options.range).isEqualTo("1-2");
|
||||
then(options.startFrom).isEqualTo("c");
|
||||
then(options.taskNames).containsOnly("a", "b");
|
||||
}
|
||||
|
||||
private OptionsBuilder interactiveOpts() {
|
||||
return new OptionsBuilder();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user