Browse Source

Merge branch '3.3.x'

pull/41646/head
Phillip Webb 2 years ago
parent
commit
fdd5d007f5
  1. 16
      buildSrc/src/main/java/org/springframework/boot/build/antora/GenerateAntoraPlaybook.java
  2. 12
      buildSrc/src/test/java/org/springframework/boot/build/antora/GenerateAntoraPlaybookTests.java
  3. 1
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle
  4. 4
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/packaging-oci-image.adoc
  5. 1
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/build.gradle
  6. 4
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc

16
buildSrc/src/main/java/org/springframework/boot/build/antora/GenerateAntoraPlaybook.java

@ -23,6 +23,7 @@ import java.io.InputStream; @@ -23,6 +23,7 @@ import java.io.InputStream;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@ -70,6 +71,10 @@ public abstract class GenerateAntoraPlaybook extends DefaultTask { @@ -70,6 +71,10 @@ public abstract class GenerateAntoraPlaybook extends DefaultTask {
@Optional
public abstract MapProperty<String, String> getAlwaysInclude();
@Input
@Optional
public abstract Property<Boolean> getExcludeJavadocExtension();
public GenerateAntoraPlaybook() {
setGroup("Documentation");
setDescription("Generates an Antora playbook.yml file for local use");
@ -94,9 +99,20 @@ public abstract class GenerateAntoraPlaybook extends DefaultTask { @@ -94,9 +99,20 @@ public abstract class GenerateAntoraPlaybook extends DefaultTask {
addExtensions(data);
addSources(data);
addDir(data);
filterJavadocExtension(data);
return data;
}
@SuppressWarnings("unchecked")
private void filterJavadocExtension(Map<String, Object> data) {
if (getExcludeJavadocExtension().getOrElse(Boolean.FALSE)) {
Map<String, Object> asciidoc = (Map<String, Object>) data.get("asciidoc");
List<String> extensions = new ArrayList<>((List<String>) asciidoc.get("extensions"));
extensions.remove("@springio/asciidoctor-extensions/javadoc-extension");
asciidoc.put("extensions", extensions);
}
}
@SuppressWarnings("unchecked")
private Map<String, Object> loadPlaybookTemplate() throws IOException {
try (InputStream resource = getClass().getResourceAsStream("antora-playbook-template.yml")) {

12
buildSrc/src/test/java/org/springframework/boot/build/antora/GenerateAntoraPlaybookTests.java

@ -54,6 +54,18 @@ class GenerateAntoraPlaybookTests { @@ -54,6 +54,18 @@ class GenerateAntoraPlaybookTests {
assertThat(actual.replace('\\', '/')).isEqualToNormalizingNewlines(expected.replace('\\', '/'));
}
@Test
void writePlaybookWhenHasJavadocExcludeGeneratesExpectedContent() throws Exception {
writePlaybookYml((task) -> {
task.getXrefStubs().addAll("appendix:.*", "api:.*", "reference:.*");
task.getAlwaysInclude().set(Map.of("name", "test", "classifier", "local-aggregate-content"));
task.getExcludeJavadocExtension().set(true);
});
String actual = Files.readString(this.temp.toPath()
.resolve("rootproject/project/build/generated/docs/antora-playbook/antora-playbook.yml"));
assertThat(actual).doesNotContain("javadoc-extension");
}
private void writePlaybookYml(ThrowingConsumer<GenerateAntoraPlaybook> customizer) throws Exception {
File rootProjectDir = new File(this.temp, "rootproject").getCanonicalFile();
rootProjectDir.mkdirs();

1
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle

@ -127,6 +127,7 @@ def antoraGradlePluginCatalogContent = tasks.register("antoraGradlePluginCatalog @@ -127,6 +127,7 @@ def antoraGradlePluginCatalogContent = tasks.register("antoraGradlePluginCatalog
tasks.named("generateAntoraPlaybook") {
xrefStubs = ["appendix:.*", "api:.*", "reference:.*"]
excludeJavadocExtension = true
alwaysInclude = [name: "gradle-plugin", classifier: "local-aggregate-content"]
dependsOn antoraGradlePluginLocalAggregateContent
}

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

@ -133,12 +133,12 @@ The following table summarizes the available properties and their default values @@ -133,12 +133,12 @@ The following table summarizes the available properties and their default values
| `imageName`
| `--imageName`
| xref:api:java/org/springframework/boot/buildpack/platform/docker/type/ImageReference.html#of-java.lang.String-[Image name] for the generated image.
| javadoc:org.springframework.boot.buildpack.platform.docker.type.ImageReference#of-java.lang.String-[Image name] for the generated image.
| `docker.io/library/${project.name}:${project.version}`
| `pullPolicy`
| `--pullPolicy`
| 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.
| javadoc:org.springframework.boot.buildpack.platform.build.PullPolicy[Policy] used to determine when to pull the builder and run images from the registry.
Acceptable values are `ALWAYS`, `NEVER`, and `IF_NOT_PRESENT`.
| `ALWAYS`

1
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/build.gradle

@ -167,6 +167,7 @@ def antoraMavenPluginCatalogContent = tasks.register("antoraMavenPluginCatalogCo @@ -167,6 +167,7 @@ def antoraMavenPluginCatalogContent = tasks.register("antoraMavenPluginCatalogCo
tasks.named("generateAntoraPlaybook") {
xrefStubs = ["appendix:.*", "api:.*", "reference:.*", "how-to:.*"]
excludeJavadocExtension = true
alwaysInclude = [name: "maven-plugin", classifier: "local-aggregate-content"]
dependsOn antoraMavenPluginLocalAggregateContent
}

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

@ -149,13 +149,13 @@ The following table summarizes the available parameters and their default values @@ -149,13 +149,13 @@ The following table summarizes the available parameters and their default values
| `name` +
(`spring-boot.build-image.imageName`)
| xref:api:java/org/springframework/boot/buildpack/platform/docker/type/ImageReference.html#of-java.lang.String-[Image name] for the generated image.
| javadoc:org.springframework.boot.buildpack.platform.docker.type.ImageName#of-java.lang.String-[Image name] for the generated image.
| `docker.io/library/` +
`${project.artifactId}:${project.version}`
| `pullPolicy` +
(`spring-boot.build-image.pullPolicy`)
| 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.
| javadoc:org.springframework.boot.buildpack.platform.build.PullPolicy[Policy] used to determine when to pull the builder and run images from the registry.
Acceptable values are `ALWAYS`, `NEVER`, and `IF_NOT_PRESENT`.
| `ALWAYS`

Loading…
Cancel
Save