|
40 | 40 | import org.gradle.api.file.FileCollection; |
41 | 41 | import org.gradle.api.logging.LogLevel; |
42 | 42 | import org.gradle.api.plugins.JavaBasePlugin; |
| 43 | +import org.gradle.api.plugins.JavaPlugin; |
| 44 | +import org.gradle.api.plugins.JavaPluginExtension; |
43 | 45 | import org.gradle.api.provider.Provider; |
44 | 46 | import org.gradle.api.tasks.Copy; |
| 47 | +import org.gradle.api.tasks.SourceSet; |
45 | 48 | import org.gradle.api.tasks.TaskContainer; |
46 | 49 | import org.gradle.api.tasks.TaskProvider; |
47 | 50 |
|
48 | 51 | import org.springframework.boot.build.antora.AntoraAsciidocAttributes; |
| 52 | +import org.springframework.boot.build.antora.CheckJavadocMacros; |
49 | 53 | import org.springframework.boot.build.antora.GenerateAntoraPlaybook; |
50 | 54 | import org.springframework.boot.build.bom.BomExtension; |
51 | 55 | import org.springframework.boot.build.bom.ResolvedBom; |
@@ -97,6 +101,27 @@ private void apply(Project project, AntoraPlugin antoraPlugin) { |
97 | 101 | (antoraTask) -> configureAntoraTask(project, antoraTask, npmInstallTask, generateAntoraPlaybookTask)); |
98 | 102 | project.getExtensions() |
99 | 103 | .configure(NodeExtension.class, (nodeExtension) -> configureNodeExtension(project, nodeExtension)); |
| 104 | + TaskProvider<CheckJavadocMacros> checkAntoraJavadocMacros = tasks.register("checkAntoraJavadocMacros", |
| 105 | + CheckJavadocMacros.class, (task) -> { |
| 106 | + task.setSource(project.files(ANTORA_SOURCE_DIR)); |
| 107 | + task.getOutputDirectory().set(project.getLayout().getBuildDirectory().dir(task.getName())); |
| 108 | + }); |
| 109 | + project.getPlugins().withType(JavaPlugin.class, (java) -> { |
| 110 | + String runtimeClasspathConfigurationName = project.getExtensions() |
| 111 | + .getByType(JavaPluginExtension.class) |
| 112 | + .getSourceSets() |
| 113 | + .getByName(SourceSet.MAIN_SOURCE_SET_NAME) |
| 114 | + .getRuntimeClasspathConfigurationName(); |
| 115 | + Configuration javadocMacros = project.getConfigurations().create("javadocMacros", (configuration) -> { |
| 116 | + configuration.extendsFrom(project.getConfigurations().getByName(runtimeClasspathConfigurationName)); |
| 117 | + configuration.setDescription( |
| 118 | + "Dependencies referenced in javadoc macros. Extends from " + runtimeClasspathConfigurationName); |
| 119 | + configuration.setCanBeResolved(true); |
| 120 | + configuration.setCanBeDeclared(true); |
| 121 | + configuration.setCanBeConsumed(false); |
| 122 | + }); |
| 123 | + checkAntoraJavadocMacros.configure((macrosTask) -> macrosTask.setClasspath(javadocMacros)); |
| 124 | + }); |
100 | 125 | } |
101 | 126 |
|
102 | 127 | private void configureGenerateAntoraPlaybookTask(Project project, |
|
0 commit comments