Skip to content

Fix atomicfu post-processing and dependencies #1120

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

Merged
merged 1 commit into from
Apr 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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" }
Expand All @@ -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 {
/*
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion gradle/compile-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion gradle/compile-js-multiplatform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion gradle/compile-jvm-multiplatform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ kotlin {
sourceSets {
jvmMain.dependencies {
api 'org.jetbrains.kotlin:kotlin-stdlib'
api "org.jetbrains.kotlinx:atomicfu:$atomicfu_version"
}

jvmTest.dependencies {
Expand Down
4 changes: 0 additions & 4 deletions gradle/compile-native-multiplatform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
6 changes: 4 additions & 2 deletions kotlinx-coroutines-core/common/src/flow/operators/Merge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ private class SerializingFlatMapCollector<T>(
}
}

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
}