Skip to content

Commit fdd5d00

Browse files
committed
Merge branch '3.3.x'
2 parents f47ff31 + 28faf12 commit fdd5d00

File tree

6 files changed

+34
-4
lines changed

6 files changed

+34
-4
lines changed

Diff for: buildSrc/src/main/java/org/springframework/boot/build/antora/GenerateAntoraPlaybook.java

+16
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.io.UncheckedIOException;
2424
import java.nio.file.Files;
2525
import java.nio.file.Path;
26+
import java.util.ArrayList;
2627
import java.util.Collections;
2728
import java.util.LinkedHashMap;
2829
import java.util.LinkedHashSet;
@@ -70,6 +71,10 @@ public abstract class GenerateAntoraPlaybook extends DefaultTask {
7071
@Optional
7172
public abstract MapProperty<String, String> getAlwaysInclude();
7273

74+
@Input
75+
@Optional
76+
public abstract Property<Boolean> getExcludeJavadocExtension();
77+
7378
public GenerateAntoraPlaybook() {
7479
setGroup("Documentation");
7580
setDescription("Generates an Antora playbook.yml file for local use");
@@ -94,9 +99,20 @@ final Map<String, Object> getData() throws IOException {
9499
addExtensions(data);
95100
addSources(data);
96101
addDir(data);
102+
filterJavadocExtension(data);
97103
return data;
98104
}
99105

106+
@SuppressWarnings("unchecked")
107+
private void filterJavadocExtension(Map<String, Object> data) {
108+
if (getExcludeJavadocExtension().getOrElse(Boolean.FALSE)) {
109+
Map<String, Object> asciidoc = (Map<String, Object>) data.get("asciidoc");
110+
List<String> extensions = new ArrayList<>((List<String>) asciidoc.get("extensions"));
111+
extensions.remove("@springio/asciidoctor-extensions/javadoc-extension");
112+
asciidoc.put("extensions", extensions);
113+
}
114+
}
115+
100116
@SuppressWarnings("unchecked")
101117
private Map<String, Object> loadPlaybookTemplate() throws IOException {
102118
try (InputStream resource = getClass().getResourceAsStream("antora-playbook-template.yml")) {

Diff for: buildSrc/src/test/java/org/springframework/boot/build/antora/GenerateAntoraPlaybookTests.java

+12
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ void writePlaybookGeneratesExpectedContent() throws Exception {
5454
assertThat(actual.replace('\\', '/')).isEqualToNormalizingNewlines(expected.replace('\\', '/'));
5555
}
5656

57+
@Test
58+
void writePlaybookWhenHasJavadocExcludeGeneratesExpectedContent() throws Exception {
59+
writePlaybookYml((task) -> {
60+
task.getXrefStubs().addAll("appendix:.*", "api:.*", "reference:.*");
61+
task.getAlwaysInclude().set(Map.of("name", "test", "classifier", "local-aggregate-content"));
62+
task.getExcludeJavadocExtension().set(true);
63+
});
64+
String actual = Files.readString(this.temp.toPath()
65+
.resolve("rootproject/project/build/generated/docs/antora-playbook/antora-playbook.yml"));
66+
assertThat(actual).doesNotContain("javadoc-extension");
67+
}
68+
5769
private void writePlaybookYml(ThrowingConsumer<GenerateAntoraPlaybook> customizer) throws Exception {
5870
File rootProjectDir = new File(this.temp, "rootproject").getCanonicalFile();
5971
rootProjectDir.mkdirs();

Diff for: spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def antoraGradlePluginCatalogContent = tasks.register("antoraGradlePluginCatalog
127127

128128
tasks.named("generateAntoraPlaybook") {
129129
xrefStubs = ["appendix:.*", "api:.*", "reference:.*"]
130+
excludeJavadocExtension = true
130131
alwaysInclude = [name: "gradle-plugin", classifier: "local-aggregate-content"]
131132
dependsOn antoraGradlePluginLocalAggregateContent
132133
}

Diff for: spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/packaging-oci-image.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ The following table summarizes the available properties and their default values
133133

134134
| `imageName`
135135
| `--imageName`
136-
| xref:api:java/org/springframework/boot/buildpack/platform/docker/type/ImageReference.html#of-java.lang.String-[Image name] for the generated image.
136+
| javadoc:org.springframework.boot.buildpack.platform.docker.type.ImageReference#of-java.lang.String-[Image name] for the generated image.
137137
| `docker.io/library/${project.name}:${project.version}`
138138

139139
| `pullPolicy`
140140
| `--pullPolicy`
141-
| xref:api:java/org/springframework/boot/buildpack/platform/build/PullPolicy.html[Policy] used to determine when to pull the builder and run images from the registry.
141+
| javadoc:org.springframework.boot.buildpack.platform.build.PullPolicy[Policy] used to determine when to pull the builder and run images from the registry.
142142
Acceptable values are `ALWAYS`, `NEVER`, and `IF_NOT_PRESENT`.
143143
| `ALWAYS`
144144

Diff for: spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def antoraMavenPluginCatalogContent = tasks.register("antoraMavenPluginCatalogCo
167167

168168
tasks.named("generateAntoraPlaybook") {
169169
xrefStubs = ["appendix:.*", "api:.*", "reference:.*", "how-to:.*"]
170+
excludeJavadocExtension = true
170171
alwaysInclude = [name: "maven-plugin", classifier: "local-aggregate-content"]
171172
dependsOn antoraMavenPluginLocalAggregateContent
172173
}

Diff for: spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ The following table summarizes the available parameters and their default values
149149

150150
| `name` +
151151
(`spring-boot.build-image.imageName`)
152-
| xref:api:java/org/springframework/boot/buildpack/platform/docker/type/ImageReference.html#of-java.lang.String-[Image name] for the generated image.
152+
| javadoc:org.springframework.boot.buildpack.platform.docker.type.ImageName#of-java.lang.String-[Image name] for the generated image.
153153
| `docker.io/library/` +
154154
`${project.artifactId}:${project.version}`
155155

156156
| `pullPolicy` +
157157
(`spring-boot.build-image.pullPolicy`)
158-
| xref:api:java/org/springframework/boot/buildpack/platform/build/PullPolicy.html[Policy] used to determine when to pull the builder and run images from the registry.
158+
| javadoc:org.springframework.boot.buildpack.platform.build.PullPolicy[Policy] used to determine when to pull the builder and run images from the registry.
159159
Acceptable values are `ALWAYS`, `NEVER`, and `IF_NOT_PRESENT`.
160160
| `ALWAYS`
161161

0 commit comments

Comments
 (0)