Skip to content

Commit 4bc89e2

Browse files
authored
Merge pull request #3719 from Kotlin/version-1.7.0-RC
Version 1.7.0-RC
2 parents 2653cd2 + 1b0022b commit 4bc89e2

35 files changed

+456
-137
lines changed

CHANGES.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Change log for kotlinx.coroutines
22

3+
## Version 1.7.0-RC
4+
5+
* Kotlin version is updated to 1.8.20.
6+
* Atomicfu version is updated to 0.20.2.
7+
* `JavaFx` version is updated to 17.0.2 in `kotlinx-coroutines-javafx` (#3671).
8+
* `previous-compilation-data.bin` file is removed from JAR resources (#3668).
9+
* `CoroutineDispatcher.asExecutor()` runs tasks without dispatching if the dispatcher is unconfined (#3683). Thanks @odedniv!
10+
* `SharedFlow.toMutableList` lint overload is undeprecated (#3706).
11+
* `Channel.invokeOnClose` is promoted to stable API (#3358).
12+
* Improved lock contention in `Dispatchers.Default` and `Dispatchers.IO` during the startup phase (#3652).
13+
* Fixed a bug that led to threads oversubscription in `Dispatchers.Default` (#3642).
14+
* Fixed a bug that allowed `limitedParallelism` to perform dispatches even after the underlying dispatcher was closed (#3672).
15+
* Restored binary compatibility of previously experimental `TestScope.runTest(Long)` (#3673).
16+
317
## Version 1.7.0-Beta
418

519
### Core API significant improvements

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
[![Kotlin Stable](https://kotl.in/badges/stable.svg)](https://kotlinlang.org/docs/components-stability.html)
44
[![JetBrains official project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
55
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
6-
[![Download](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.0-Beta)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.0-Beta)
7-
[![Kotlin](https://img.shields.io/badge/kotlin-1.8.10-blue.svg?logo=kotlin)](http://kotlinlang.org)
6+
[![Download](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.0-RC)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.0-RC)
7+
[![Kotlin](https://img.shields.io/badge/kotlin-1.8.20-blue.svg?logo=kotlin)](http://kotlinlang.org)
88
[![Slack channel](https://img.shields.io/badge/chat-slack-green.svg?logo=slack)](https://kotlinlang.slack.com/messages/coroutines/)
99

1010
Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
11-
This is a companion version for the Kotlin `1.8.10` release.
11+
This is a companion version for the Kotlin `1.8.20` release.
1212

1313
```kotlin
1414
suspend fun main() = coroutineScope {
@@ -85,15 +85,15 @@ Add dependencies (you can also add other modules that you need):
8585
<dependency>
8686
<groupId>org.jetbrains.kotlinx</groupId>
8787
<artifactId>kotlinx-coroutines-core</artifactId>
88-
<version>1.7.0-Beta</version>
88+
<version>1.7.0-RC</version>
8989
</dependency>
9090
```
9191

9292
And make sure that you use the latest Kotlin version:
9393

9494
```xml
9595
<properties>
96-
<kotlin.version>1.8.10</kotlin.version>
96+
<kotlin.version>1.8.20</kotlin.version>
9797
</properties>
9898
```
9999

@@ -103,7 +103,7 @@ Add dependencies (you can also add other modules that you need):
103103

104104
```kotlin
105105
dependencies {
106-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-Beta")
106+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-RC")
107107
}
108108
```
109109

@@ -112,10 +112,10 @@ And make sure that you use the latest Kotlin version:
112112
```kotlin
113113
plugins {
114114
// For build.gradle.kts (Kotlin DSL)
115-
kotlin("jvm") version "1.8.10"
115+
kotlin("jvm") version "1.8.20"
116116

117117
// For build.gradle (Groovy DSL)
118-
id "org.jetbrains.kotlin.jvm" version "1.8.10"
118+
id "org.jetbrains.kotlin.jvm" version "1.8.20"
119119
}
120120
```
121121

@@ -133,7 +133,7 @@ Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
133133
module as a dependency when using `kotlinx.coroutines` on Android:
134134

135135
```kotlin
136-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.0-Beta")
136+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.0-RC")
137137
```
138138

139139
This gives you access to the Android [Dispatchers.Main]
@@ -168,7 +168,7 @@ In common code that should get compiled for different platforms, you can add a d
168168
```kotlin
169169
commonMain {
170170
dependencies {
171-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-Beta")
171+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-RC")
172172
}
173173
}
174174
```
@@ -180,7 +180,7 @@ Platform-specific dependencies are recommended to be used only for non-multiplat
180180
#### JS
181181

182182
Kotlin/JS version of `kotlinx.coroutines` is published as
183-
[`kotlinx-coroutines-core-js`](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.7.0-Beta)
183+
[`kotlinx-coroutines-core-js`](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.7.0-RC)
184184
(follow the link to get the dependency declaration snippet) and as [`kotlinx-coroutines-core`](https://www.npmjs.com/package/kotlinx-coroutines-core) NPM package.
185185

186186
#### Native

build.gradle

+16-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
import org.jetbrains.kotlin.config.KotlinCompilerVersion
77
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
8-
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
8+
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
9+
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
10+
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
11+
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
912
import org.jetbrains.kotlin.konan.target.HostManager
1013
import org.jetbrains.dokka.gradle.DokkaTaskPartial
1114

@@ -361,3 +364,15 @@ allprojects { subProject ->
361364
tasks.named("dokkaHtmlMultiModule") {
362365
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase": """{ "templatesDir": "${projectDir.toString().replace('\\', '/')}/dokka-templates" }"""])
363366
}
367+
368+
if (CacheRedirector.enabled) {
369+
def yarnRootExtension = rootProject.extensions.findByType(YarnRootExtension.class)
370+
if (yarnRootExtension != null) {
371+
yarnRootExtension.downloadBaseUrl = CacheRedirector.maybeRedirect(yarnRootExtension.downloadBaseUrl)
372+
}
373+
374+
def nodeJsExtension = rootProject.extensions.findByType(NodeJsRootExtension.class)
375+
if (nodeJsExtension != null) {
376+
nodeJsExtension.nodeDownloadBaseUrl = CacheRedirector.maybeRedirect(nodeJsExtension.nodeDownloadBaseUrl)
377+
}
378+
}

buildSrc/src/main/kotlin/CacheRedirector.kt

+16-5
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,33 @@ private val mirroredUrls = listOf(
2626
"https://dl.google.com/dl/android/studio/ide-zips",
2727
"https://dl.google.com/go",
2828
"https://download.jetbrains.com",
29+
"https://github.com/yarnpkg/yarn/releases/download",
2930
"https://jitpack.io",
30-
"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev",
3131
"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap",
32+
"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev",
3233
"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/eap",
34+
"https://nodejs.org/dist",
3335
"https://oss.sonatype.org/content/repositories/releases",
3436
"https://oss.sonatype.org/content/repositories/snapshots",
3537
"https://oss.sonatype.org/content/repositories/staging",
3638
"https://packages.confluent.io/maven/",
3739
"https://plugins.gradle.org/m2",
3840
"https://plugins.jetbrains.com/maven",
39-
"https://repo1.maven.org/maven2",
4041
"https://repo.grails.org/grails/core",
4142
"https://repo.jenkins-ci.org/releases",
4243
"https://repo.maven.apache.org/maven2",
4344
"https://repo.spring.io/milestone",
4445
"https://repo.typesafe.com/typesafe/ivy-releases",
46+
"https://repo1.maven.org/maven2",
4547
"https://services.gradle.org",
4648
"https://www.exasol.com/artifactory/exasol-releases",
49+
"https://www.jetbrains.com/intellij-repository/nightly",
50+
"https://www.jetbrains.com/intellij-repository/releases",
51+
"https://www.jetbrains.com/intellij-repository/snapshots",
4752
"https://www.myget.org/F/intellij-go-snapshots/maven",
4853
"https://www.myget.org/F/rd-model-snapshots/maven",
4954
"https://www.myget.org/F/rd-snapshots/maven",
5055
"https://www.python.org/ftp",
51-
"https://www.jetbrains.com/intellij-repository/nightly",
52-
"https://www.jetbrains.com/intellij-repository/releases",
53-
"https://www.jetbrains.com/intellij-repository/snapshots"
5456
)
5557

5658
private val aliases = mapOf(
@@ -115,4 +117,13 @@ object CacheRedirector {
115117
fun Project.configure() {
116118
checkRedirect(repositories, displayName)
117119
}
120+
121+
@JvmStatic
122+
fun maybeRedirect(url: String): String {
123+
if (!cacheRedirectorEnabled) return url
124+
return URI(url).maybeRedirect()?.toString() ?: url
125+
}
126+
127+
@JvmStatic
128+
val isEnabled get() = cacheRedirectorEnabled
118129
}

buildSrc/src/main/kotlin/Java9Modularity.kt

+2
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ object Java9Modularity {
143143
attributes("Multi-Release" to true)
144144
}
145145
from(compileJavaModuleInfo) {
146+
// Include **only** file we are interested in as JavaCompile output also contains some tmp files
147+
include("module-info.class")
146148
into("META-INF/versions/9/")
147149
}
148150
}

gradle.properties

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
#
44

55
# Kotlin
6-
version=1.7.0-Beta-SNAPSHOT
6+
version=1.7.0-RC-SNAPSHOT
77
group=org.jetbrains.kotlinx
8-
kotlin_version=1.8.10
8+
kotlin_version=1.8.20
99

1010
# Dependencies
1111
junit_version=4.12
1212
junit5_version=5.7.0
13-
atomicfu_version=0.20.0
13+
atomicfu_version=0.20.2
1414
knit_version=0.4.0
1515
html_version=0.7.2
1616
lincheck_version=2.16
@@ -20,7 +20,7 @@ reactor_version=3.4.1
2020
reactive_streams_version=1.0.3
2121
rxjava2_version=2.2.8
2222
rxjava3_version=3.0.2
23-
javafx_version=11.0.2
23+
javafx_version=17.0.2
2424
javafx_plugin_version=0.0.8
2525
binary_compatibility_validator_version=0.12.0
2626
kover_version=0.6.1
@@ -30,7 +30,7 @@ jna_version=5.9.0
3030
# Android versions
3131
android_version=4.1.1.4
3232
androidx_annotation_version=1.1.0
33-
robolectric_version=4.4
33+
robolectric_version=4.9
3434
baksmali_version=2.2.7
3535

3636
# JS

integration-testing/gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
kotlin_version=1.8.10
2-
coroutines_version=1.7.0-Beta-SNAPSHOT
1+
kotlin_version=1.8.20
2+
coroutines_version=1.7.0-RC-SNAPSHOT
33
asm_version=9.3
44

55
kotlin.code.style=official
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package kotlinx.coroutines.validator
6+
7+
import org.junit.Test
8+
import org.objectweb.asm.*
9+
import org.objectweb.asm.ClassReader.*
10+
import org.objectweb.asm.ClassWriter.*
11+
import org.objectweb.asm.Opcodes.*
12+
import java.util.jar.*
13+
import kotlin.test.*
14+
15+
class MavenPublicationMetaInfValidator {
16+
17+
@Test
18+
fun testMetaInfCoreStructure() {
19+
val clazz = Class.forName("kotlinx.coroutines.Job")
20+
JarFile(clazz.protectionDomain.codeSource.location.file).checkMetaInfStructure(
21+
setOf(
22+
"MANIFEST.MF",
23+
"kotlinx-coroutines-core.kotlin_module",
24+
"com.android.tools/proguard/coroutines.pro",
25+
"com.android.tools/r8/coroutines.pro",
26+
"proguard/coroutines.pro",
27+
"versions/9/module-info.class",
28+
"kotlinx_coroutines_core.version"
29+
)
30+
)
31+
}
32+
33+
@Test
34+
fun testMetaInfAndroidStructure() {
35+
val clazz = Class.forName("kotlinx.coroutines.android.HandlerDispatcher")
36+
JarFile(clazz.protectionDomain.codeSource.location.file).checkMetaInfStructure(
37+
setOf(
38+
"MANIFEST.MF",
39+
"kotlinx-coroutines-android.kotlin_module",
40+
"services/kotlinx.coroutines.CoroutineExceptionHandler",
41+
"services/kotlinx.coroutines.internal.MainDispatcherFactory",
42+
"com.android.tools/r8-from-1.6.0/coroutines.pro",
43+
"com.android.tools/r8-upto-3.0.0/coroutines.pro",
44+
"com.android.tools/proguard/coroutines.pro",
45+
"proguard/coroutines.pro",
46+
"versions/9/module-info.class",
47+
"kotlinx_coroutines_android.version"
48+
)
49+
)
50+
}
51+
52+
private fun JarFile.checkMetaInfStructure(expected: Set<String>) {
53+
val actual = HashSet<String>()
54+
for (e in entries()) {
55+
if (e.isDirectory() || !e.realName.contains("META-INF")) {
56+
continue
57+
}
58+
val partialName = e.realName.substringAfter("META-INF/")
59+
actual.add(partialName)
60+
}
61+
62+
if (actual != expected) {
63+
val intersection = actual.intersect(expected)
64+
val mismatch = actual.subtract(intersection) + expected.subtract(intersection)
65+
fail("Mismatched files: " + mismatch)
66+
}
67+
68+
close()
69+
}
70+
}

kotlinx-coroutines-core/build.gradle

+3-6
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,6 @@ static void configureJvmForLincheck(task, additional = false) {
312312
task moreTest(dependsOn: [jvmStressTest, jvmLincheckTest, jvmLincheckTestAdditional])
313313
check.dependsOn moreTest
314314

315-
tasks.jvmLincheckTest {
316-
kover {
317-
enabled = false // Always disabled, lincheck doesn't really support coverage
318-
}
319-
}
320-
321315
def commonKoverExcludes =
322316
["kotlinx.coroutines.debug.*", // Tested by debug module
323317
"kotlinx.coroutines.channels.ChannelsKt__DeprecatedKt.*", // Deprecated
@@ -326,6 +320,9 @@ def commonKoverExcludes =
326320
]
327321

328322
kover {
323+
instrumentation {
324+
excludeTasks.add("jvmLincheckTest") // Always disabled, lincheck doesn't really support coverage
325+
}
329326
filters {
330327
classes {
331328
excludes.addAll(commonKoverExcludes)

kotlinx-coroutines-core/common/src/JobSupport.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
208208
assert { state.isCompleting } // consistency check -- must be marked as completing
209209
val proposedException = (proposedUpdate as? CompletedExceptionally)?.cause
210210
// Create the final exception and seal the state so that no more exceptions can be added
211-
var wasCancelling = false // KLUDGE: we cannot have contract for our own expect fun synchronized
211+
val wasCancelling: Boolean
212212
val finalException = synchronized(state) {
213213
wasCancelling = state.isCancelling
214214
val exceptions = state.sealLocked(proposedException)

0 commit comments

Comments
 (0)