Adds commercial suffix when cloning projects for commercial releases

This commit is contained in:
Ryan Baxter
2024-02-22 13:23:33 -05:00
parent eb0819de94
commit b4e2feefe7
2 changed files with 16 additions and 2 deletions

View File

@@ -78,6 +78,8 @@ public class ReleaserProperties implements Serializable {
private Versions versions = new Versions();
private boolean commercial = false;
/**
* Project name to its version - overrides all versions retrieved from a release train
* repository like Spring Cloud Release.
@@ -198,12 +200,20 @@ public class ReleaserProperties implements Serializable {
this.versions = versions;
}
public boolean isCommercial() {
return commercial;
}
public void setCommercial(boolean commercial) {
this.commercial = commercial;
}
@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 + ", template="
+ this.template + ", versions=" + this.versions + '}';
+ this.template + ", versions=" + this.versions + ", commercial=" + this.commercial + '}';
}
public ReleaserProperties copy() {

View File

@@ -136,6 +136,10 @@ public class ProjectGitHandler implements Closeable {
return clonedProject;
}
private String addCommercialSuffix(String projectName) {
return this.properties.isCommercial() ? projectName + "-commercial" : projectName;
}
/**
* For meta-release. Works with fixed versions only
* @param projectName - name of the project to clone
@@ -144,7 +148,7 @@ public class ProjectGitHandler implements Closeable {
public File cloneProjectFromOrg(String projectName) {
String orgUrl = this.properties.getMetaRelease().getGitOrgUrl();
String fullUrl = orgUrl.endsWith("/") ? (orgUrl + projectName)
: (orgUrl + "/" + projectName + suffixNonHttpRepo(orgUrl));
: (orgUrl + "/" + addCommercialSuffix(projectName) + suffixNonHttpRepo(orgUrl));
if (log.isDebugEnabled()) {
log.debug("Full url of the project is [{}]", fullUrl);
}