Skip to content

Commit e1ac2e5

Browse files
committed
Fix atomicfu post-processing and dependencies
* Update to atomicfu 0.12.4, which fixes plugin operation with kotlin-multiplatform * Remove explicit dependencies (plugins adds them automatically) Fixes #1116 Fixes #1064
1 parent 8009b36 commit e1ac2e5

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

build.gradle

+8-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ buildscript {
3939
if (kotlin_version == null) {
4040
throw new IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler")
4141
}
42+
}
43+
44+
if (build_snapshot_train || atomicfu_version.endsWith("-SNAPSHOT")) {
4245
repositories {
4346
mavenLocal()
4447
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
4548
}
4649
}
50+
4751
repositories {
4852
jcenter()
4953
maven { url "https://kotlin.bintray.com/kotlinx" }
@@ -83,6 +87,9 @@ allprojects {
8387
}
8488

8589
kotlin_version = rootProject.properties['kotlin_snapshot_version']
90+
}
91+
92+
if (build_snapshot_train || atomicfu_version.endsWith("-SNAPSHOT")) {
8693
repositories {
8794
mavenLocal()
8895
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
@@ -91,7 +98,7 @@ allprojects {
9198
}
9299

93100
allprojects {
94-
apply plugin: 'kotlinx-atomicfu'
101+
apply plugin: 'kotlinx-atomicfu' // it also adds all the necessary dependencies
95102
def projectName = it.name
96103
repositories {
97104
/*
@@ -120,7 +127,6 @@ allprojects {
120127
dependencies {
121128
// See comment below for rationale, it will be replaced with "project" dependency
122129
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
123-
compileOnly "org.jetbrains.kotlinx:atomicfu:$atomicfu_version"
124130

125131
// the only way IDEA can resolve test classes
126132
testCompile project(":$coreModule").kotlin.targets.jvm.compilations.test.output.allOutputs

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ kotlin_version=1.3.30
55

66
# Dependencies
77
junit_version=4.12
8-
atomicfu_version=0.12.3
8+
atomicfu_version=0.12.4
99
html_version=0.6.8
1010
lincheck_version=2.0
1111
dokka_version=0.9.16-rdev-2-mpp-hacks

gradle/compile-common.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
kotlin.sourceSets {
66
commonMain.dependencies {
77
api "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
8-
api "org.jetbrains.kotlinx:atomicfu-common:$atomicfu_version"
98
}
109

1110
commonTest.dependencies {

gradle/compile-js-multiplatform.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ kotlin {
1212
sourceSets {
1313
jsMain.dependencies {
1414
api group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-js', version: kotlin_version
15-
api "org.jetbrains.kotlinx:atomicfu-js:$atomicfu_version"
1615
}
1716

1817
jsTest.dependencies {

gradle/compile-jvm-multiplatform.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ kotlin {
1616
sourceSets {
1717
jvmMain.dependencies {
1818
api 'org.jetbrains.kotlin:kotlin-stdlib'
19-
api "org.jetbrains.kotlinx:atomicfu:$atomicfu_version"
2019
}
2120

2221
jvmTest.dependencies {

gradle/compile-native-multiplatform.gradle

-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ kotlin {
1313
}
1414

1515
sourceSets {
16-
nativeMain.dependencies {
17-
api "org.jetbrains.kotlinx:atomicfu-native:$atomicfu_version"
18-
}
19-
2016
nativeMain { dependsOn commonMain }
2117
// Empty source set is required in order to have native tests task
2218
nativeTest {}

kotlinx-coroutines-core/common/src/flow/operators/Merge.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ private class SerializingFlatMapCollector<T>(
130130
}
131131
}
132132

133-
private fun AtomicBoolean.tryAcquire(): Boolean = compareAndSet(false, true)
133+
@Suppress("NOTHING_TO_INLINE")
134+
private inline fun AtomicBoolean.tryAcquire(): Boolean = compareAndSet(false, true)
134135

135-
private fun AtomicBoolean.release() {
136+
@Suppress("NOTHING_TO_INLINE")
137+
private inline fun AtomicBoolean.release() {
136138
value = false
137139
}

0 commit comments

Comments
 (0)