Skip to content

Commit 520afcb

Browse files
authored
Gradle stewardship (#2431)
* Remove conditional publication that is compatible with Kotlin 1.3.70 plugin * Get rid of workaround in old MPP plugin with dependency renaming
1 parent 5f69f90 commit 520afcb

File tree

2 files changed

+4
-39
lines changed

2 files changed

+4
-39
lines changed

build.gradle

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import org.gradle.util.VersionNumber
77
apply plugin: 'jdk-convention'
88
apply from: rootProject.file("gradle/experimental.gradle")
99

10-
def rootModule = "kotlinx.coroutines"
1110
def coreModule = "kotlinx-coroutines-core"
1211
// Not applicable for Kotlin plugin
1312
def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'integration-testing']
@@ -187,7 +186,7 @@ configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != core
187186
apply from: rootProject.file("gradle/compile-${platform}.gradle")
188187
dependencies {
189188
// See comment below for rationale, it will be replaced with "project" dependency
190-
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
189+
compile project(":$coreModule")
191190
// the only way IDEA can resolve test classes
192191
testCompile project(":$coreModule").kotlin.targets.jvm.compilations.test.output.allOutputs
193192
}
@@ -243,22 +242,6 @@ if (build_snapshot_train) {
243242
}
244243
}
245244

246-
/*
247-
* Hack to trick nmpp plugin: we are renaming artifacts in order to provide backward compatibility for dependencies,
248-
* but publishing plugin does not re-read artifact names for kotlin-jvm projects, so renaming is not applied in pom files
249-
* for JVM-only projects.
250-
*
251-
* We artificially replace "project" dependency with "module" one to have proper names in pom files, but then substitute it
252-
* to have out "project" dependency back.
253-
*/
254-
configure(subprojects.findAll { it.name != coreModule && it.name != rootModule }) {
255-
configurations.all {
256-
resolutionStrategy.dependencySubstitution {
257-
substitute module("org.jetbrains.kotlinx:kotlinx-coroutines-core:$version") with project(':kotlinx-coroutines-core')
258-
}
259-
}
260-
}
261-
262245
// Redefine source sets because we are not using 'kotlin/main/fqn' folder convention
263246
configure(subprojects.findAll {
264247
!sourceless.contains(it.name) &&

gradle/publish-bintray.gradle

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ apply plugin: 'maven-publish'
1313

1414
def isMultiplatform = project.name == "kotlinx-coroutines-core"
1515
def isBom = project.name == "kotlinx-coroutines-bom"
16-
def isKotlin137x = VersionNumber.parse(kotlin_version) <= VersionNumber.parse("1.3.79")
1716

1817
if (!isBom) {
1918
apply plugin: "com.github.johnrengelman.shadow"
@@ -72,39 +71,22 @@ publishing {
7271
it.artifact(javadocJar)
7372
}
7473

75-
// Rename MPP artifacts for backward compatibility
7674
def type = it.name
7775
switch (type) {
7876
case 'kotlinMultiplatform':
7977
// With Kotlin 1.4 & HMPP, the root module should have no suffix in the ID, but for compatibility with
8078
// the consumers who can't read Gradle module metadata, we publish the JVM artifacts in it, too
81-
it.artifactId = isKotlin137x ? "$project.name-native" : project.name
82-
if (!isKotlin137x) {
83-
apply from: "$rootDir/gradle/publish-mpp-root-module-in-platform.gradle"
84-
publishPlatformArtifactsInRootModule(publications["jvm"])
85-
}
79+
it.artifactId = project.name
80+
apply from: "$rootDir/gradle/publish-mpp-root-module-in-platform.gradle"
81+
publishPlatformArtifactsInRootModule(publications["jvm"])
8682
break
8783
case 'metadata':
88-
// As the old -common dependencies will fail to resolve with Gradle module metadata, rename the module
89-
// to '*-metadata' so that the resolution failure are more clear
90-
it.artifactId = isKotlin137x ? "$project.name-common" : "$project.name-metadata"
91-
break
9284
case 'jvm':
93-
it.artifactId = isKotlin137x ? project.name : "$project.name-jvm"
94-
break
9585
case 'js':
9686
case 'native':
9787
it.artifactId = "$project.name-$type"
9888
break
9989
}
100-
// Hierarchical project structures are not fully supported in 1.3.7x MPP
101-
if (isKotlin137x) {
102-
// disable metadata everywhere, but in native and js modules
103-
if (type == 'maven' || type == 'metadata' || type == 'jvm') {
104-
moduleDescriptorGenerator = null
105-
}
106-
}
107-
10890
}
10991
}
11092

0 commit comments

Comments
 (0)