Skip to content

Commit 42f24b7

Browse files
author
Nikita Koval
committed
Merge branch 'develop' into new-channels-select
2 parents 3b738e5 + 4262e3f commit 42f24b7

File tree

37 files changed

+632
-170
lines changed

37 files changed

+632
-170
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change log for kotlinx.coroutines
22

3+
## Version 1.6.3
4+
5+
* Updated atomicfu version to 0.17.3 (#3321), fixing the projects using this library with JS IR failing to build (#3305).
6+
37
## Version 1.6.2
48

59
* Fixed a bug with `ThreadLocalElement` not being correctly updated when the most outer `suspend` function was called directly without `kotlinx.coroutines` (#2930).

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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.6.2)](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.6.2/pom)
6+
[![Download](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.6.3)](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.6.3/pom)
77
[![Kotlin](https://img.shields.io/badge/kotlin-1.6.0-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

@@ -84,15 +84,15 @@ Add dependencies (you can also add other modules that you need):
8484
<dependency>
8585
<groupId>org.jetbrains.kotlinx</groupId>
8686
<artifactId>kotlinx-coroutines-core</artifactId>
87-
<version>1.6.2</version>
87+
<version>1.6.3</version>
8888
</dependency>
8989
```
9090

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

9393
```xml
9494
<properties>
95-
<kotlin.version>1.6.20</kotlin.version>
95+
<kotlin.version>1.6.21</kotlin.version>
9696
</properties>
9797
```
9898

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

103103
```kotlin
104104
dependencies {
105-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
105+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3")
106106
}
107107
```
108108

@@ -111,10 +111,10 @@ And make sure that you use the latest Kotlin version:
111111
```kotlin
112112
plugins {
113113
// For build.gradle.kts (Kotlin DSL)
114-
kotlin("jvm") version "1.6.20"
114+
kotlin("jvm") version "1.6.21"
115115

116116
// For build.gradle (Groovy DSL)
117-
id "org.jetbrains.kotlin.jvm" version "1.6.20"
117+
id "org.jetbrains.kotlin.jvm" version "1.6.21"
118118
}
119119
```
120120

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

134134
```kotlin
135-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2")
135+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.3")
136136
```
137137

138138
This gives you access to the Android [Dispatchers.Main]
@@ -167,7 +167,7 @@ In common code that should get compiled for different platforms, you can add a d
167167
```kotlin
168168
commonMain {
169169
dependencies {
170-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
170+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3")
171171
}
172172
}
173173
```
@@ -179,7 +179,7 @@ Platform-specific dependencies are recommended to be used only for non-multiplat
179179
#### JS
180180

181181
Kotlin/JS version of `kotlinx.coroutines` is published as
182-
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.6.2/jar)
182+
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.6.3/jar)
183183
(follow the link to get the dependency declaration snippet) and as [`kotlinx-coroutines-core`](https://www.npmjs.com/package/kotlinx-coroutines-core) NPM package.
184184

185185
#### Native

buildSrc/src/main/kotlin/Projects.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ val testModule = "kotlinx-coroutines-test"
1212

1313
val multiplatform = setOf(coreModule, testModule)
1414
// Not applicable for Kotlin plugin
15-
val sourceless = setOf("kotlinx.coroutines", "kotlinx-coroutines-bom", "integration-testing")
16-
val internal = setOf("kotlinx.coroutines", "benchmarks", "integration-testing")
15+
val sourceless = setOf("kotlinx.coroutines", "kotlinx-coroutines-bom")
16+
val internal = setOf("kotlinx.coroutines", "benchmarks")
1717
// Not published
1818
val unpublished = internal + setOf("example-frontend-js", "android-unit-tests")
1919

bump-version.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ update_version "kotlinx-coroutines-debug/README.md"
2121
update_version "kotlinx-coroutines-test/README.md"
2222
update_version "ui/coroutines-guide-ui.md"
2323
update_version "gradle.properties"
24+
update_version "integration-test/gradle.properties"
2425

2526
# Escape dots, e.g. 1.0.0 -> 1\.0\.0
2627
escaped_old_version=$(echo $old_version | sed s/[.]/\\\\./g)

docs/topics/cancellation-and-timeouts.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fun main() = runBlocking {
137137

138138
While catching `Exception` is an anti-pattern, this issue may surface in more subtle ways, like when using the
139139
[`runCatching`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/run-catching.html) function,
140-
which does not know rethrow [CancellationException].
140+
which does not rethrow [CancellationException].
141141

142142
## Making computation code cancellable
143143

@@ -190,8 +190,8 @@ main: Now I can quit.
190190

191191
## Closing resources with `finally`
192192

193-
Cancellable suspending functions throw [CancellationException] on cancellation which can be handled in
194-
the usual way. For example, `try {...} finally {...}` expression and Kotlin `use` function execute their
193+
Cancellable suspending functions throw [CancellationException] on cancellation, which can be handled in
194+
the usual way. For example, the `try {...} finally {...}` expression and Kotlin's `use` function execute their
195195
finalization actions normally when a coroutine is cancelled:
196196

197197
```kotlin
@@ -423,13 +423,13 @@ fun main() {
423423
If you run the above code you'll see that it does not always print zero, though it may depend on the timings
424424
of your machine you may need to tweak timeouts in this example to actually see non-zero values.
425425

426-
> Note, that incrementing and decrementing `acquired` counter here from 100K coroutines is completely safe,
426+
> Note that incrementing and decrementing `acquired` counter here from 100K coroutines is completely safe,
427427
> since it always happens from the same main thread. More on that will be explained in the chapter
428428
> on coroutine context.
429429
>
430430
{type="note"}
431431

432-
To workaround this problem you can store a reference to the resource in the variable as opposed to returning it
432+
To work around this problem you can store a reference to the resource in the variable as opposed to returning it
433433
from the `withTimeout` block.
434434

435435
```kotlin

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
#
44

55
# Kotlin
6-
version=1.6.2-SNAPSHOT
6+
version=1.6.3-SNAPSHOT
77
group=org.jetbrains.kotlinx
88
kotlin_version=1.6.21
99

1010
# Dependencies
1111
junit_version=4.12
1212
junit5_version=5.7.0
13-
atomicfu_version=0.17.2
13+
atomicfu_version=0.17.3
1414
knit_version=0.4.0
1515
html_version=0.7.2
1616
lincheck_version=2.14.1

integration-testing/README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Integration tests
22

3-
This is a supplementary subproject of kotlinx.coroutines that provides
4-
integration tests.
3+
This is a supplementary project that provides integration tests.
54

65
The tests are the following:
7-
* `NpmPublicationValidator` tests that version of NPM artifact is correct and that it has neither source nor package dependencies on atomicfu
8-
In order for the test to work, one needs to run gradle with `-PdryRun=true`.
9-
`-PdryRun` affects `npmPublish` so that it only provides a packed publication
10-
and does not in fact attempt to send the build for publication.
11-
* `MavenPublicationValidator` depends on the published artifacts and tests artifacts binary content and absence of atomicfu in the classpath
6+
* `MavenPublicationValidator` depends on the published artifacts and tests artifacts binary content and absence of atomicfu in the classpath.
7+
* `CoreAgentTest` checks that `kotlinx-coroutines-core` can be run as a Java agent.
128
* `DebugAgentTest` checks that the coroutine debugger can be run as a Java agent.
9+
* `smokeTest` builds the test project that depends on coroutines.
1310

14-
All the available tests can be run with `integration-testing:test`.
11+
The `integration-testing` project is expected to be in a subdirectory of the main `kotlinx.coroutines` project.
12+
13+
To run all the available tests: `cd integration-testing` + `./gradlew check`.

integration-testing/build.gradle

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,62 @@
55
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
66

77
plugins {
8-
id("kotlin-jvm-conventions")
8+
id "org.jetbrains.kotlin.jvm"
99
}
1010

1111
repositories {
1212
mavenLocal()
1313
mavenCentral()
1414
}
1515

16+
java {
17+
sourceCompatibility = JavaVersion.VERSION_1_8
18+
targetCompatibility = JavaVersion.VERSION_1_8
19+
}
20+
21+
dependencies {
22+
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
23+
}
24+
1625
sourceSets {
17-
npmTest {
26+
withGuavaTest {
1827
kotlin
1928
compileClasspath += sourceSets.test.runtimeClasspath
2029
runtimeClasspath += sourceSets.test.runtimeClasspath
30+
31+
dependencies {
32+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
33+
implementation 'com.google.guava:guava:31.1-jre'
34+
}
2135
}
2236
mavenTest {
2337
kotlin
2438
compileClasspath += sourceSets.test.runtimeClasspath
2539
runtimeClasspath += sourceSets.test.runtimeClasspath
40+
41+
dependencies {
42+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
43+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
44+
}
2645
}
2746
debugAgentTest {
2847
kotlin
2948
compileClasspath += sourceSets.test.runtimeClasspath
3049
runtimeClasspath += sourceSets.test.runtimeClasspath
31-
}
3250

51+
dependencies {
52+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
53+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-debug:$coroutines_version"
54+
}
55+
}
3356
coreAgentTest {
3457
kotlin
3558
compileClasspath += sourceSets.test.runtimeClasspath
3659
runtimeClasspath += sourceSets.test.runtimeClasspath
60+
61+
dependencies {
62+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
63+
}
3764
}
3865
}
3966

@@ -43,70 +70,41 @@ compileDebugAgentTestKotlin {
4370
}
4471
}
4572

46-
task npmTest(type: Test) {
47-
def sourceSet = sourceSets.npmTest
48-
environment "projectRoot", project.rootDir
49-
environment "deployVersion", version
50-
def dryRunNpm = project.properties['dryRun']
51-
def doRun = dryRunNpm == "true" // so that we don't accidentally publish anything, especially before the test
52-
onlyIf { doRun }
53-
if (doRun) { // `onlyIf` only affects execution of the task, not the dependency subtree
54-
dependsOn(project(':').getTasksByName("publishNpm", true))
55-
}
73+
task withGuavaTest(type: Test) {
74+
environment "version", coroutines_version
75+
def sourceSet = sourceSets.withGuavaTest
5676
testClassesDirs = sourceSet.output.classesDirs
5777
classpath = sourceSet.runtimeClasspath
5878
}
5979

6080
task mavenTest(type: Test) {
61-
environment "version", version
81+
environment "version", coroutines_version
6282
def sourceSet = sourceSets.mavenTest
63-
dependsOn(project(':').getTasksByName("publishToMavenLocal", true))
6483
testClassesDirs = sourceSet.output.classesDirs
6584
classpath = sourceSet.runtimeClasspath
66-
// we can't depend on the subprojects because we need to test the classfiles that are published in the end.
67-
// also, we can't put this in the `dependencies` block because the resolution would happen before publication.
68-
def mavenTestClasspathConfiguration = project.configurations.detachedConfiguration(
69-
project.dependencies.create("org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"),
70-
project.dependencies.create("org.jetbrains.kotlinx:kotlinx-coroutines-android:$version"))
71-
72-
mavenTestClasspathConfiguration.attributes {
73-
attribute(KotlinPlatformType.attribute, KotlinPlatformType.jvm)
74-
}
75-
76-
classpath += mavenTestClasspathConfiguration
7785
}
7886

7987
task debugAgentTest(type: Test) {
8088
def sourceSet = sourceSets.debugAgentTest
81-
dependsOn(project(':kotlinx-coroutines-debug').shadowJar)
82-
jvmArgs ('-javaagent:' + project(':kotlinx-coroutines-debug').shadowJar.outputs.files.getFiles()[0])
89+
def coroutinesDebugJar = sourceSet.runtimeClasspath.filter {it.name == "kotlinx-coroutines-debug-${coroutines_version}.jar" }.singleFile
90+
jvmArgs ('-javaagent:' + coroutinesDebugJar)
8391
testClassesDirs = sourceSet.output.classesDirs
8492
classpath = sourceSet.runtimeClasspath
8593
systemProperties project.properties.subMap(["overwrite.probes"])
8694
}
8795

8896
task coreAgentTest(type: Test) {
8997
def sourceSet = sourceSets.coreAgentTest
90-
dependsOn(project(':kotlinx-coroutines-core').jvmJar)
91-
jvmArgs ('-javaagent:' + project(':kotlinx-coroutines-core').jvmJar.outputs.files.getFiles()[0])
98+
def coroutinesCoreJar = sourceSet.runtimeClasspath.filter {it.name == "kotlinx-coroutines-core-jvm-${coroutines_version}.jar" }.singleFile
99+
jvmArgs ('-javaagent:' + coroutinesCoreJar)
92100
testClassesDirs = sourceSet.output.classesDirs
93101
classpath = sourceSet.runtimeClasspath
94102
}
95103

96-
dependencies {
97-
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
98-
testImplementation 'junit:junit:4.12'
99-
npmTestImplementation 'org.apache.commons:commons-compress:1.18'
100-
npmTestImplementation 'com.google.code.gson:gson:2.8.5'
101-
debugAgentTestImplementation project(':kotlinx-coroutines-core')
102-
debugAgentTestImplementation project(':kotlinx-coroutines-debug')
103-
coreAgentTestImplementation project(':kotlinx-coroutines-core')
104-
}
105-
106104
compileTestKotlin {
107105
kotlinOptions.jvmTarget = "1.8"
108106
}
109107

110108
check {
111-
dependsOn([npmTest, mavenTest, debugAgentTest, coreAgentTest])
109+
dependsOn([withGuavaTest, mavenTest, debugAgentTest, coreAgentTest, 'smokeTest:build'])
112110
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
kotlin_version=1.6.21
2+
coroutines_version=1.6.3-SNAPSHOT
3+
4+
kotlin.code.style=official
58.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)