1
- import java.time.Year
2
-
3
1
import org.asciidoctor.gradle.jvm.AsciidoctorTask
4
2
3
+ import java.time.Year
4
+
5
5
apply plugin : ' org.asciidoctor.jvm.convert'
6
6
7
7
ext {
@@ -22,21 +22,21 @@ rootProject.subprojects { subproject ->
22
22
// Aggregated JavaDoc
23
23
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24
24
25
- final File javadocDir = mkdir( new File ( ( File ) project. buildDir, ' javadocs' ) )
25
+ final File javadocDir = mkdir( project. layout . buildDirectory . dir( " javadocs" ) )
26
26
27
27
/**
28
28
* Builds the JavaDocs aggregated (unified) across all the sub-projects
29
29
*/
30
- task aggregateJavadocs ( type : Javadoc , group : ' Documentation ' ) {
31
- description = ' Builds the aggregated (unified) JavaDocs across all sub-projects'
30
+ def aggregateJavadocsTask = tasks . register( ' aggregateJavadocs ' , Javadoc ) {
31
+ description = ' Builds the aggregated (unified) JavaDocs across all sub-projects'
32
32
33
33
final int inceptionYear = 2020
34
- final int currentYear = Year . now(). getValue()
34
+ final int currentYear = Year . now(). getValue()
35
35
36
- // exclude any generated sources and internal packages
37
- exclude( ' **/generated-src/**' )
36
+ // exclude any generated sources and internal packages
37
+ exclude( ' **/generated-src/**' )
38
38
exclude( ' **/src/main/generated/**' )
39
- exclude( ' **/internal/**' )
39
+ exclude( ' **/internal/**' )
40
40
exclude( ' **/impl/**' )
41
41
42
42
// apply standard config
@@ -63,8 +63,10 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
63
63
options. addStringOption( ' Xdoclint:none' , ' -quiet' )
64
64
65
65
if ( gradle. ext. javaToolchainEnabled ) {
66
- options. setJFlags( getProperty( ' toolchain.javadoc.jvmargs' ). toString().
67
- split( ' ' ). toList(). findAll( { ! it. isEmpty() } ) )
66
+ options. setJFlags(
67
+ getProperty( ' toolchain.javadoc.jvmargs' ). toString().
68
+ split( ' ' ). toList(). findAll( { ! it. isEmpty() } )
69
+ )
68
70
}
69
71
}
70
72
@@ -75,18 +77,18 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
75
77
}
76
78
}
77
79
78
- // process each project, building up:
79
- // 1) appropriate sources
80
- // 2) classpath
81
- parent. subprojects. each { Project subProject ->
82
- // skip certain sub-projects
83
- if ( ! project. projectsToSkipWhenAggregatingJavadocs. contains( subProject. name ) ) {
80
+ // process each project, building up:
81
+ // 1) appropriate sources
82
+ // 2) classpath
83
+ parent. subprojects. each { Project subProject ->
84
+ // skip certain sub-projects
85
+ if ( ! project. projectsToSkipWhenAggregatingJavadocs. contains( subProject. name ) ) {
84
86
// we only care about the main SourceSet...
85
87
source subProject. sourceSets. main. java
86
88
87
89
classpath + = subProject. sourceSets. main. output + subProject. sourceSets. main. compileClasspath
88
90
}
89
- }
91
+ }
90
92
}
91
93
92
94
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -98,22 +100,22 @@ asciidoctor {
98
100
enabled = false
99
101
}
100
102
101
- task renderReferenceDocumentation ( type : AsciidoctorTask , group : ' Documentation ' ) {
102
- description = ' Renders the Reference Documentation in HTML format using Asciidoctor.'
103
- sourceDir = file( ' src/main/asciidoc/reference' )
104
- sources {
105
- include ' index.adoc'
106
- }
103
+ def renderReferenceDocumentationTask = tasks . register( ' renderReferenceDocumentation ' , AsciidoctorTask ) {
104
+ description = ' Renders the Reference Documentation in HTML format using Asciidoctor.'
105
+ sourceDir = file( ' src/main/asciidoc/reference' )
106
+ sources {
107
+ include ' index.adoc'
108
+ }
107
109
108
110
resources {
109
- from(sourceDir) {
111
+ from( sourceDir ) {
110
112
include ' images/**'
111
113
include ' css/**'
112
114
}
113
115
}
114
116
115
- outputDir = new File ( " $b uildDir / asciidoc/reference/html_single" )
116
- options logDocuments : true
117
+ outputDir = project . layout . buildDirectory . dir( " asciidoc/reference/html_single" ) . get() . asFile
118
+ options logDocuments : true
117
119
attributes icons : ' font' ,
118
120
' source-highlighter' : ' rouge' ,
119
121
experimental : true ,
@@ -128,11 +130,12 @@ task renderReferenceDocumentation(type: AsciidoctorTask, group: 'Documentation')
128
130
// All
129
131
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130
132
131
- task assembleDocumentation (dependsOn : [aggregateJavadocs, renderReferenceDocumentation]) {
133
+ def assembleDocumentationTask = tasks. register( ' assembleDocumentation' ) {
134
+ dependsOn aggregateJavadocsTask, renderReferenceDocumentationTask
132
135
group ' Documentation'
133
136
description ' Grouping task for performing all documentation building tasks'
134
137
135
138
logger. lifecycle " Documentation groupId: '" + project. group + " ', version: '" + project. version + " '"
136
139
}
137
140
138
- assemble. dependsOn assembleDocumentation
141
+ assemble. dependsOn assembleDocumentationTask
0 commit comments