Skip to content

Commit f5e8740

Browse files
authored
General cleanup (#2809)
* Suppress all deprecated signatures from the documentation * Migrate inline classes to value * Get rid of annoying Gradle output when tasks are configured * Opt-in into delicate coroutines API * Get rid of legacy jvm_ir_enabled that was used for pre-release testing of JVM IR compiler * Update README references
1 parent c9ab4fd commit f5e8740

File tree

36 files changed

+171
-96
lines changed

36 files changed

+171
-96
lines changed

build.gradle

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.jetbrains.dokka.gradle.DokkaTaskPartial
99
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
1010

1111
apply plugin: 'jdk-convention'
12-
apply from: rootProject.file("gradle/experimental.gradle")
12+
apply from: rootProject.file("gradle/opt-in.gradle")
1313

1414
def coreModule = "kotlinx-coroutines-core"
1515
// Not applicable for Kotlin plugin
@@ -36,9 +36,6 @@ buildscript {
3636
throw new IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler")
3737
}
3838
}
39-
// These three flags are enabled in train builds for JVM IR compiler testing
40-
ext.jvm_ir_enabled = rootProject.properties['enable_jvm_ir'] != null
41-
ext.jvm_ir_api_check_enabled = rootProject.properties['enable_jvm_ir_api_check'] != null
4239
ext.native_targets_enabled = rootProject.properties['disable_native_targets'] == null
4340

4441
// Determine if any project dependency is using a snapshot version
@@ -167,9 +164,8 @@ configure(subprojects.findAll { !sourceless.contains(it.name) }) {
167164

168165
// Configure options for all Kotlin compilation tasks
169166
tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all {
170-
kotlinOptions.freeCompilerArgs += experimentalAnnotations.collect { "-Xuse-experimental=" + it }
167+
kotlinOptions.freeCompilerArgs += optInAnnotations.collect { "-Xopt-in=" + it }
171168
kotlinOptions.freeCompilerArgs += "-progressive"
172-
kotlinOptions.freeCompilerArgs += "-XXLanguage:+InlineClasses"
173169
// Disable KT-36770 for RxJava2 integration
174170
kotlinOptions.freeCompilerArgs += "-XXLanguage:-ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated"
175171
// Remove null assertions to get smaller bytecode on Android
@@ -289,15 +285,6 @@ dependencies {
289285
dokkaHtmlMultiModulePlugin("org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version")
290286
}
291287

292-
// Disable binary compatibility check for JVM IR compiler output by default
293-
if (jvm_ir_enabled) {
294-
subprojects { project ->
295-
configure(tasks.matching { it.name == "apiCheck" }) {
296-
enabled = enabled && jvm_ir_api_check_enabled
297-
}
298-
}
299-
}
300-
301288
// Opt-in for build scan in order to troubleshoot Gradle on TC
302289
if (hasProperty('buildScan')) {
303290
buildScan {

buildSrc/src/main/kotlin/Publishing.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,8 @@ fun MavenPom.configureMavenCentralMetadata(project: Project) {
4040
}
4141

4242
fun mavenRepositoryUri(): URI {
43-
// TODO -SNAPSHOT detection can be made here as well
4443
val repositoryId: String? = System.getenv("libs.repository.id")
4544
return if (repositoryId == null) {
46-
// Using implicitly created staging, for MPP it's likely to be a mistake because
47-
// publication on TeamCity will create 3 independent staging repositories
48-
System.err.println("Warning: using an implicitly created staging for coroutines")
4945
URI("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
5046
} else {
5147
URI("https://oss.sonatype.org/service/local/staging/deployByRepositoryId/$repositoryId")

buildSrc/src/main/kotlin/kotlin-jvm-conventions.gradle.kts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ java {
1515
targetCompatibility = JavaVersion.VERSION_1_6
1616
}
1717

18-
if (rootProject.extra.get("jvm_ir_enabled") as Boolean) {
19-
kotlin.target.compilations.configureEach {
20-
kotlinOptions.useIR = true
21-
}
22-
}
23-
2418
dependencies {
2519
testImplementation(kotlin("test"))
2620
// Workaround to make addSuppressed work in tests

gradle/compile-jvm-multiplatform.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ sourceCompatibility = 1.6
66
targetCompatibility = 1.6
77

88
kotlin {
9-
jvm {
10-
if (rootProject.ext.jvm_ir_enabled) {
11-
compilations.all {
12-
kotlinOptions.useIR = true
13-
}
14-
}
15-
}
9+
jvm {}
1610
sourceSets {
1711
jvmTest.dependencies {
1812
api "org.jetbrains.kotlin:kotlin-test:$kotlin_version"

gradle/experimental.gradle renamed to gradle/opt-in.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
// For new mpp
6-
ext.experimentalAnnotations = [
7-
"kotlin.Experimental",
5+
ext.optInAnnotations = [
86
"kotlin.experimental.ExperimentalTypeInference",
97
"kotlin.ExperimentalMultiplatform",
8+
"kotlinx.coroutines.DelicateCoroutinesApi",
109
"kotlinx.coroutines.ExperimentalCoroutinesApi",
1110
"kotlinx.coroutines.ObsoleteCoroutinesApi",
1211
"kotlinx.coroutines.InternalCoroutinesApi",

kotlinx-coroutines-core/build.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ kotlin {
8181
}
8282
languageSettings {
8383
progressiveMode = true
84-
experimentalAnnotations.each { useExperimentalAnnotation(it) }
84+
optInAnnotations.each { useExperimentalAnnotation(it) }
8585
}
8686
}
8787

@@ -201,12 +201,6 @@ jvmTest {
201201
// Configure the IDEA runner for Lincheck
202202
configureJvmForLincheck(jvmTest)
203203
}
204-
// TODO: JVM IR generates different stacktrace so temporary disable stacktrace tests
205-
if (rootProject.ext.jvm_ir_enabled) {
206-
filter {
207-
excludeTestsMatching('kotlinx.coroutines.exceptions.StackTraceRecovery*')
208-
}
209-
}
210204
}
211205

212206
// Setup manifest for kotlinx-coroutines-core-jvm.jar

kotlinx-coroutines-core/common/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ helper function. [NonCancellable] job object is provided to suppress cancellatio
5757
| ---------------- | --------------------------------------------- | ------------------------------------------------ | --------------------------
5858
| [Job] | [join][Job.join] | [onJoin][Job.onJoin] | [isCompleted][Job.isCompleted]
5959
| [Deferred] | [await][Deferred.await] | [onAwait][Deferred.onAwait] | [isCompleted][Job.isCompleted]
60-
| [SendChannel][kotlinx.coroutines.channels.SendChannel] | [send][kotlinx.coroutines.channels.SendChannel.send] | [onSend][kotlinx.coroutines.channels.SendChannel.onSend] | [offer][kotlinx.coroutines.channels.SendChannel.offer]
61-
| [ReceiveChannel][kotlinx.coroutines.channels.ReceiveChannel] | [receive][kotlinx.coroutines.channels.ReceiveChannel.receive] | [onReceive][kotlinx.coroutines.channels.ReceiveChannel.onReceive] | [poll][kotlinx.coroutines.channels.ReceiveChannel.poll]
62-
| [ReceiveChannel][kotlinx.coroutines.channels.ReceiveChannel] | [receiveCatching][kotlinx.coroutines.channels.ReceiveChannel.receiveCatching] | [onReceiveCatching][kotlinx.coroutines.channels.ReceiveChannel.onReceiveCatching] | [poll][kotlinx.coroutines.channels.ReceiveChannel.poll]
60+
| [SendChannel][kotlinx.coroutines.channels.SendChannel] | [send][kotlinx.coroutines.channels.SendChannel.send] | [onSend][kotlinx.coroutines.channels.SendChannel.onSend] | [trySend][kotlinx.coroutines.channels.SendChannel.trySend]
61+
| [ReceiveChannel][kotlinx.coroutines.channels.ReceiveChannel] | [receive][kotlinx.coroutines.channels.ReceiveChannel.receive] | [onReceive][kotlinx.coroutines.channels.ReceiveChannel.onReceive] | [tryReceive][kotlinx.coroutines.channels.ReceiveChannel.tryReceive]
62+
| [ReceiveChannel][kotlinx.coroutines.channels.ReceiveChannel] | [receiveCatching][kotlinx.coroutines.channels.ReceiveChannel.receiveCatching] | [onReceiveCatching][kotlinx.coroutines.channels.ReceiveChannel.onReceiveCatching] | [tryReceive][kotlinx.coroutines.channels.ReceiveChannel.tryReceive]
6363
| [Mutex][kotlinx.coroutines.sync.Mutex] | [lock][kotlinx.coroutines.sync.Mutex.lock] | [onLock][kotlinx.coroutines.sync.Mutex.onLock] | [tryLock][kotlinx.coroutines.sync.Mutex.tryLock]
6464
| none | [delay] | [onTimeout][kotlinx.coroutines.selects.SelectBuilder.onTimeout] | none
6565

@@ -146,9 +146,9 @@ Low-level primitives for finer-grained control of coroutines.
146146
[kotlinx.coroutines.channels.SendChannel.send]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-send-channel/send.html
147147
[kotlinx.coroutines.channels.ReceiveChannel.receive]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-receive-channel/receive.html
148148
[kotlinx.coroutines.channels.SendChannel.onSend]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-send-channel/on-send.html
149-
[kotlinx.coroutines.channels.SendChannel.offer]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-send-channel/offer.html
149+
[kotlinx.coroutines.channels.SendChannel.trySend]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-send-channel/try-send.html
150150
[kotlinx.coroutines.channels.ReceiveChannel.onReceive]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-receive-channel/on-receive.html
151-
[kotlinx.coroutines.channels.ReceiveChannel.poll]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-receive-channel/poll.html
151+
[kotlinx.coroutines.channels.ReceiveChannel.tryReceive]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-receive-channel/try-receive.html
152152
[kotlinx.coroutines.channels.ReceiveChannel.receiveCatching]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-receive-channel/receive-catching.html
153153
[kotlinx.coroutines.channels.ReceiveChannel.onReceiveCatching]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-receive-channel/on-receive-catching.html
154154

kotlinx-coroutines-core/common/src/channels/Channel.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ public interface SendChannel<in E> {
154154
* ```
155155
*
156156
* See https://github.com/Kotlin/kotlinx.coroutines/issues/974 for more context.
157+
*
158+
* @suppress **Deprecated**.
157159
*/
158160
@Deprecated(
159161
level = DeprecationLevel.WARNING,
@@ -308,6 +310,8 @@ public interface ReceiveChannel<out E> {
308310
* The replacement `tryReceive().getOrNull()` is a default that ignores all close exceptions and
309311
* proceeds with `null`, while `poll` throws an exception if the channel was closed with an exception.
310312
* Replacement with the very same 'poll' semantics is `tryReceive().onClosed { if (it != null) throw it }.getOrNull()`
313+
*
314+
* @suppress **Deprecated**.
311315
*/
312316
@Deprecated(
313317
level = DeprecationLevel.WARNING,
@@ -336,6 +340,8 @@ public interface ReceiveChannel<out E> {
336340
* The replacement `receiveCatching().getOrNull()` is a safe default that ignores all close exceptions and
337341
* proceeds with `null`, while `receiveOrNull` throws an exception if the channel was closed with an exception.
338342
* Replacement with the very same `receiveOrNull` semantics is `receiveCatching().onClosed { if (it != null) throw it }.getOrNull()`.
343+
*
344+
* @suppress **Deprecated**
339345
*/
340346
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
341347
@LowPriorityInOverloadResolution

0 commit comments

Comments
 (0)