Skip to content

Commit

Permalink
add codegen lifecycle task
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentlauvlwj committed Aug 17, 2024
1 parent 4f89c49 commit 344bcd3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
5 changes: 5 additions & 0 deletions buildSrc/src/main/kotlin/ktorm.base.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions buildSrc/src/main/kotlin/ktorm.dokka.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ tasks.named<org.jetbrains.dokka.gradle.DokkaMultiModuleTask>("dokkaHtmlMultiModu
subprojects {
apply(plugin = "org.jetbrains.dokka")

tasks.dokkaJavadoc {
dependsOn("codegen")

dokkaSourceSets.named("main") {
suppressGeneratedFiles.set(false)
}
}

tasks.named<org.jetbrains.dokka.gradle.DokkaTaskPartial>("dokkaHtmlPartial") {
dependsOn("codegen")

dokkaSourceSets.named("main") {
suppressGeneratedFiles.set(false)
sourceLink {
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/ktorm.publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
}

val jarSources by tasks.registering(Jar::class) {
dependsOn("codegen")
from(sourceSets.main.map { it.allSource })
archiveClassifier.set("sources")
}
Expand Down
8 changes: 1 addition & 7 deletions buildSrc/src/main/kotlin/ktorm.tuples-codegen.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,7 @@ val generateTuples by tasks.registering {
}

tasks {
compileKotlin {
dependsOn(generateTuples)
}
"jarSources" {
dependsOn(generateTuples)
}
dokkaJavadoc {
"codegen" {
dependsOn(generateTuples)
}
}
Expand Down
8 changes: 1 addition & 7 deletions ktorm-jackson/ktorm-jackson.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ val generatePackageVersion by tasks.registering(Copy::class) {
}

tasks {
compileKotlin {
dependsOn(generatePackageVersion)
}
"jarSources" {
dependsOn(generatePackageVersion)
}
dokkaJavadoc {
codegen {
dependsOn(generatePackageVersion)
}
}
Expand Down

0 comments on commit 344bcd3

Please sign in to comment.