Skip to content

Commit

Permalink
improvements in publish.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanusMokrassar committed Nov 5, 2023
1 parent b49e1c5 commit 6ecfbdf
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,19 @@ if (project.hasProperty("signing.gnupg.keyName")) {
}
// Workaround to make test tasks use sign
project.getTasks().withType(Sign.class).configureEach { signTask ->
def pubName = signTask.name.removePrefix("sign").removeSuffix("Publication")

def withoutSign = (signTask.name.startsWith("sign") ? signTask.name.minus("sign") : signTask.name)
def pubName = withoutSign.endsWith("Publication") ? withoutSign.substring(0, withoutSign.length() - "Publication".length()) : withoutSign
// These tasks only exist for native targets, hence findByName() to avoid trying to find them for other targets

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

0 comments on commit 6ecfbdf

Please sign in to comment.