Skip to content

Commit 74e2a59

Browse files
committed
Simplify Dokka configuration with auto-discovery
Replace static `dokkaProjects` list with dynamic Kotlin source detection, eliminating manual maintenance and improving automation. - Remove `dokkaProjects` list from ext block that required manual updates when adding Kotlin modules - Move Dokka plugin and configuration back into main `javaProjects` configure block for simpler structure - Update `docsZip` task to dynamically find projects with Kotlin sources using `javaProjects.findAll {it.file('src/main/kotlin'). exists()}` instead of referencing static list - Change output directory API from `buildDirectory.file('kdoc')` to `buildDirectory.dir('kdoc')` for semantically correct directory reference
1 parent d85e6a7 commit 74e2a59

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

build.gradle

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ ext {
116116

117117
javaProjects = subprojects - project(':spring-integration-bom')
118118

119-
// Modules that have Kotlin sources to document using dokka
120-
dokkaProjects = [
121-
'spring-integration-core'
122-
]
123119
}
124120

125121
allprojects {
@@ -412,14 +408,12 @@ configure(javaProjects) { subproject ->
412408
}
413409
}
414410
}
415-
}
416411

417-
// Process only the modules that require kotlin docs
418-
configure(subprojects.findAll { dokkaProjects.contains(it.name) }) { subproject ->
412+
// Process only the modules that require kotlin docs
419413
apply plugin: 'org.jetbrains.dokka'
420414
dokka {
421415
dokkaPublications.html {
422-
outputDirectory.set(file(rootProject.layout.buildDirectory.file('kdoc')))
416+
outputDirectory.set(file(rootProject.layout.buildDirectory.dir('kdoc')))
423417
}
424418
dokkaSourceSets.configureEach {
425419
sourceRoots.setFrom(file('src/main/kotlin'))
@@ -1143,7 +1137,7 @@ tasks.register('schemaZip', Zip) {
11431137
}
11441138

11451139
tasks.register('docsZip', Zip) {
1146-
dependsOn dokkaProjects.collect { ":${it}:dokkaGenerate" }
1140+
dependsOn javaProjects.findAll { it.file('src/main/kotlin').exists() }.collect { ":${it.name}:dokkaGenerate" }
11471141
group = 'Distribution'
11481142
archiveClassifier = 'docs'
11491143
description = "Builds -${archiveClassifier} archive containing api and reference " +

0 commit comments

Comments
 (0)