Update site links.
Add links to docs.spring.vmware.com for commercial releases. See #75
This commit is contained in:
@@ -43,14 +43,11 @@ public class ChangelogGenerator {
|
||||
|
||||
private static final Pattern ghUserMentionPattern = Pattern.compile("(^|[^\\w`])(@[\\w-]+)");
|
||||
|
||||
@Getter
|
||||
private final Set<String> excludeLabels;
|
||||
@Getter private final Set<String> excludeLabels;
|
||||
|
||||
@Getter
|
||||
private final Set<String> excludeContributors;
|
||||
@Getter private final Set<String> excludeContributors;
|
||||
|
||||
@Getter
|
||||
private final String contributorsTitle;
|
||||
@Getter private final String contributorsTitle;
|
||||
|
||||
private final ChangelogSections sections;
|
||||
|
||||
@@ -66,10 +63,11 @@ public class ChangelogGenerator {
|
||||
*
|
||||
* @param issues the issues to generate the changelog for
|
||||
* @param sectionContentPostProcessor the postprocessor for a changelog section
|
||||
* @param generateLinks whether to generate links
|
||||
*/
|
||||
public String generate(List<GitHubReadIssue> issues,
|
||||
BiFunction<ChangelogSection, String, String> sectionContentPostProcessor) {
|
||||
return generateContent(issues, sectionContentPostProcessor);
|
||||
BiFunction<ChangelogSection, String, String> sectionContentPostProcessor, boolean generateLinks) {
|
||||
return generateContent(issues, sectionContentPostProcessor, generateLinks);
|
||||
}
|
||||
|
||||
private boolean isExcluded(GitHubReadIssue issue) {
|
||||
@@ -81,9 +79,9 @@ public class ChangelogGenerator {
|
||||
}
|
||||
|
||||
private String generateContent(List<GitHubReadIssue> issues,
|
||||
BiFunction<ChangelogSection, String, String> sectionContentPostProcessor) {
|
||||
BiFunction<ChangelogSection, String, String> sectionContentPostProcessor, boolean generateLinks) {
|
||||
StringBuilder content = new StringBuilder();
|
||||
addSectionContent(content, this.sections.collate(issues), sectionContentPostProcessor);
|
||||
addSectionContent(content, this.sections.collate(issues), sectionContentPostProcessor, generateLinks);
|
||||
Set<GitHubUser> contributors = getContributors(issues);
|
||||
if (!contributors.isEmpty()) {
|
||||
addContributorsContent(content, contributors);
|
||||
@@ -92,7 +90,7 @@ public class ChangelogGenerator {
|
||||
}
|
||||
|
||||
private void addSectionContent(StringBuilder result, Map<ChangelogSection, List<GitHubReadIssue>> sectionIssues,
|
||||
BiFunction<ChangelogSection, String, String> sectionContentPostProcessor) {
|
||||
BiFunction<ChangelogSection, String, String> sectionContentPostProcessor, boolean generateLinks) {
|
||||
|
||||
sectionIssues.forEach((section, issues) -> {
|
||||
|
||||
@@ -102,16 +100,16 @@ public class ChangelogGenerator {
|
||||
|
||||
content.append((content.length() != 0) ? String.format("%n") : "");
|
||||
content.append("## ").append(section).append(String.format("%n%n"));
|
||||
issues.stream().map(this::getFormattedIssue).forEach(content::append);
|
||||
issues.stream().map(issue -> getFormattedIssue(issue, generateLinks)).forEach(content::append);
|
||||
|
||||
result.append(sectionContentPostProcessor.apply(section, content.toString()));
|
||||
});
|
||||
}
|
||||
|
||||
private String getFormattedIssue(GitHubReadIssue issue) {
|
||||
private String getFormattedIssue(GitHubReadIssue issue, boolean generateLinks) {
|
||||
String title = issue.getTitle();
|
||||
title = ghUserMentionPattern.matcher(title).replaceAll("$1`$2`");
|
||||
return String.format("- %s %s%n", title, getLinkToIssue(issue));
|
||||
return String.format("- %s %s%n", title, generateLinks ? getLinkToIssue(issue) : issue.getId());
|
||||
}
|
||||
|
||||
private String getLinkToIssue(GitHubIssue issue) {
|
||||
|
||||
@@ -36,7 +36,16 @@ import org.springframework.data.release.issues.IssueTracker;
|
||||
import org.springframework.data.release.issues.Ticket;
|
||||
import org.springframework.data.release.issues.Tickets;
|
||||
import org.springframework.data.release.issues.github.GitHubWorkflows.GitHubWorkflow;
|
||||
import org.springframework.data.release.model.*;
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.DocumentationMetadata;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Project;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.SupportedProject;
|
||||
import org.springframework.data.release.model.Tracker;
|
||||
import org.springframework.data.release.model.Train;
|
||||
import org.springframework.data.release.model.TrainIteration;
|
||||
import org.springframework.data.release.utils.Logger;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -571,7 +580,8 @@ public class GitHub extends GitHubSupport implements IssueTracker {
|
||||
ChangelogGenerator generator = new ChangelogGenerator();
|
||||
generator.getExcludeContributors().addAll(properties.getTeam());
|
||||
|
||||
String releaseBody = generator.generate(gitHubIssues, (changelogSection, s) -> s);
|
||||
boolean generateLinks = !iteration.isCommercial();
|
||||
String releaseBody = generator.generate(gitHubIssues, (changelogSection, s) -> s, generateLinks);
|
||||
String documentationLinks = getDocumentationLinks(module, documentation);
|
||||
|
||||
if (module.getProject() == Projects.BOM || module.getProject() == Projects.BUILD) {
|
||||
|
||||
@@ -30,18 +30,23 @@ import org.springframework.data.release.model.Train.DocumentationFormat;
|
||||
public class DocumentationMetadata {
|
||||
|
||||
private static String DOCS_BASE = "https://docs.spring.io/spring-data/%s/docs/%s";
|
||||
|
||||
private static String COMMERICIAL_DOCS_BASE = "https://docs.spring.vmware.com/spring-data/%s/docs/%s";
|
||||
private static String ANTORA_BASE = "https://docs.spring.io/spring-data/%s/reference/";
|
||||
private static String COMMERCIAL_ANTORA_BASE = "https://docs.spring.vmware.com/spring-data/%s/reference/";
|
||||
|
||||
private static String DOCS = DOCS_BASE.concat("/reference/html/");
|
||||
private static String JAVADOC = DOCS_BASE.concat("/api/");
|
||||
|
||||
private static String COMMERICIAL_DOCS = COMMERICIAL_DOCS_BASE.concat("/reference/html/");
|
||||
private static String COMMERICIAL_JAVADOC = COMMERICIAL_DOCS_BASE.concat("/api/");
|
||||
|
||||
DocumentationFormat documentationFormat;
|
||||
Project project;
|
||||
SupportedProject project;
|
||||
ArtifactVersion version;
|
||||
boolean isCurrent;
|
||||
|
||||
public static DocumentationMetadata of(ModuleIteration module, ArtifactVersion version, boolean isCurrent) {
|
||||
return of(module.getTrain().getDocumentationFormat(), module.getProject(), version, isCurrent);
|
||||
return of(module.getTrain().getDocumentationFormat(), module.getSupportedProject(), version, isCurrent);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,11 +60,14 @@ public class DocumentationMetadata {
|
||||
return "";
|
||||
}
|
||||
|
||||
String format = project.isCommercial() ? COMMERICIAL_JAVADOC : JAVADOC;
|
||||
|
||||
if (Projects.BUILD.equals(project)) { // Report Commons Docs for Spring Data Build
|
||||
return String.format(JAVADOC, getProjectName(Projects.COMMONS), getDocumentationVersion());
|
||||
return String.format(format, getProjectName(Projects.COMMONS), getDocumentationVersion());
|
||||
}
|
||||
|
||||
return String.format(JAVADOC, project == Projects.R2DBC ? "r2dbc" : getProjectName(project),
|
||||
return String.format(format,
|
||||
project.getProject() == Projects.R2DBC ? "r2dbc" : getProjectName(project.getProject()),
|
||||
getDocumentationVersion());
|
||||
}
|
||||
|
||||
@@ -89,7 +97,7 @@ public class DocumentationMetadata {
|
||||
*/
|
||||
public String getReferenceDocUrl() {
|
||||
|
||||
Project project = this.project;
|
||||
Project project = this.project.getProject();
|
||||
|
||||
if (Projects.BUILD.equals(project)) { // Report Commons Docs for Spring Data Build
|
||||
project = Projects.COMMONS;
|
||||
@@ -101,10 +109,12 @@ public class DocumentationMetadata {
|
||||
return "";
|
||||
}
|
||||
|
||||
return String.format(DOCS, getProjectName(project), getDocumentationVersion());
|
||||
String format = this.project.isCommercial() ? COMMERICIAL_DOCS : DOCS;
|
||||
return String.format(format, getProjectName(project), getDocumentationVersion());
|
||||
}
|
||||
|
||||
return String.format(ANTORA_BASE, getProjectName(project));
|
||||
String format = this.project.isCommercial() ? COMMERCIAL_ANTORA_BASE : ANTORA_BASE;
|
||||
return String.format(format, getProjectName(project));
|
||||
}
|
||||
|
||||
public String getVersionOrTrainName(Train train) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.data.release.model.Project;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.SupportStatus;
|
||||
import org.springframework.data.release.utils.Logger;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestOperations;
|
||||
@@ -139,7 +140,7 @@ class DefaultProjectClient implements ProjectService {
|
||||
|
||||
private static Stream<ProjectMetadata> getVersionsToWrite(MaintainedVersions versions) {
|
||||
return versions.stream() //
|
||||
.map(it -> new ProjectMetadata(it, versions));
|
||||
.map(it -> new ProjectMetadata(it, SupportStatus.OSS, versions));
|
||||
}
|
||||
|
||||
private boolean requiresDeleteVersions(Project project, List<String> versionsToRetain,
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.data.release.model.Project;
|
||||
import org.springframework.data.release.model.SupportStatus;
|
||||
import org.springframework.data.release.utils.Logger;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
@@ -49,7 +50,7 @@ class DummyProjectClient implements ProjectService {
|
||||
logger.log(project, "Updating released version on Sagan to %s!", versions);
|
||||
|
||||
List<ProjectMetadata> payload = versions.stream() //
|
||||
.map(it -> new ProjectMetadata(it, versions)) //
|
||||
.map(it -> new ProjectMetadata(it, SupportStatus.OSS, versions)) //
|
||||
.collect(Collectors.toList());
|
||||
|
||||
try {
|
||||
@@ -67,7 +68,8 @@ class DummyProjectClient implements ProjectService {
|
||||
public String getProjectMetadata(MaintainedVersion version) {
|
||||
|
||||
try {
|
||||
return mapper.writeValueAsString(new ProjectMetadata(version, MaintainedVersions.of(Collections.emptyList())));
|
||||
return mapper.writeValueAsString(
|
||||
new ProjectMetadata(version, SupportStatus.OSS, MaintainedVersions.of(Collections.emptyList())));
|
||||
} catch (JsonProcessingException o_O) {
|
||||
throw new RuntimeException(o_O);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
package org.springframework.data.release.projectservice;
|
||||
|
||||
import org.springframework.data.release.model.DocumentationMetadata;
|
||||
import org.springframework.data.release.model.SupportStatus;
|
||||
import org.springframework.data.release.model.SupportedProject;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
@@ -39,15 +41,17 @@ class ProjectMetadata {
|
||||
* Creates a new {@link ProjectMetadata} instance from the given {@link MaintainedVersion}.
|
||||
*
|
||||
* @param version must not be {@literal null}.
|
||||
* @param supportStatus must not be {@literal null}.
|
||||
* @param versions must not be {@literal null}.
|
||||
*/
|
||||
public ProjectMetadata(MaintainedVersion version, MaintainedVersions versions) {
|
||||
public ProjectMetadata(MaintainedVersion version, SupportStatus supportStatus, MaintainedVersions versions) {
|
||||
|
||||
Assert.notNull(version, "MaintainedVersion must not be null!");
|
||||
|
||||
this.version = version;
|
||||
this.versions = versions;
|
||||
this.documentation = DocumentationMetadata.of(version.getTrain().getDocumentationFormat(), version.getProject(),
|
||||
this.documentation = DocumentationMetadata.of(version.getTrain().getDocumentationFormat(),
|
||||
SupportedProject.of(version.getProject(), supportStatus),
|
||||
version.getVersion(), versions.isMainVersion(version));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user