Skip to content

Commit 5b610bb

Browse files
authored
Fix publication validator not looking in the local maven repository (#1880)
During the change of the publication validator, a bug was introduced that led to MavenPublicationValidator being run not on the artifacts from the local Maven repository but on classfiles from the corresponding subproject. This is a problem because this test is for the behavior of the atomicfu plugin, which could in theory produce nice classfiles in one place but wrong ones in the other, and the only important thing to test is whether the published classfiles are good. Now, this is fixed.
1 parent 3fdd3fe commit 5b610bb

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

publication-validator/build.gradle

+10-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
apply from: rootProject.file("gradle/compile-jvm.gradle")
66

7+
def coroutines_version = version // all modules share the same version
8+
79
repositories {
810
mavenLocal()
911
mavenCentral()
@@ -14,8 +16,6 @@ dependencies {
1416
testCompile 'junit:junit:4.12'
1517
testCompile 'org.apache.commons:commons-compress:1.18'
1618
testCompile 'com.google.code.gson:gson:2.8.5'
17-
testCompile project(':kotlinx-coroutines-core')
18-
testCompile project(':kotlinx-coroutines-android')
1919
}
2020

2121
compileTestKotlin {
@@ -26,7 +26,14 @@ def dryRunNpm = properties['dryRun']
2626

2727
test {
2828
onlyIf { dryRunNpm == "true" } // so that we don't accidentally publish anything, especially before the test
29-
doFirst { println "Verifying publishing version $version" } // all modules share the same version
29+
doFirst {
30+
println "Verifying publishing version $coroutines_version"
31+
// we can't depend on the subprojects because we need to test the classfiles that are published in the end.
32+
// also, we can't put this in the `dependencies` block because the resolution would happen before publication.
33+
classpath += project.configurations.detachedConfiguration(
34+
project.dependencies.create("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"),
35+
project.dependencies.create("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"))
36+
}
3037
environment "projectRoot", project.rootDir
3138
environment "deployVersion", version
3239
if (dryRunNpm == "true") { // `onlyIf` only affects execution of the task, not the dependency subtree

0 commit comments

Comments
 (0)