Merge branch '3.3.x'

Closes gh-41994
This commit is contained in:
Scott Frederick 2024-08-21 18:04:28 -05:00
commit ba87aca05e
2 changed files with 24 additions and 2 deletions

View File

@ -77,7 +77,7 @@ public class AntoraAsciidocAttributes {
Map<String, String> attributes = new LinkedHashMap<>();
addGitHubAttributes(attributes);
addVersionAttributes(attributes);
addUrlArtifactRepository(attributes);
addArtifactAttributes(attributes);
addUrlJava(attributes);
addUrlLibraryLinkAttributes(attributes);
addPropertyAttributes(attributes);
@ -139,8 +139,9 @@ public class AntoraAsciidocAttributes {
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) {

View File

@ -112,6 +112,27 @@ class AntoraAsciidocAttributesTests {
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<>();