@@ -5,6 +5,7 @@ import org.jetbrains.kotlin.konan.target.HostManager
5
5
6
6
apply from : rootProject. file(" gradle/experimental.gradle" )
7
7
8
+ def rootModule = " kotlinx.coroutines"
8
9
def coreModule = " kotlinx-coroutines-core"
9
10
// Not applicable for Kotlin plugin
10
11
def sourceless = [' kotlinx.coroutines' , ' site' ]
@@ -82,17 +83,20 @@ allprojects {
82
83
maven { url " https://kotlin.bintray.com/kotlinx" }
83
84
}
84
85
85
- if (projectName == " kotlinx.coroutines " || projectName == coreModule) return
86
+ if (projectName == rootModule || projectName == coreModule) return
86
87
87
88
// Add dependency to core source sets. Core is configured in kx-core/build.gradle
88
89
evaluationDependsOn(" :$coreModule " )
89
90
if (sourceless. contains(projectName)) return
90
91
91
92
def platform = platformOf(it)
92
93
apply from : rootProject. file(" gradle/compile-${ platform} .gradle" )
93
-
94
+
94
95
dependencies {
95
- compile project(" :$coreModule " )
96
+ // See comment below for rationale, it will be replaced with "project" dependency
97
+ compile " org.jetbrains.kotlinx:kotlinx-coroutines-core:$version "
98
+ compileOnly " org.jetbrains.kotlinx:atomicfu:$atomicFU_version "
99
+
96
100
// the only way IDEA can resolve test classes
97
101
testCompile project(" :$coreModule " ). kotlin. targets. jvm. compilations. test. output. allOutputs
98
102
}
@@ -105,6 +109,22 @@ allprojects {
105
109
}
106
110
}
107
111
112
+ /*
113
+ * Hack to trick nmpp plugin: we are renaming artifacts in order to provide backward compatibility for dependencies,
114
+ * but publishing plugin does not re-read artifact names for kotlin-jvm projects, so renaming is not applied in pom files
115
+ * for JVM-only projects.
116
+ *
117
+ * We artificially replace "project" dependency with "module" one to have proper names in pom files, but then substitute it
118
+ * to have out "project" dependency back.
119
+ */
120
+ configure(subprojects. findAll { it. name != coreModule && it. name != rootModule }) {
121
+ configurations. all {
122
+ resolutionStrategy. dependencySubstitution {
123
+ substitute module(" org.jetbrains.kotlinx:kotlinx-coroutines-core:$version " ) with project(' :kotlinx-coroutines-core' )
124
+ }
125
+ }
126
+ }
127
+
108
128
// Redefine source sets because we are not using 'kotlin/main/fqn' folder convention
109
129
configure(subprojects. findAll { ! sourceless. contains(it. name) && it. name != " benchmarks" && it. name != coreModule }) {
110
130
sourceSets {
0 commit comments