Skip to content

Commit e15a370

Browse files
committed
Optimize Dokka to process selected modules only
- Refactor Dokka configuration to apply only to modules with Kotlin sources, reducing build overhead and improving performance for modules without Kotlin code. - Remove deprecated commands
1 parent 28a391c commit e15a370

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

build.gradle

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ ext {
115115
ztZipVersion = '1.17'
116116

117117
javaProjects = subprojects - project(':spring-integration-bom')
118+
119+
// Modules that have Kotlin sources to document using dokka
120+
dokkaProjects = [
121+
'spring-integration-core'
122+
]
118123
}
119124

120125
allprojects {
@@ -188,8 +193,6 @@ configure(javaProjects) { subproject ->
188193
apply plugin: 'kotlin'
189194
apply plugin: 'kotlin-spring'
190195
apply plugin: 'io.spring.nullability'
191-
apply plugin: 'org.jetbrains.dokka'
192-
193196

194197
apply from: "${rootDir}/gradle/publish-maven.gradle"
195198

@@ -395,7 +398,25 @@ configure(javaProjects) { subproject ->
395398

396399
check.dependsOn checkClasspathForConflicts, javadoc
397400

401+
publishing {
402+
publications {
403+
mavenJava(MavenPublication) {
404+
suppressAllPomMetadataWarnings()
405+
from components.java
406+
pom.withXml {
407+
def pomDeps = asNode().dependencies.first()
408+
subproject.configurations.provided.allDependencies.each { dep ->
409+
pomDeps.'*'.find { it.artifactId.text() == dep.name }.scope.first().value = 'provided'
410+
}
411+
}
412+
}
413+
}
414+
}
415+
}
398416

417+
// Process only the modules that require kotlin docs
418+
configure(subprojects.findAll { dokkaProjects.contains(it.name) }) { subproject ->
419+
apply plugin: 'org.jetbrains.dokka'
399420
dokka {
400421
dokkaPublications.html {
401422
outputDirectory.set(file(rootProject.layout.buildDirectory.file('kdoc')))
@@ -405,31 +426,16 @@ configure(javaProjects) { subproject ->
405426
classpath.from(sourceSets['main'].runtimeClasspath)
406427
externalDocumentationLinks.register("spring-integration-api") {
407428
url.set(uri("https://docs.spring.io/spring-integration/docs/$version/api/"))
408-
packageListUrl.set(file('build/docs/javadoc/element-list').toURI())
429+
packageListUrl.set(file(rootProject.layout.buildDirectory.file('docs/javadoc/element-list')).toURI())
409430
}
410431
externalDocumentationLinks.register("reactor-core") {
411432
url.set(uri('https://projectreactor.io/docs/core/release/api/'))
412433
}
413-
externalDocumentationLinks.register("reactor-streams") {
434+
externalDocumentationLinks.register("reactive-streams") {
414435
url.set(uri('https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/'))
415436
}
416437
}
417438
}
418-
419-
publishing {
420-
publications {
421-
mavenJava(MavenPublication) {
422-
suppressAllPomMetadataWarnings()
423-
from components.java
424-
pom.withXml {
425-
def pomDeps = asNode().dependencies.first()
426-
subproject.configurations.provided.allDependencies.each { dep ->
427-
pomDeps.'*'.find { it.artifactId.text() == dep.name }.scope.first().value = 'provided'
428-
}
429-
}
430-
}
431-
}
432-
}
433439
}
434440

435441
project('spring-integration-test-support') {
@@ -1137,7 +1143,7 @@ tasks.register('schemaZip', Zip) {
11371143
}
11381144

11391145
tasks.register('docsZip', Zip) {
1140-
dependsOn ':spring-integration-core:dokkaGenerate'
1146+
dependsOn dokkaProjects.collect { ":${it}:dokkaGenerate" }
11411147
group = 'Distribution'
11421148
archiveClassifier = 'docs'
11431149
description = "Builds -${archiveClassifier} archive containing api and reference " +

0 commit comments

Comments
 (0)