Skip to content

Commit aced4dc

Browse files
authored
Upgrade to Dokka 2.1.0
* Upgrade to Dokka 2.1.0 - Update `org.jetbrains.dokka` plugin from 2.0.0 to 2.1.0 - Remove Jackson 2.15.3 version resolution strategy workaround that was needed to avoid conflicts in Dokka 2.0.0 - Migrate from deprecated V1 tasks (`dokkaHtmlPartial`, `dokkaHtmlMultiModule`) to V2 API (`dokkaGeneratePublicationHtml`, `dokkaGenerate`) - Replace `dokkaSourceSets.main` configuration block with `dokkaSourceSets.configureEach` - Update `docsZip` task to depend on new `dokkaGeneratePublicationHtml` task and add explicit dependency on `:spring-integration-core:dokkaGenerate` * Restore external documentation links for Dokka - Restore external documentation links in spring-integration-core's `dokkaSourceSets` using the new `externalDocumentationLinks. register()` API instead of deprecated `externalDocumentationLink` - Fix indentation of spring-integration-core's `dokka` configuration block to be properly scoped within the project - Remove redundant `noJdkLink.set(false)` setting (false is default) - Remove unnecessary root-level `dokka` configuration that was setting module name and output directory without effect - Remove unused `dokkaGeneratePublicationHtml` task dependency from `docsZip` as `dokkaGenerate` already handles the generation - Simplify dependency chain by relying solely on `:spring-integration-core:dokkaGenerate` - Use root project var to determine root - Move the out of core module This makes the dokka build available to all modules if necessary - Only run the module in the core module * 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 * 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 * Use dokka plugin on required modules
1 parent 7a33738 commit aced4dc

File tree

1 file changed

+41
-40
lines changed

1 file changed

+41
-40
lines changed

build.gradle

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ plugins {
1818
id 'base'
1919
id 'io.spring.nohttp' version '0.0.11' apply false
2020
id 'io.spring.dependency-management' version '1.1.7'
21-
id 'org.jetbrains.dokka' version '2.0.0'
21+
id 'org.jetbrains.dokka' version '2.1.0' apply false
2222
id 'org.antora' version '1.0.0'
2323
id 'io.spring.antora.generate-antora-yml' version '0.0.1'
2424
id 'com.google.protobuf' version '0.9.5' apply false
@@ -115,6 +115,7 @@ ext {
115115
ztZipVersion = '1.17'
116116

117117
javaProjects = subprojects - project(':spring-integration-bom')
118+
118119
}
119120

120121
allprojects {
@@ -178,15 +179,6 @@ allprojects {
178179

179180
}
180181

181-
// TODO Remove when Dokka 2.1.0 is released
182-
configurations.matching { it.name.startsWith('dokka') }.configureEach {
183-
resolutionStrategy.eachDependency {
184-
if (requested.group.startsWith('com.fasterxml.jackson')) {
185-
useVersion('2.15.3')
186-
}
187-
}
188-
}
189-
190182
}
191183

192184
configure(javaProjects) { subproject ->
@@ -416,6 +408,30 @@ configure(javaProjects) { subproject ->
416408
}
417409
}
418410
}
411+
412+
// Process only the modules that require kotlin docs
413+
if (file('src/main/kotlin')) {
414+
apply plugin: 'org.jetbrains.dokka'
415+
dokka {
416+
dokkaPublications.html {
417+
outputDirectory = rootProject.layout.buildDirectory.dir('kdoc')
418+
}
419+
dokkaSourceSets.configureEach {
420+
sourceRoots.setFrom(file('src/main/kotlin'))
421+
classpath.from(sourceSets['main'].runtimeClasspath)
422+
externalDocumentationLinks.register("spring-integration-api") {
423+
url.set(uri("https://docs.spring.io/spring-integration/docs/$version/api/"))
424+
packageListUrl.set(file(rootProject.layout.buildDirectory.file('docs/javadoc/element-list')).toURI())
425+
}
426+
externalDocumentationLinks.register("reactor-core") {
427+
url.set(uri('https://projectreactor.io/docs/core/release/api/'))
428+
}
429+
externalDocumentationLinks.register("reactive-streams") {
430+
url.set(uri('https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/'))
431+
}
432+
}
433+
}
434+
}
419435
}
420436

421437
project('spring-integration-test-support') {
@@ -477,7 +493,6 @@ project('spring-integration-cassandra') {
477493
project('spring-integration-core') {
478494
description = 'Spring Integration Core'
479495

480-
apply plugin: 'org.jetbrains.dokka'
481496
apply plugin: 'com.google.protobuf'
482497

483498
dependencies {
@@ -520,27 +535,6 @@ project('spring-integration-core') {
520535
}
521536
}
522537

523-
dokkaHtmlPartial {
524-
outputDirectory.set(new File('build', 'kdoc'))
525-
dokkaSourceSets {
526-
main {
527-
sourceRoots.setFrom(file('src/main/kotlin'))
528-
classpath.from(sourceSets['main'].runtimeClasspath)
529-
noJdkLink.set(false)
530-
externalDocumentationLink {
531-
url.set(new URL("https://docs.spring.io/spring-integration/docs/$version/api/"))
532-
packageListUrl.set(file('build/docs/javadoc/element-list').toURI().toURL())
533-
}
534-
externalDocumentationLink {
535-
url.set(new URL('https://projectreactor.io/docs/core/release/api/'))
536-
}
537-
externalDocumentationLink {
538-
url.set(new URL('https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/'))
539-
}
540-
}
541-
}
542-
}
543-
544538
protobuf {
545539
protoc {
546540
artifact = "com.google.protobuf:protoc:$protobufVersion"
@@ -1107,12 +1101,6 @@ tasks.register('api') {
11071101
dependsOn javadoc
11081102
}
11091103

1110-
dokkaHtmlMultiModule {
1111-
dependsOn 'api'
1112-
moduleName.set('spring-integration')
1113-
outputDirectory.set(file('build/kdoc'))
1114-
}
1115-
11161104
apply from: "${rootDir}/gradle/docs.gradle"
11171105

11181106
tasks.register('schemaZip', Zip) {
@@ -1150,8 +1138,21 @@ tasks.register('schemaZip', Zip) {
11501138
}
11511139
}
11521140

1141+
apply plugin: 'org.jetbrains.dokka'
1142+
1143+
dependencies {
1144+
dokka project(':spring-integration-core')
1145+
}
1146+
1147+
dokka {
1148+
moduleName = "spring-integration"
1149+
dokkaPublications.html {
1150+
outputDirectory = project.layout.buildDirectory.dir('kdoc')
1151+
}
1152+
}
1153+
11531154
tasks.register('docsZip', Zip) {
1154-
dependsOn 'dokkaHtmlMultiModule'
1155+
dependsOn 'dokkaGenerate'
11551156
group = 'Distribution'
11561157
archiveClassifier = 'docs'
11571158
description = "Builds -${archiveClassifier} archive containing api and reference " +
@@ -1165,7 +1166,7 @@ tasks.register('docsZip', Zip) {
11651166
into 'api'
11661167
}
11671168

1168-
from(dokkaHtmlMultiModule.outputDirectory) {
1169+
from(file('build/kdoc')) {
11691170
into 'kdoc-api'
11701171
}
11711172
}

0 commit comments

Comments
 (0)