Skip to content

Commit 459d899

Browse files
Add release type attribute for Antora documentation generation
Fixes gh-41993
1 parent e08a66f commit 459d899

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

buildSrc/src/main/java/org/springframework/boot/build/antora/AntoraAsciidocAttributes.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public Map<String, String> get() {
7777
Map<String, String> attributes = new LinkedHashMap<>();
7878
addGitHubAttributes(attributes);
7979
addVersionAttributes(attributes);
80-
addUrlArtifactRepository(attributes);
80+
addArtifactAttributes(attributes);
8181
addUrlJava(attributes);
8282
addUrlLibraryLinkAttributes(attributes);
8383
addPropertyAttributes(attributes);
@@ -139,8 +139,9 @@ private void addDependencyVersion(Map<String, String> attributes, String name, S
139139
attributes.put("version-" + name, version);
140140
}
141141

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

146147
private void addUrlJava(Map<String, String> attributes) {

buildSrc/src/test/java/org/springframework/boot/build/antora/AntoraAsciidocAttributesTests.java

+21
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,27 @@ void urlArtifactRepositoryWhenSnapshot() {
112112
assertThat(attributes.get()).containsEntry("url-artifact-repository", "https://repo.spring.io/snapshot");
113113
}
114114

115+
@Test
116+
void artifactReleaseTypeWhenRelease() {
117+
AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3", true, null,
118+
mockDependencyVersions(), null);
119+
assertThat(attributes.get()).containsEntry("artifact-release-type", "release");
120+
}
121+
122+
@Test
123+
void artifactReleaseTypeWhenMilestone() {
124+
AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3-M1", true, null,
125+
mockDependencyVersions(), null);
126+
assertThat(attributes.get()).containsEntry("artifact-release-type", "milestone");
127+
}
128+
129+
@Test
130+
void artifactReleaseTypeWhenSnapshot() {
131+
AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3-SNAPSHOT", true, null,
132+
mockDependencyVersions(), null);
133+
assertThat(attributes.get()).containsEntry("artifact-release-type", "snapshot");
134+
}
135+
115136
@Test
116137
void urlLinksFromLibrary() {
117138
Map<String, Function<LibraryVersion, String>> links = new LinkedHashMap<>();

0 commit comments

Comments
 (0)