diff options
author | mvicsokolova <82594708+mvicsokolova@users.noreply.github.com> | 2023-09-19 13:33:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-19 13:33:59 +0200 |
commit | b2b815f44bffe32f04bf6cc6eee57bffb1567e59 (patch) | |
tree | 3b2da473afe2a8b654ae6eff013c7f97811b2822 | |
parent | 1f7825749889191fb531922a3c925e295aa0a9d1 (diff) | |
download | kotlinx.atomicfu-b2b815f44bffe32f04bf6cc6eee57bffb1567e59.tar.gz |
Set dependency between compileNativeTest tasks and Sign tasks (#347)
This issue was revealed after enabling integration testing of atomicfu. Now the first TC build step executes `build` and `publishToMavenLocal` tasks. `publishToMavenLocal` task fails with an error:
```
Reason: Task ':atomicfu:compileTestKotlinLinuxX64' uses this output of task ':atomicfu:signLinuxX64Publication' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
```
This is an already known problem [KT-61313](https://youtrack.jetbrains.com/issue/KT-61313) caused by the task configuration performed by KGP.
-rw-r--r-- | gradle/publishing.gradle | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index bba92e0..01c74b3 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -55,14 +55,27 @@ publishing { publications.all { PublishingKt.configureMavenCentralMetadata(pom, project) PublishingKt.signPublicationIfKeyPresent(project, it) - // add empty javadocs if (it.name != "kotlinMultiplatform") { // The root module gets the JVM's javadoc JAR it.artifact(javadocJar) } } - tasks.withType(PublishToMavenRepository).configureEach { + tasks.withType(AbstractPublishToMaven).configureEach { dependsOn(tasks.withType(Sign)) } + + // NOTE: This is a temporary WA, see KT-61313. + tasks.withType(Sign).configureEach { signTask -> + def pubName = name.takeBetween("sign", "Publication") + + // Task ':linkDebugTest<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency + tasks.findByName("linkDebugTest$pubName")?.configure { + mustRunAfter(signTask) + } + // Task ':compileTestKotlin<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency + tasks.findByName("compileTestKotlin$pubName")?.configure { + mustRunAfter(signTask) + } + } } |