From 3bf2d858eb9d1eb95425e6f55af659ee0795b726 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 6 Nov 2023 17:35:41 +0600 Subject: [PATCH] update publishing script --- publish.gradle | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/publish.gradle b/publish.gradle index 690e65f..cd046ec 100644 --- a/publish.gradle +++ b/publish.gradle @@ -1,7 +1,7 @@ apply plugin: 'maven-publish' task javadocsJar(type: Jar) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' } publishing { @@ -96,4 +96,27 @@ if (project.hasProperty("signing.gnupg.keyName")) { dependsOn(it) } } + + // Workaround to make android sign operations depend on signing tasks + project.getTasks().withType(AbstractPublishToMaven.class).configureEach { + def signingTasks = project.getTasks().withType(Sign.class) + mustRunAfter(signingTasks) + } + // Workaround to make test tasks use sign + project.getTasks().withType(Sign.class).configureEach { signTask -> + 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' uses this output of task ':signPublication' without declaring an explicit or implicit dependency + def debugTestTask = tasks.findByName("linkDebugTest$pubName") + if (debugTestTask != null) { + signTask.mustRunAfter(debugTestTask) + } + // Task ':compileTestKotlin' uses this output of task ':signPublication' without declaring an explicit or implicit dependency + def testTask = tasks.findByName("compileTestKotlin$pubName") + if (testTask != null) { + signTask.mustRunAfter(testTask) + } + } }