Merge branch '3.3.x'
This commit is contained in:
commit
fdd5d007f5
|
@ -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 {
|
|||
@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 {
|
|||
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")) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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`
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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…
Reference in New Issue