Fixed
This commit is contained in:
@@ -427,7 +427,7 @@ public class ReleaserProperties implements Serializable {
|
||||
}
|
||||
|
||||
public String getReleaseTrainDocsUrl() {
|
||||
return releaseTrainDocsUrl;
|
||||
return this.releaseTrainDocsUrl;
|
||||
}
|
||||
|
||||
public void setReleaseTrainDocsUrl(String releaseTrainDocsUrl) {
|
||||
@@ -435,7 +435,7 @@ public class ReleaserProperties implements Serializable {
|
||||
}
|
||||
|
||||
public String getReleaseTrainDocsBranch() {
|
||||
return releaseTrainDocsBranch;
|
||||
return this.releaseTrainDocsBranch;
|
||||
}
|
||||
|
||||
public void setReleaseTrainDocsBranch(String releaseTrainDocsBranch) {
|
||||
@@ -443,7 +443,7 @@ public class ReleaserProperties implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isUpdateReleaseTrainDocs() {
|
||||
return updateReleaseTrainDocs;
|
||||
return this.updateReleaseTrainDocs;
|
||||
}
|
||||
|
||||
public void setUpdateReleaseTrainDocs(boolean updateReleaseTrainDocs) {
|
||||
@@ -646,7 +646,7 @@ public class ReleaserProperties implements Serializable {
|
||||
}
|
||||
|
||||
public String getDeployCommand() {
|
||||
return deployCommand;
|
||||
return this.deployCommand;
|
||||
}
|
||||
|
||||
public void setDeployCommand(String deployCommand) {
|
||||
|
||||
@@ -38,7 +38,7 @@ class ProjectDocumentationUpdater implements ReleaserPropertiesAware {
|
||||
* @return {@link File cloned temporary directory} - {@code null} if wrong version is used
|
||||
*/
|
||||
File updateDocsRepo(ProjectVersion currentProject, String springCloudReleaseBranch) {
|
||||
if (!properties.getGit().isUpdateDocumentationRepo()) {
|
||||
if (!this.properties.getGit().isUpdateDocumentationRepo()) {
|
||||
log.info("Will not update documentation repository, since the switch to do so "
|
||||
+ "is off. Set [releaser.git.update-documentation-repo] to [true] to change that");
|
||||
return null;
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
package org.springframework.cloud.release.internal.git;
|
||||
|
||||
import com.jcabi.github.Coordinates;
|
||||
import com.jcabi.github.Github;
|
||||
import com.jcabi.github.Milestone;
|
||||
import com.jcabi.github.RtGithub;
|
||||
import com.jcabi.http.wire.RetryWire;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.jcabi.github.Coordinates;
|
||||
import com.jcabi.github.Github;
|
||||
import com.jcabi.github.Milestone;
|
||||
import com.jcabi.github.RtGithub;
|
||||
import com.jcabi.http.wire.RetryWire;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.cloud.release.internal.ReleaserProperties;
|
||||
import org.springframework.cloud.release.internal.pom.ProjectVersion;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -30,7 +29,8 @@ class GithubMilestones {
|
||||
|
||||
private final Github github;
|
||||
private final ReleaserProperties properties;
|
||||
static final Map<ProjectVersion, String> CACHE = new ConcurrentHashMap<>();
|
||||
static final Map<ProjectVersion, String> MILESTONE_URL_CACHE = new ConcurrentHashMap<>();
|
||||
static final Map<ProjectVersion, Milestone.Smart> MILESTONE_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
GithubMilestones(ReleaserProperties properties) {
|
||||
this.github = new RtGithub(new RtGithub(
|
||||
@@ -49,8 +49,14 @@ class GithubMilestones {
|
||||
+ "either via the command line [--releaser.git.oauth-token=...] "
|
||||
+ "or put it as an env variable in [~/.bashrc] or "
|
||||
+ "[~/.zshrc] e.g. [export RELEASER_GIT_OAUTH_TOKEN=...]");
|
||||
Milestone.Smart foundMilestone = MILESTONE_CACHE.get(version);
|
||||
String tagVersion = version.version;
|
||||
Milestone.Smart foundMilestone = matchingMilestone(tagVersion, openMilestones(version));
|
||||
if (foundMilestone == null) {
|
||||
foundMilestone = matchingMilestone(tagVersion, openMilestones(version));
|
||||
if (foundMilestone != null) {
|
||||
MILESTONE_CACHE.put(version, foundMilestone);
|
||||
}
|
||||
}
|
||||
if (foundMilestone != null) {
|
||||
try {
|
||||
log.info("Found a matching milestone - closing it");
|
||||
@@ -94,7 +100,7 @@ class GithubMilestones {
|
||||
}
|
||||
|
||||
String milestoneUrl(ProjectVersion version) {
|
||||
String cachedUrl = CACHE.get(version);
|
||||
String cachedUrl = MILESTONE_URL_CACHE.get(version);
|
||||
if (StringUtils.hasText(cachedUrl)) {
|
||||
return cachedUrl;
|
||||
}
|
||||
@@ -118,7 +124,7 @@ class GithubMilestones {
|
||||
log.error("Exception occurred while trying to find milestone", e);
|
||||
}
|
||||
}
|
||||
CACHE.put(version, foundUrl);
|
||||
MILESTONE_URL_CACHE.put(version, foundUrl);
|
||||
return foundUrl;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public class GradleUpdater implements ReleaserPropertiesAware {
|
||||
|
||||
private boolean pathIgnored(File file) {
|
||||
String path = file.getPath();
|
||||
return assertSnapshots &&
|
||||
return this.assertSnapshots &&
|
||||
this.properties.getGradle().getIgnoredGradleRegex().stream().anyMatch(path::matches);
|
||||
}
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ class PropertyStorer {
|
||||
void setPropertyVersionIfApplicable(Project project) {
|
||||
String propertyName = propertyName(project);
|
||||
if (setPropertyVersion(propertyName, project.version)) {
|
||||
log.info("Updating property [" + propertyName + "] to version [" + project.version + "]");
|
||||
this.log.info("Updating property [" + propertyName + "] to version [" + project.version + "]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -237,6 +237,6 @@ class ProjectAndException {
|
||||
}
|
||||
|
||||
boolean hasException() {
|
||||
return ex != null;
|
||||
return this.ex != null;
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,10 @@ public class Project {
|
||||
public Boolean aggregator;
|
||||
|
||||
@Override public String toString() {
|
||||
return "Project{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", repoUrl='"
|
||||
+ repoUrl + '\'' + ", siteUrl='" + siteUrl + '\'' + ", category='"
|
||||
+ category + '\'' + ", stackOverflowTags='" + stackOverflowTags + '\''
|
||||
+ ", projectReleases=" + projectReleases + ", stackOverflowTagList="
|
||||
+ stackOverflowTagList + ", aggregator=" + aggregator + '}';
|
||||
return "Project{" + "id='" + this.id + '\'' + ", name='" + this.name + '\'' + ", repoUrl='"
|
||||
+ this.repoUrl + '\'' + ", siteUrl='" + this.siteUrl + '\'' + ", category='"
|
||||
+ this.category + '\'' + ", stackOverflowTags='" + this.stackOverflowTags + '\''
|
||||
+ ", projectReleases=" + this.projectReleases + ", stackOverflowTagList="
|
||||
+ this.stackOverflowTagList + ", aggregator=" + this.aggregator + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ public class Release {
|
||||
public boolean snapshot;
|
||||
|
||||
@Override public String toString() {
|
||||
return "Release{" + "releaseStatus='" + releaseStatus + '\'' + ", refDocUrl='"
|
||||
+ refDocUrl + '\'' + ", apiDocUrl='" + apiDocUrl + '\'' + ", groupId='"
|
||||
+ groupId + '\'' + ", artifactId='" + artifactId + '\'' + ", repository="
|
||||
+ repository + ", version='" + version + '\'' + ", current=" + current
|
||||
+ ", generalAvailability=" + generalAvailability + ", preRelease="
|
||||
+ preRelease + ", versionDisplayName='" + versionDisplayName + '\''
|
||||
+ ", snapshot=" + snapshot + '}';
|
||||
return "Release{" + "releaseStatus='" + this.releaseStatus + '\'' + ", refDocUrl='"
|
||||
+ this.refDocUrl + '\'' + ", apiDocUrl='" + this.apiDocUrl + '\'' + ", groupId='"
|
||||
+ this.groupId + '\'' + ", artifactId='" + this.artifactId + '\'' + ", repository="
|
||||
+ this.repository + ", version='" + this.version + '\'' + ", current=" + this.current
|
||||
+ ", generalAvailability=" + this.generalAvailability + ", preRelease="
|
||||
+ this.preRelease + ", versionDisplayName='" + this.versionDisplayName + '\''
|
||||
+ ", snapshot=" + this.snapshot + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ public class ReleaseUpdate {
|
||||
public Repository repository;
|
||||
|
||||
@Override public String toString() {
|
||||
return "ReleaseUpdate{" + "groupId='" + groupId + '\'' + ", artifactId='"
|
||||
+ artifactId + '\'' + ", version='" + version + '\'' + ", releaseStatus='"
|
||||
+ releaseStatus + '\'' + ", refDocUrl='" + refDocUrl + '\''
|
||||
+ ", apiDocUrl='" + apiDocUrl + '\'' + ", repository=" + repository + '}';
|
||||
return "ReleaseUpdate{" + "groupId='" + this.groupId + '\'' + ", artifactId='"
|
||||
+ this.artifactId + '\'' + ", version='" + this.version + '\'' + ", releaseStatus='"
|
||||
+ this.releaseStatus + '\'' + ", refDocUrl='" + this.refDocUrl + '\''
|
||||
+ ", apiDocUrl='" + this.apiDocUrl + '\'' + ", repository=" + this.repository + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public class Repository {
|
||||
public Boolean snapshotsEnabled;
|
||||
|
||||
@Override public String toString() {
|
||||
return "Repository{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", url='"
|
||||
+ url + '\'' + ", snapshotsEnabled=" + snapshotsEnabled + '}';
|
||||
return "Repository{" + "id='" + this.id + '\'' + ", name='" + this.name + '\'' + ", url='"
|
||||
+ this.url + '\'' + ", snapshotsEnabled=" + this.snapshotsEnabled + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,13 @@ package org.springframework.cloud.release.internal.sagan;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.cloud.release.internal.ReleaserProperties;
|
||||
import org.springframework.cloud.release.internal.pom.ProjectVersion;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@@ -26,7 +25,7 @@ public class SaganUpdater {
|
||||
}
|
||||
|
||||
public void updateSagan(String branch, ProjectVersion originalVersion, ProjectVersion version) {
|
||||
if (!releaserProperties.getSagan().isUpdateSagan()) {
|
||||
if (!this.releaserProperties.getSagan().isUpdateSagan()) {
|
||||
log.info("Will not update sagan, since the switch to do so "
|
||||
+ "is off. Set [releaser.sagan.update-sagan] to [true] to change that");
|
||||
return;
|
||||
|
||||
@@ -45,15 +45,15 @@ class Notes {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public String getClosedMilestoneUrl() {
|
||||
return closedMilestoneUrl;
|
||||
return this.closedMilestoneUrl;
|
||||
}
|
||||
|
||||
@Override public boolean equals(Object o) {
|
||||
@@ -62,16 +62,16 @@ class Notes {
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
Notes notes = (Notes) o;
|
||||
if (name != null ? !name.equals(notes.name) : notes.name != null)
|
||||
if (this.name != null ? !this.name.equals(notes.name) : notes.name != null)
|
||||
return false;
|
||||
return version != null ?
|
||||
version.equals(notes.version) :
|
||||
return this.version != null ?
|
||||
this.version.equals(notes.version) :
|
||||
notes.version == null;
|
||||
}
|
||||
|
||||
@Override public int hashCode() {
|
||||
int result = name != null ? name.hashCode() : 0;
|
||||
result = 31 * result + (version != null ? version.hashCode() : 0);
|
||||
int result = this.name != null ? this.name.hashCode() : 0;
|
||||
result = 31 * result + (this.version != null ? this.version.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.nio.file.Files;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.github.jknack.handlebars.Template;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -29,8 +28,6 @@ class ReleaseNotesTemplateGenerator {
|
||||
private final Projects projects;
|
||||
private final NotesGenerator notesGenerator;
|
||||
|
||||
static final Map<String, File> CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
ReleaseNotesTemplateGenerator(Template template, String releaseVersion,
|
||||
File blogOutput, Projects projects, ProjectGitHandler handler) {
|
||||
this.template = template;
|
||||
@@ -41,12 +38,6 @@ class ReleaseNotesTemplateGenerator {
|
||||
}
|
||||
|
||||
File releaseNotes() {
|
||||
File cached = CACHE.get(this.releaseVersion);
|
||||
if (cached != null && fileSize(cached) > 0) {
|
||||
log.info("Found an existing entry [{}] in the cache "
|
||||
+ "for version [{}] with size [{}]", cached, this.releaseVersion, fileSize(cached));
|
||||
return cached;
|
||||
}
|
||||
try {
|
||||
Map<String, Object> map = ImmutableMap.<String, Object>builder()
|
||||
.put("date", LocalDate.now().format(DateTimeFormatter.ISO_DATE))
|
||||
@@ -55,9 +46,7 @@ class ReleaseNotesTemplateGenerator {
|
||||
.build();
|
||||
String blog = this.template.apply(map);
|
||||
Files.write(this.blogOutput.toPath(), blog.getBytes());
|
||||
File output = this.blogOutput;
|
||||
CACHE.put(this.releaseVersion, output);
|
||||
return output;
|
||||
return this.blogOutput;
|
||||
}
|
||||
catch (IOException e) {
|
||||
log.warn("Exception occurred while trying to generate release notes", e);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TemplateGenerator implements ReleaserPropertiesAware {
|
||||
File blogOutput = file(this.blogOutput);
|
||||
String releaseVersion = parsedVersion(projects);
|
||||
Template template = template(BLOG_TEMPLATE);
|
||||
return new BlogTemplateGenerator(template, releaseVersion, blogOutput, projects, handler).blog();
|
||||
return new BlogTemplateGenerator(template, releaseVersion, blogOutput, projects, this.handler).blog();
|
||||
}
|
||||
|
||||
public File tweet(Projects projects) {
|
||||
|
||||
Reference in New Issue
Block a user