diff --git a/build.gradle b/build.gradle index 20b03b3a10..e5a79bb3df 100644 --- a/build.gradle +++ b/build.gradle @@ -39,11 +39,15 @@ buildscript { if (kotlin_version == null) { throw new IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler") } + } + + if (build_snapshot_train || atomicfu_version.endsWith("-SNAPSHOT")) { repositories { mavenLocal() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } + repositories { jcenter() maven { url "https://kotlin.bintray.com/kotlinx" } @@ -83,6 +87,9 @@ allprojects { } kotlin_version = rootProject.properties['kotlin_snapshot_version'] + } + + if (build_snapshot_train || atomicfu_version.endsWith("-SNAPSHOT")) { repositories { mavenLocal() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } @@ -91,7 +98,7 @@ allprojects { } allprojects { - apply plugin: 'kotlinx-atomicfu' + apply plugin: 'kotlinx-atomicfu' // it also adds all the necessary dependencies def projectName = it.name repositories { /* @@ -120,7 +127,6 @@ allprojects { dependencies { // See comment below for rationale, it will be replaced with "project" dependency compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version" - compileOnly "org.jetbrains.kotlinx:atomicfu:$atomicfu_version" // the only way IDEA can resolve test classes testCompile project(":$coreModule").kotlin.targets.jvm.compilations.test.output.allOutputs diff --git a/gradle.properties b/gradle.properties index 62b308e509..74dbf8b199 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ kotlin_version=1.3.30 # Dependencies junit_version=4.12 -atomicfu_version=0.12.3 +atomicfu_version=0.12.4 html_version=0.6.8 lincheck_version=2.0 dokka_version=0.9.16-rdev-2-mpp-hacks diff --git a/gradle/compile-common.gradle b/gradle/compile-common.gradle index d407b2e4de..ebad56a312 100644 --- a/gradle/compile-common.gradle +++ b/gradle/compile-common.gradle @@ -5,7 +5,6 @@ kotlin.sourceSets { commonMain.dependencies { api "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version" - api "org.jetbrains.kotlinx:atomicfu-common:$atomicfu_version" } commonTest.dependencies { diff --git a/gradle/compile-js-multiplatform.gradle b/gradle/compile-js-multiplatform.gradle index 6dc9a1a8c6..286f686394 100644 --- a/gradle/compile-js-multiplatform.gradle +++ b/gradle/compile-js-multiplatform.gradle @@ -12,7 +12,6 @@ kotlin { sourceSets { jsMain.dependencies { api group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-js', version: kotlin_version - api "org.jetbrains.kotlinx:atomicfu-js:$atomicfu_version" } jsTest.dependencies { diff --git a/gradle/compile-jvm-multiplatform.gradle b/gradle/compile-jvm-multiplatform.gradle index b138295723..f6d76fcada 100644 --- a/gradle/compile-jvm-multiplatform.gradle +++ b/gradle/compile-jvm-multiplatform.gradle @@ -16,7 +16,6 @@ kotlin { sourceSets { jvmMain.dependencies { api 'org.jetbrains.kotlin:kotlin-stdlib' - api "org.jetbrains.kotlinx:atomicfu:$atomicfu_version" } jvmTest.dependencies { diff --git a/gradle/compile-native-multiplatform.gradle b/gradle/compile-native-multiplatform.gradle index 005d372f5e..b5fad6935a 100644 --- a/gradle/compile-native-multiplatform.gradle +++ b/gradle/compile-native-multiplatform.gradle @@ -13,10 +13,6 @@ kotlin { } sourceSets { - nativeMain.dependencies { - api "org.jetbrains.kotlinx:atomicfu-native:$atomicfu_version" - } - nativeMain { dependsOn commonMain } // Empty source set is required in order to have native tests task nativeTest {} diff --git a/kotlinx-coroutines-core/common/src/flow/operators/Merge.kt b/kotlinx-coroutines-core/common/src/flow/operators/Merge.kt index 5f3d167e58..cde21f8301 100644 --- a/kotlinx-coroutines-core/common/src/flow/operators/Merge.kt +++ b/kotlinx-coroutines-core/common/src/flow/operators/Merge.kt @@ -130,8 +130,10 @@ private class SerializingFlatMapCollector( } } -private fun AtomicBoolean.tryAcquire(): Boolean = compareAndSet(false, true) +@Suppress("NOTHING_TO_INLINE") +private inline fun AtomicBoolean.tryAcquire(): Boolean = compareAndSet(false, true) -private fun AtomicBoolean.release() { +@Suppress("NOTHING_TO_INLINE") +private inline fun AtomicBoolean.release() { value = false }