Skip to content

Commit 0d5cc8f

Browse files
committed
Workaround for invalid core dependencies in JVM-only modules
1 parent a85d611 commit 0d5cc8f

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

build.gradle

+25-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
import org.jetbrains.kotlin.konan.target.HostManager
55

66
apply from: rootProject.file("gradle/experimental.gradle")
77

8+
def rootModule = "kotlinx.coroutines"
89
def coreModule = "kotlinx-coroutines-core"
910
// Not applicable for Kotlin plugin
1011
def sourceless = ['kotlinx.coroutines', 'site']
@@ -82,17 +83,21 @@ allprojects {
8283
maven { url "https://kotlin.bintray.com/kotlinx" }
8384
}
8485

85-
if (projectName == "kotlinx.coroutines" || projectName == coreModule) return
86+
if (projectName == rootModule || projectName == coreModule) return
8687

8788
// Add dependency to core source sets. Core is configured in kx-core/build.gradle
8889
evaluationDependsOn(":$coreModule")
8990
if (sourceless.contains(projectName)) return
9091

9192
def platform = platformOf(it)
9293
apply from: rootProject.file("gradle/compile-${platform}.gradle")
93-
94+
95+
9496
dependencies {
95-
compile project(":$coreModule")
97+
// See comment below for rationale, it will be replaced with "project" dependency
98+
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
99+
compileOnly "org.jetbrains.kotlinx:atomicfu:$atomicFU_version"
100+
96101
// the only way IDEA can resolve test classes
97102
testCompile project(":$coreModule").kotlin.targets.jvm.compilations.test.output.allOutputs
98103
}
@@ -105,6 +110,22 @@ allprojects {
105110
}
106111
}
107112

113+
/*
114+
* Hack to trick nmpp plugin: we are renaming artifacts in order to provide backward compatibility for dependencies,
115+
* but publishing plugin does not re-read artifact names for kotlin-jvm projects, so renaming is not applied in pom files
116+
* for JVM-only projects.
117+
*
118+
* We artificially replace "project" dependency with "module" one to have proper names in pom files, but then substitute it
119+
* to have out "project" dependency back.
120+
*/
121+
configure(subprojects.findAll { it.name != coreModule && it.name != rootModule }) {
122+
configurations.all {
123+
resolutionStrategy.dependencySubstitution {
124+
substitute module("org.jetbrains.kotlinx:kotlinx-coroutines-core:$version") with project(':kotlinx-coroutines-core')
125+
}
126+
}
127+
}
128+
108129
// Redefine source sets because we are not using 'kotlin/main/fqn' folder convention
109130
configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != "benchmarks" && it.name != coreModule }) {
110131
sourceSets {

gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ lincheck_version=2.0
1111
dokka_version=0.9.16-rdev-2-mpp-hacks
1212
bintray_version=1.8.2-SNAPSHOT
1313
byte_buddy_version=1.9.3
14+
reactor_vesion=3.2.5.RELEASE
1415
artifactory_plugin_version=4.7.3
1516

1617
# JS
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
plugins {
6-
id 'io.spring.dependency-management' version '1.0.3.RELEASE'
7-
}
8-
9-
dependencyManagement {
10-
imports {
11-
mavenBom 'io.projectreactor:reactor-bom:Bismuth-RELEASE'
12-
}
13-
}
14-
155
dependencies {
16-
compile 'io.projectreactor:reactor-core'
6+
compile "io.projectreactor:reactor-core:$reactor_vesion"
177
compile project(':kotlinx-coroutines-reactive')
188
}
199

2010
tasks.withType(dokka.getClass()) {
2111
externalDocumentationLink {
22-
url = new URL('https://projectreactor.io/docs/core/release/api/')
12+
url = new URL('https://projectreactor.io/docs/core/3.2.5.RELEASE/api/')
2313
}
2414
}

0 commit comments

Comments
 (0)