Skip to content

Commit

Permalink
Add release type attribute for Antora documentation generation
Browse files Browse the repository at this point in the history
Fixes gh-41993
  • Loading branch information
scottfrederick committed Aug 21, 2024
1 parent e08a66f commit 459d899
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public Map<String, String> get() {
Map<String, String> attributes = new LinkedHashMap<>();
addGitHubAttributes(attributes);
addVersionAttributes(attributes);
addUrlArtifactRepository(attributes);
addArtifactAttributes(attributes);
addUrlJava(attributes);
addUrlLibraryLinkAttributes(attributes);
addPropertyAttributes(attributes);
Expand Down Expand Up @@ -139,8 +139,9 @@ private void addDependencyVersion(Map<String, String> attributes, String name, S
attributes.put("version-" + name, version);
}

private void addUrlArtifactRepository(Map<String, String> attributes) {
private void addArtifactAttributes(Map<String, String> attributes) {
attributes.put("url-artifact-repository", this.artifactRelease.getDownloadRepo());
attributes.put("artifact-release-type", this.artifactRelease.getType());
}

private void addUrlJava(Map<String, String> attributes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,27 @@ void urlArtifactRepositoryWhenSnapshot() {
assertThat(attributes.get()).containsEntry("url-artifact-repository", "https://repo.spring.io/snapshot");
}

@Test
void artifactReleaseTypeWhenRelease() {
AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3", true, null,
mockDependencyVersions(), null);
assertThat(attributes.get()).containsEntry("artifact-release-type", "release");
}

@Test
void artifactReleaseTypeWhenMilestone() {
AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3-M1", true, null,
mockDependencyVersions(), null);
assertThat(attributes.get()).containsEntry("artifact-release-type", "milestone");
}

@Test
void artifactReleaseTypeWhenSnapshot() {
AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3-SNAPSHOT", true, null,
mockDependencyVersions(), null);
assertThat(attributes.get()).containsEntry("artifact-release-type", "snapshot");
}

@Test
void urlLinksFromLibrary() {
Map<String, Function<LibraryVersion, String>> links = new LinkedHashMap<>();
Expand Down

0 comments on commit 459d899

Please sign in to comment.