1
1
plugins {
2
2
id " java-library"
3
- id " org.asciidoctor.jvm.convert "
3
+ id " org.antora "
4
4
id " org.springframework.boot.auto-configuration"
5
5
id " org.springframework.boot.configuration-properties"
6
6
id " org.springframework.boot.conventions"
@@ -11,13 +11,10 @@ plugins {
11
11
description = " Spring Boot Actuator AutoConfigure"
12
12
13
13
configurations {
14
- documentation
14
+ antoraContent
15
15
}
16
16
17
17
dependencies {
18
- asciidoctorExtensions(" org.springframework.restdocs:spring-restdocs-asciidoctor" )
19
- asciidoctorExtensions(" io.spring.asciidoctor:spring-asciidoctor-extensions-section-ids" )
20
-
21
18
api(project(" :spring-boot-project:spring-boot-actuator" ))
22
19
api(project(" :spring-boot-project:spring-boot" ))
23
20
api(project(" :spring-boot-project:spring-boot-autoconfigure" ))
@@ -195,38 +192,6 @@ dependencies {
195
192
}
196
193
}
197
194
198
- task dependencyVersions (type : org.springframework.boot.build.constraints.ExtractVersionConstraints ) {
199
- enforcedPlatform(" :spring-boot-project:spring-boot-dependencies" )
200
- }
201
-
202
- asciidoctor {
203
- sources {
204
- include " index.adoc"
205
- }
206
- }
207
-
208
- task asciidoctorPdf (type : org.asciidoctor.gradle.jvm.AsciidoctorTask ) {
209
- sources {
210
- include " index.adoc"
211
- }
212
- }
213
-
214
- task zip (type : Zip ) {
215
- dependsOn asciidoctor, asciidoctorPdf
216
- duplicatesStrategy " fail"
217
- from(asciidoctorPdf. outputDir) {
218
- into " pdf"
219
- rename { " spring-boot-actuator-web-api.pdf" }
220
- }
221
- from(asciidoctor. outputDir) {
222
- into " htmlsingle"
223
- }
224
- }
225
-
226
- artifacts {
227
- documentation zip
228
- }
229
-
230
195
tasks. named(" test" ) {
231
196
jvmArgs + = " --add-opens=java.base/java.net=ALL-UNNAMED"
232
197
filter {
@@ -235,28 +200,46 @@ tasks.named("test") {
235
200
}
236
201
237
202
def documentationTest = tasks. register(" documentationTest" , Test ) {
203
+ jvmArgs + = " --add-opens=java.base/java.net=ALL-UNNAMED"
238
204
filter {
239
205
includeTestsMatching(" org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation.*" )
240
206
}
241
- jvmArgs + = " --add-opens=java.base/java.net=ALL-UNNAMED"
242
207
outputs. dir(" ${ buildDir} /generated-snippets" )
243
208
predictiveSelection {
244
209
enabled = false
245
210
}
246
211
}
247
212
248
- tasks. withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask ) {
249
- dependsOn dependencyVersions
250
- doFirst {
251
- def versionConstraints = dependencyVersions. versionConstraints
252
- def toAntoraVersion = version -> {
253
- String formatted = version. split(" \\ ." ). take(2 ). join(' .' )
254
- return version. endsWith(" -SNAPSHOT" ) ? formatted + " -SNAPSHOT" : formatted
255
- }
256
- def integrationVersion = versionConstraints[" org.springframework.integration:spring-integration-core" ]
257
- String integrationDocs = String . format(" https://docs.spring.io/spring-integration/reference/%s" , toAntoraVersion(integrationVersion))
258
- attributes " spring-integration-docs" : integrationDocs
213
+ def antoraActuatorRestApiLocalAggregateContent = tasks. register(" antoraActuatorRestApiLocalAggregateContent" , Zip ) {
214
+ destinationDirectory = layout. buildDirectory. dir(' generated/docs/antora-content' )
215
+ archiveClassifier = " actuator-rest-api-local-aggregate-content"
216
+ from(tasks. getByName(" generateAntoraYml" )) {
217
+ into " modules"
259
218
}
219
+ }
220
+
221
+ def antoraActuatorRestApiAggregateContent = tasks. register(" antoraActuatorRestApiAggregateContent" , Zip ) {
260
222
dependsOn documentationTest
261
- inputs. dir(" ${ buildDir} /generated-snippets" ). withPathSensitivity(PathSensitivity . RELATIVE ). withPropertyName(" generatedSnippets" )
223
+ inputs. dir(" ${ buildDir} /generated-snippets" )
224
+ .withPathSensitivity(PathSensitivity . RELATIVE )
225
+ .withPropertyName(" generatedSnippets" )
226
+ destinationDirectory = layout. buildDirectory. dir(' generated/docs/antora-content' )
227
+ archiveClassifier = " actuator-rest-api-aggregate-content"
228
+ from(" ${ buildDir} /generated-snippets" ) {
229
+ into " modules/api/partials/rest/actuator"
230
+ }
231
+ }
232
+
233
+ tasks. named(" generateAntoraPlaybook" ) {
234
+ alwaysInclude = [name : " actuator-rest-api" , classifier : " local-aggregate-content" ]
235
+ dependsOn antoraActuatorRestApiLocalAggregateContent
236
+ }
237
+
238
+ tasks. named(" antora" ) {
239
+ inputs. files(antoraActuatorRestApiAggregateContent)
262
240
}
241
+
242
+ artifacts {
243
+ antoraContent antoraActuatorRestApiAggregateContent
244
+ }
245
+
0 commit comments