forked from Kotlin/kotlinx.coroutines
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce coroutines platform to have all the dependencies aligned (K…
…otlin#2952) * Introduce coroutines platform to have all the dependencies aligned Fixes Kotlin#2865
- Loading branch information
1 parent
103e3d5
commit eb9a33c
Showing
3 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
/* | ||
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
@file:JvmName("Projects") | ||
import org.gradle.api.Project | ||
|
||
fun Project.version(target: String): String = | ||
property("${target}_version") as String | ||
|
||
val coreModule = "kotlinx-coroutines-core" | ||
val testModule = "kotlinx-coroutines-test" | ||
|
||
val multiplatform = setOf(coreModule, testModule) | ||
// Not applicable for Kotlin plugin | ||
val sourceless = setOf("kotlinx.coroutines", "kotlinx-coroutines-bom", "integration-testing") | ||
val internal = setOf("kotlinx.coroutines", "benchmarks", "integration-testing") | ||
// Not published | ||
val unpublished = internal + setOf("example-frontend-js", "android-unit-tests") | ||
|
||
val Project.isMultiplatform: Boolean get() = name in multiplatform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
import org.gradle.kotlin.dsl.* | ||
import org.jetbrains.kotlin.gradle.dsl.* | ||
|
||
|
||
configure(subprojects.filter { it.name !in unpublished }) { | ||
if (name == "kotlinx-coroutines-bom" || name == "kotlinx.coroutines") return@configure | ||
if (isMultiplatform) { | ||
kotlinExtension.sourceSets.getByName("jvmMain").dependencies { | ||
api(project.dependencies.platform(project(":kotlinx-coroutines-bom"))) | ||
} | ||
} else { | ||
dependencies { | ||
"api"(platform(project(":kotlinx-coroutines-bom"))) | ||
} | ||
} | ||
} |