diff --git a/buildSrc/src/main/kotlin/ktorm.base.gradle.kts b/buildSrc/src/main/kotlin/ktorm.base.gradle.kts index 453a5884..654dbfbf 100644 --- a/buildSrc/src/main/kotlin/ktorm.base.gradle.kts +++ b/buildSrc/src/main/kotlin/ktorm.base.gradle.kts @@ -30,7 +30,12 @@ java { } tasks { + // Lifecycle task for code generation. + val codegen by registering { /* do nothing */ } + compileKotlin { + dependsOn(codegen) + kotlinOptions { jvmTarget = "1.8" allWarningsAsErrors = true diff --git a/buildSrc/src/main/kotlin/ktorm.dokka.gradle.kts b/buildSrc/src/main/kotlin/ktorm.dokka.gradle.kts index 6bd77f89..98470a80 100644 --- a/buildSrc/src/main/kotlin/ktorm.dokka.gradle.kts +++ b/buildSrc/src/main/kotlin/ktorm.dokka.gradle.kts @@ -15,7 +15,17 @@ tasks.named("dokkaHtmlMultiModu subprojects { apply(plugin = "org.jetbrains.dokka") + tasks.dokkaJavadoc { + dependsOn("codegen") + + dokkaSourceSets.named("main") { + suppressGeneratedFiles.set(false) + } + } + tasks.named("dokkaHtmlPartial") { + dependsOn("codegen") + dokkaSourceSets.named("main") { suppressGeneratedFiles.set(false) sourceLink { diff --git a/buildSrc/src/main/kotlin/ktorm.publish.gradle.kts b/buildSrc/src/main/kotlin/ktorm.publish.gradle.kts index ac45f1fc..61a3f47b 100644 --- a/buildSrc/src/main/kotlin/ktorm.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/ktorm.publish.gradle.kts @@ -7,6 +7,7 @@ plugins { } val jarSources by tasks.registering(Jar::class) { + dependsOn("codegen") from(sourceSets.main.map { it.allSource }) archiveClassifier.set("sources") } diff --git a/buildSrc/src/main/kotlin/ktorm.tuples-codegen.gradle.kts b/buildSrc/src/main/kotlin/ktorm.tuples-codegen.gradle.kts index ab89460f..17da637c 100644 --- a/buildSrc/src/main/kotlin/ktorm.tuples-codegen.gradle.kts +++ b/buildSrc/src/main/kotlin/ktorm.tuples-codegen.gradle.kts @@ -349,13 +349,7 @@ val generateTuples by tasks.registering { } tasks { - compileKotlin { - dependsOn(generateTuples) - } - "jarSources" { - dependsOn(generateTuples) - } - dokkaJavadoc { + "codegen" { dependsOn(generateTuples) } } diff --git a/ktorm-jackson/ktorm-jackson.gradle.kts b/ktorm-jackson/ktorm-jackson.gradle.kts index 5c4c36d0..d9dac31f 100644 --- a/ktorm-jackson/ktorm-jackson.gradle.kts +++ b/ktorm-jackson/ktorm-jackson.gradle.kts @@ -23,13 +23,7 @@ val generatePackageVersion by tasks.registering(Copy::class) { } tasks { - compileKotlin { - dependsOn(generatePackageVersion) - } - "jarSources" { - dependsOn(generatePackageVersion) - } - dokkaJavadoc { + codegen { dependsOn(generatePackageVersion) } }