diff --git a/.publish.gradle.swp b/.publish.gradle.swp new file mode 100644 index 0000000000..e6583e15d8 Binary files /dev/null and b/.publish.gradle.swp differ diff --git a/publish.gradle b/publish.gradle index 1a3d5147a0..689e0bc0c2 100644 --- a/publish.gradle +++ b/publish.gradle @@ -102,4 +102,19 @@ if (project.hasProperty("signing.gnupg.keyName")) { def signingTasks = project.getTasks().withType(Sign.class) mustRunAfter(signingTasks) } + // Workaround to make test tasks use sign + project.getTasks().withType(Sign.class).configureEach { signTask -> + def pubName = signTask.name.removePrefix("sign").removeSuffix("Publication") + + // 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 + tasks.findByName("linkDebugTest$pubName")?.let { + signTask.mustRunAfter(it) + } + // Task ':compileTestKotlin' uses this output of task ':signPublication' without declaring an explicit or implicit dependency + tasks.findByName("compileTestKotlin$pubName")?.let { + signTask.mustRunAfter(it) + } + } }