@@ -556,7 +556,7 @@ public class GitHub extends GitHubSupport implements IssueTracker {
|
||||
List<GitHubReadIssue> gitHubIssues = findGitHubIssues(module, ticketIds);
|
||||
|
||||
ArtifactVersion version = ArtifactVersion.of(module);
|
||||
DocumentationMetadata documentation = DocumentationMetadata.of(module.getProject(), version);
|
||||
DocumentationMetadata documentation = DocumentationMetadata.of(module.getProject(), version, false);
|
||||
|
||||
ChangelogGenerator generator = new ChangelogGenerator();
|
||||
generator.getExcludeContributors().addAll(properties.getTeam());
|
||||
@@ -598,14 +598,18 @@ public class GitHub extends GitHubSupport implements IssueTracker {
|
||||
|
||||
private String getDocumentationLinks(ModuleIteration module, DocumentationMetadata documentation) {
|
||||
|
||||
String referenceDocUrl = documentation.getReferenceDocUrl(module.getTrain());
|
||||
String apiDocUrl = documentation.getApiDocUrl(module.getTrain());
|
||||
if (module.getProject() == Projects.BUILD || module.getProject() == Projects.BOM) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String referenceDocUrl = documentation.getReferenceDocUrl();
|
||||
String apiDocUrl = documentation.getApiDocUrl();
|
||||
|
||||
String reference = String.format("* [%s %s Reference documentation](%s)", module.getProject().getFullName(),
|
||||
documentation.getVersion(module.getTrain()), referenceDocUrl);
|
||||
module.getVersion().toString(), referenceDocUrl);
|
||||
|
||||
String apidoc = String.format("* [%s %s Javadoc](%s)", module.getProject().getFullName(),
|
||||
documentation.getVersion(module.getTrain()), apiDocUrl);
|
||||
module.getVersion().toString(), apiDocUrl);
|
||||
|
||||
return String.format("%s%n%s%n", reference, apidoc);
|
||||
}
|
||||
|
||||
@@ -33,23 +33,24 @@ public class DocumentationMetadata {
|
||||
|
||||
Project project;
|
||||
ArtifactVersion version;
|
||||
boolean isCurrent;
|
||||
|
||||
/**
|
||||
* Returns the JavaDoc URL for non-snapshot versions and not the build project.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getApiDocUrl(Train train) {
|
||||
public String getApiDocUrl() {
|
||||
|
||||
if (version.isSnapshotVersion()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (Projects.BUILD.equals(project)) { // Report Commons Docs for Spring Data Build
|
||||
return String.format(JAVADOC, Projects.COMMONS.getName().toLowerCase(Locale.US), version.toString());
|
||||
return String.format(JAVADOC, Projects.COMMONS.getName().toLowerCase(Locale.US), getDocumentationVersion());
|
||||
}
|
||||
|
||||
return String.format(JAVADOC, project.getName().toLowerCase(Locale.US), getVersion(train));
|
||||
return String.format(JAVADOC, project.getName().toLowerCase(Locale.US), getDocumentationVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,20 +58,20 @@ public class DocumentationMetadata {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getReferenceDocUrl(Train train) {
|
||||
public String getReferenceDocUrl() {
|
||||
|
||||
if (version.isSnapshotVersion()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (Projects.BUILD.equals(project)) { // Report Commons Docs for Spring Data Build
|
||||
return String.format(DOCS, Projects.COMMONS.getName().toLowerCase(Locale.US), version.toString());
|
||||
return String.format(DOCS, Projects.COMMONS.getName().toLowerCase(Locale.US), getDocumentationVersion());
|
||||
}
|
||||
|
||||
return String.format(DOCS, project.getName().toLowerCase(Locale.US), getVersion(train));
|
||||
return String.format(DOCS, project.getName().toLowerCase(Locale.US), getDocumentationVersion());
|
||||
}
|
||||
|
||||
public String getVersion(Train train) {
|
||||
public String getVersionOrTrainName(Train train) {
|
||||
|
||||
if (Projects.BUILD.equals(project)) {
|
||||
|
||||
@@ -92,4 +93,8 @@ public class DocumentationMetadata {
|
||||
return version.toString();
|
||||
}
|
||||
|
||||
public String getDocumentationVersion() {
|
||||
return isCurrent ? "current" : version.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ReleaseTrains {
|
||||
|
||||
public static final List<Train> TRAINS;
|
||||
public static final Train CODD, DIJKSTRA, EVANS, FOWLER, GOSLING, HOPPER, INGALLS, KAY, LOVELACE, MOORE, NEUMANN,
|
||||
OCKHAM, PASCAL, Q, R, TURING;
|
||||
OCKHAM, PASCAL, Q, RAJ, TURING;
|
||||
|
||||
static {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ReleaseTrains {
|
||||
.withCalver("2021.1") //
|
||||
.withIterations(new Train.Iterations(M1, M2, M3, M4, M5, RC1, RC2, GA, SR1, SR2, SR3, SR4, SR5));
|
||||
|
||||
R = Q.next("R", Transition.MINOR) //
|
||||
RAJ = Q.next("Raj", Transition.MINOR) //
|
||||
.withCalver("2022.0") //
|
||||
.withIterations(new Train.Iterations(M1, M2, M3, M4, M5, RC1, RC2, GA, SR1, SR2, SR3, SR4, SR5));
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ReleaseTrains {
|
||||
// Trains
|
||||
|
||||
TRAINS = Arrays.asList(CODD, DIJKSTRA, EVANS, FOWLER, GOSLING, HOPPER, INGALLS, KAY, LOVELACE, MOORE, NEUMANN,
|
||||
OCKHAM, PASCAL, Q, R, TURING);
|
||||
OCKHAM, PASCAL, Q, RAJ, TURING);
|
||||
}
|
||||
|
||||
private static Train codd() {
|
||||
|
||||
@@ -47,7 +47,8 @@ class ProjectMetadata {
|
||||
|
||||
this.version = version;
|
||||
this.versions = versions;
|
||||
this.documentation = DocumentationMetadata.of(version.getProject(), version.getVersion());
|
||||
this.documentation = DocumentationMetadata.of(version.getProject(), version.getVersion(),
|
||||
versions.isMainVersion(version));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +57,7 @@ class ProjectMetadata {
|
||||
* @return
|
||||
*/
|
||||
public String getReferenceDocUrl() {
|
||||
return documentation.getReferenceDocUrl(version.getTrain());
|
||||
return documentation.getReferenceDocUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +76,7 @@ class ProjectMetadata {
|
||||
* @return
|
||||
*/
|
||||
public String getApiDocUrl() {
|
||||
return documentation.getApiDocUrl(version.getTrain());
|
||||
return documentation.getApiDocUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,6 +86,6 @@ class ProjectMetadata {
|
||||
* @return
|
||||
*/
|
||||
public String getVersion() {
|
||||
return documentation.getVersion(version.getTrain());
|
||||
return documentation.getVersionOrTrainName(version.getTrain());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,22 +29,54 @@ class DocumentationMetadataUnitTests {
|
||||
@Test // gh-167
|
||||
void shouldReportCorrectDocumentationUrls() {
|
||||
|
||||
DocumentationMetadata metadata = DocumentationMetadata.of(Projects.MONGO_DB, ArtifactVersion.of("3.1.0"));
|
||||
DocumentationMetadata metadata = DocumentationMetadata.of(Projects.MONGO_DB, ArtifactVersion.of("3.1.0"), false);
|
||||
|
||||
assertThat(metadata.getApiDocUrl(ReleaseTrains.OCKHAM))
|
||||
assertThat(metadata.getApiDocUrl())
|
||||
.isEqualTo("https://docs.spring.io/spring-data/mongodb/docs/3.1.0/api/");
|
||||
assertThat(metadata.getReferenceDocUrl(ReleaseTrains.OCKHAM))
|
||||
assertThat(metadata.getReferenceDocUrl())
|
||||
.isEqualTo("https://docs.spring.io/spring-data/mongodb/docs/3.1.0/reference/html/");
|
||||
}
|
||||
|
||||
@Test // gh-197
|
||||
void shouldReportCorrectCurrentDocumentationUrls() {
|
||||
|
||||
DocumentationMetadata metadata = DocumentationMetadata.of(Projects.MONGO_DB, ArtifactVersion.of("3.1.0"), true);
|
||||
|
||||
assertThat(metadata.getApiDocUrl()).isEqualTo("https://docs.spring.io/spring-data/mongodb/docs/current/api/");
|
||||
assertThat(metadata.getReferenceDocUrl())
|
||||
.isEqualTo("https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/");
|
||||
}
|
||||
|
||||
@Test // gh-167
|
||||
void shouldReportCorrectCommonsDocumentationUrlsForBuildProject() {
|
||||
|
||||
DocumentationMetadata metadata = DocumentationMetadata.of(Projects.BUILD, ArtifactVersion.of("3.1.0"));
|
||||
DocumentationMetadata metadata = DocumentationMetadata.of(Projects.BUILD, ArtifactVersion.of("3.1.0"), false);
|
||||
|
||||
assertThat(metadata.getApiDocUrl(ReleaseTrains.OCKHAM))
|
||||
assertThat(metadata.getApiDocUrl())
|
||||
.isEqualTo("https://docs.spring.io/spring-data/commons/docs/3.1.0/api/");
|
||||
assertThat(metadata.getReferenceDocUrl(ReleaseTrains.OCKHAM))
|
||||
assertThat(metadata.getReferenceDocUrl())
|
||||
.isEqualTo("https://docs.spring.io/spring-data/commons/docs/3.1.0/reference/html/");
|
||||
}
|
||||
|
||||
@Test // gh-197
|
||||
void shouldReportCorrectCurrentCommonsDocumentationUrlsForBuildProject() {
|
||||
|
||||
DocumentationMetadata metadata = DocumentationMetadata.of(Projects.BUILD, ArtifactVersion.of("3.1.0"), true);
|
||||
|
||||
assertThat(metadata.getApiDocUrl()).isEqualTo("https://docs.spring.io/spring-data/commons/docs/current/api/");
|
||||
assertThat(metadata.getReferenceDocUrl())
|
||||
.isEqualTo("https://docs.spring.io/spring-data/commons/docs/current/reference/html/");
|
||||
}
|
||||
|
||||
@Test // gh-197
|
||||
void shouldReportVersionLabels() {
|
||||
|
||||
DocumentationMetadata metadata = DocumentationMetadata.of(Projects.BUILD, ArtifactVersion.of("3.1.0"), true);
|
||||
|
||||
assertThat(metadata.getVersionOrTrainName(ReleaseTrains.OCKHAM)).isEqualTo("2020.0.0");
|
||||
|
||||
metadata = DocumentationMetadata.of(Projects.COMMONS, ArtifactVersion.of("3.1.0"), true);
|
||||
|
||||
assertThat(metadata.getVersionOrTrainName(ReleaseTrains.OCKHAM)).isEqualTo("3.1.0");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user