Skip to content

Commit c7fbec7

Browse files
committed
fix
1 parent cf02cff commit c7fbec7

File tree

2 files changed

+40
-37
lines changed

2 files changed

+40
-37
lines changed

documentation/build.gradle

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import java.time.Year
2-
31
import org.asciidoctor.gradle.jvm.AsciidoctorTask
42

3+
import java.time.Year
4+
55
apply plugin: 'org.asciidoctor.jvm.convert'
66

77
ext {
@@ -22,21 +22,21 @@ rootProject.subprojects { subproject ->
2222
// Aggregated JavaDoc
2323
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2424

25-
final File javadocDir = mkdir( new File( (File) project.buildDir, 'javadocs' ) )
25+
final File javadocDir = mkdir( project.layout.buildDirectory.dir( "javadocs" ) )
2626

2727
/**
2828
* Builds the JavaDocs aggregated (unified) across all the sub-projects
2929
*/
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'
3232

3333
final int inceptionYear = 2020
34-
final int currentYear = Year.now().getValue()
34+
final int currentYear = Year.now().getValue()
3535

36-
// exclude any generated sources and internal packages
37-
exclude( '**/generated-src/**' )
36+
// exclude any generated sources and internal packages
37+
exclude( '**/generated-src/**' )
3838
exclude( '**/src/main/generated/**' )
39-
exclude( '**/internal/**' )
39+
exclude( '**/internal/**' )
4040
exclude( '**/impl/**' )
4141

4242
// apply standard config
@@ -63,8 +63,10 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
6363
options.addStringOption( 'Xdoclint:none', '-quiet' )
6464

6565
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+
)
6870
}
6971
}
7072

@@ -75,18 +77,18 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
7577
}
7678
}
7779

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 ) ) {
8486
// we only care about the main SourceSet...
8587
source subProject.sourceSets.main.java
8688

8789
classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath
8890
}
89-
}
91+
}
9092
}
9193

9294
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -98,22 +100,22 @@ asciidoctor {
98100
enabled = false
99101
}
100102

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+
}
107109

108110
resources {
109-
from(sourceDir) {
111+
from( sourceDir ) {
110112
include 'images/**'
111113
include 'css/**'
112114
}
113115
}
114116

115-
outputDir = new File("$buildDir/asciidoc/reference/html_single")
116-
options logDocuments: true
117+
outputDir = project.layout.buildDirectory.dir( "asciidoc/reference/html_single" ).get().asFile
118+
options logDocuments: true
117119
attributes icons: 'font',
118120
'source-highlighter': 'rouge',
119121
experimental: true,
@@ -128,11 +130,12 @@ task renderReferenceDocumentation(type: AsciidoctorTask, group: 'Documentation')
128130
// All
129131
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130132

131-
task assembleDocumentation(dependsOn: [aggregateJavadocs, renderReferenceDocumentation]) {
133+
def assembleDocumentationTask = tasks.register( 'assembleDocumentation' ) {
134+
dependsOn aggregateJavadocsTask, renderReferenceDocumentationTask
132135
group 'Documentation'
133136
description 'Grouping task for performing all documentation building tasks'
134137

135138
logger.lifecycle "Documentation groupId: '" + project.group + "', version: '" + project.version + "'"
136139
}
137140

138-
assemble.dependsOn assembleDocumentation
141+
assemble.dependsOn assembleDocumentationTask

release/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ description = 'Release module'
2828
// ./gradlew ciRelease -PreleaseVersion=x.y.z.Final -PdevelopmentVersion=x.y.z-SNAPSHOT -PgitRemote=origin -PgitBranch=main
2929

3030
// The folder containing the rendered documentation
31-
final String documentationDir = rootProject.layout.buildDirectory.dir( "documentation" )
31+
final Directory documentationDir = project(":documentation").layout.buildDirectory.get()
3232

3333
// Relative path on the static website where the documentation is located
3434
final String docWebsiteRelativePath = "reactive/documentation/${projectVersion.family}"
3535

3636
// The location of the docs when the website has been cloned
37-
final String docWebsiteReactiveFolder = project.layout.buildDirectory.dir( "docs-website/${docWebsiteRelativePath}" )
37+
final Directory docWebsiteReactiveFolder = project.layout.buildDirectory.dir( "docs-website/${docWebsiteRelativePath}" ).get()
3838

3939
/**
4040
* Assembles all documentation into the {buildDir}/documentation directory.
@@ -61,7 +61,7 @@ def cloneDocsWebsiteTask = tasks.register( 'cloneDocsWebsite', Exec ) {
6161
commandLine 'git', 'clone', docPublishRepoUri, '-b', docPublishBranch, '--sparse', '--depth', '1', 'docs-website'
6262
}
6363

64-
def sparseCheckoutDocumentationTask =tasks.register( 'sparseCheckoutDocumentation', Exec ) {
64+
def sparseCheckoutDocumentationTask = tasks.register( 'sparseCheckoutDocumentation', Exec ) {
6565
dependsOn cloneDocsWebsiteTask
6666
workingDir project.layout.buildDirectory.dir( "docs-website" )
6767
commandLine 'git', 'sparse-checkout', 'set', docWebsiteRelativePath
@@ -80,18 +80,18 @@ def updateDocumentationTask = tasks.register( 'updateDocumentation' ) {
8080

8181
doLast {
8282
// delete the folders in case some files have been removed
83-
delete "${docWebsiteReactiveFolder}/javadocs", "${docWebsiteReactiveFolder}/reference"
83+
delete docWebsiteReactiveFolder.dir("javadocs"), docWebsiteReactiveFolder.dir("reference")
8484

8585
// Aggregated JavaDoc
8686
copy {
87-
from "${documentationDir}/javadocs"
88-
into "${docWebsiteReactiveFolder}/javadocs"
87+
from documentationDir.dir("javadocs")
88+
into docWebsiteReactiveFolder.dir("javadocs")
8989
}
9090

9191
// Reference Documentation
9292
copy {
93-
from "${documentationDir}/asciidoc/reference/html_single"
94-
into "${docWebsiteReactiveFolder}/reference/html_single"
93+
from documentationDir.dir("asciidoc/reference/html_single")
94+
into docWebsiteReactiveFolder.dir("reference/html_single")
9595
}
9696
}
9797
}

0 commit comments

Comments
 (0)