Skip to content

Commit

Permalink
Fix native tasks vs sign task .asc output reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
joffrey-bion committed Aug 18, 2023
1 parent 7924cbb commit 20f2e64
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions buildSrc/src/main/kotlin/krossbow-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,21 @@ signing {
useInMemoryPgpKeys(signingKey, signingPassword)
sign(extensions.getByType<PublishingExtension>().publications)
}

// Resolves issues with .asc task output of the sign task of native targets.
// See: https://github.com/gradle/gradle/issues/26132
// And: https://youtrack.jetbrains.com/issue/KT-46466
tasks.withType<Sign>().configureEach {
val pubName = name.removePrefix("sign").removeSuffix("Publication")

// These tasks only exist for native targets, hence findByName() to avoid trying to find them for other targets

// Task ':linkDebug<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
tasks.findByName("linkDebugTest$pubName")?.let {
mustRunAfter(it)
}
// Task ':compileTestKotlin<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
tasks.findByName("compileTestKotlin$pubName")?.let {
mustRunAfter(it)
}
}

0 comments on commit 20f2e64

Please sign in to comment.