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
@@ -50,6 +50,8 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
50
50
use = true
51
51
options. encoding = ' UTF-8'
52
52
53
+ logger. lifecycle " ---- Aggregating javadoc with version $project . version "
54
+
53
55
def matcher = hibernateOrmVersion =~ / \d +\.\d +/
54
56
def ormMinorVersion = matcher. find() ? matcher. group() : " 5.6" ;
55
57
@@ -63,8 +65,10 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
63
65
options. addStringOption( ' Xdoclint:none' , ' -quiet' )
64
66
65
67
if ( gradle. ext. javaToolchainEnabled ) {
66
- options. setJFlags( getProperty( ' toolchain.javadoc.jvmargs' ). toString().
67
- split( ' ' ). toList(). findAll( { ! it. isEmpty() } ) )
68
+ options. setJFlags(
69
+ getProperty( ' toolchain.javadoc.jvmargs' ). toString().
70
+ split( ' ' ). toList(). findAll( { ! it. isEmpty() } )
71
+ )
68
72
}
69
73
}
70
74
@@ -75,18 +79,18 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
75
79
}
76
80
}
77
81
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 ) ) {
82
+ // process each project, building up:
83
+ // 1) appropriate sources
84
+ // 2) classpath
85
+ parent. subprojects. each { Project subProject ->
86
+ // skip certain sub-projects
87
+ if ( ! project. projectsToSkipWhenAggregatingJavadocs. contains( subProject. name ) ) {
84
88
// we only care about the main SourceSet...
85
89
source subProject. sourceSets. main. java
86
90
87
91
classpath + = subProject. sourceSets. main. output + subProject. sourceSets. main. compileClasspath
88
92
}
89
- }
93
+ }
90
94
}
91
95
92
96
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -98,41 +102,44 @@ asciidoctor {
98
102
enabled = false
99
103
}
100
104
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
- }
105
+ def renderReferenceDocumentationTask = tasks . register( ' renderReferenceDocumentation ' , AsciidoctorTask ) {
106
+ description = ' Renders the Reference Documentation in HTML format using Asciidoctor.'
107
+ sourceDir = file( ' src/main/asciidoc/reference' )
108
+ sources {
109
+ include ' index.adoc'
110
+ }
107
111
108
112
resources {
109
- from(sourceDir) {
113
+ from( sourceDir ) {
110
114
include ' images/**'
111
115
include ' css/**'
112
116
}
113
117
}
114
118
115
- outputDir = new File (" $buildDir /asciidoc/reference/html_single" )
116
- options logDocuments : true
119
+ outputDir = project. layout. buildDirectory. dir( " asciidoc/reference/html_single" ). get(). asFile
120
+ options logDocuments : true
121
+
122
+ logger. lifecycle " ---- Rendering docs with version $project . version "
123
+
117
124
attributes icons : ' font' ,
118
125
' source-highlighter' : ' rouge' ,
119
126
experimental : true ,
120
127
linkcss : true ,
121
128
majorMinorVersion : project. version. family,
122
129
fullVersion : project. version. toString(),
123
130
docinfo : ' private'
124
-
125
131
}
126
132
127
133
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128
134
// All
129
135
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130
136
131
- task assembleDocumentation (dependsOn : [aggregateJavadocs, renderReferenceDocumentation]) {
137
+ def assembleDocumentationTask = tasks. register( ' assembleDocumentation' ) {
138
+ dependsOn aggregateJavadocsTask, renderReferenceDocumentationTask
132
139
group ' Documentation'
133
140
description ' Grouping task for performing all documentation building tasks'
134
141
135
142
logger. lifecycle " Documentation groupId: '" + project. group + " ', version: '" + project. version + " '"
136
143
}
137
144
138
- assemble. dependsOn assembleDocumentation
145
+ assemble. dependsOn assembleDocumentationTask
0 commit comments