Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce coroutines platform to have all the dependencies aligned #2952

Merged
merged 2 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 5 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/


import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.dokka.gradle.DokkaTaskPartial

apply plugin: 'jdk-convention'
import static Projects.*

def coreModule = "kotlinx-coroutines-core"
def testModule = "kotlinx-coroutines-test"
def multiplatform = [coreModule, testModule]
// Not applicable for Kotlin plugin
def sourceless = ['kotlinx.coroutines', 'kotlinx-coroutines-bom', 'integration-testing']
def internal = ['kotlinx.coroutines', 'benchmarks', 'integration-testing']
// Not published
def unpublished = internal + ['example-frontend-js', 'android-unit-tests']
apply plugin: 'jdk-convention'

buildscript {
/*
Expand Down Expand Up @@ -160,6 +154,8 @@ configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != core
}
}

apply plugin: "bom-conventions"

// Configure subprojects with Kotlin sources
configure(subprojects.findAll { !sourceless.contains(it.name) }) {
// Use atomicfu plugin, it also adds all the necessary dependencies
Expand Down
14 changes: 13 additions & 1 deletion buildSrc/src/main/kotlin/Projects.kt
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
19 changes: 19 additions & 0 deletions buildSrc/src/main/kotlin/bom-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.*

/*
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
qwwdfsad marked this conversation as resolved.
Show resolved Hide resolved

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")))
}
}
}