1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-29 04:47:48 +00:00

improvements in publish.gradle

This commit is contained in:
InsanusMokrassar 2023-11-05 13:22:32 +06:00
parent b49e1c50f5
commit 6ecfbdf56d

View File

@ -104,17 +104,19 @@ if (project.hasProperty("signing.gnupg.keyName")) {
} }
// Workaround to make test tasks use sign // Workaround to make test tasks use sign
project.getTasks().withType(Sign.class).configureEach { signTask -> 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 // 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 // Task ':linkDebugTest<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
tasks.findByName("linkDebugTest$pubName")?.let { def debugTestTask = tasks.findByName("linkDebugTest$pubName")
signTask.mustRunAfter(it) if (debugTestTask != null) {
signTask.mustRunAfter(debugTestTask)
} }
// Task ':compileTestKotlin<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency // Task ':compileTestKotlin<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
tasks.findByName("compileTestKotlin$pubName")?.let { def testTask = tasks.findByName("compileTestKotlin$pubName")
signTask.mustRunAfter(it) if (testTask != null) {
signTask.mustRunAfter(testTask)
} }
} }
} }