Skip to content

Commit d39ffed

Browse files
committed
Merge branch 'develop' into pr/890
2 parents bd025ed + 6687406 commit d39ffed

File tree

624 files changed

+11710
-2383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

624 files changed

+11710
-2383
lines changed

CHANGES.md

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

3+
## Version 1.2.0
4+
5+
* Kotlin updated to 1.3.30.
6+
* New API: `CancellableContinuation.resume` with `onCancelling` lambda (#1044) to consistently handle closeable resources.
7+
* Play services task version updated to 16.0.1.
8+
* `ReceiveChannel.isEmpty` is no longer deprecated
9+
10+
A lot of `Flow` improvements:
11+
* Purity property is renamed to context preservation and became more restrictive.
12+
* `zip` and `combineLatest` operators.
13+
* Integration with RxJava2
14+
* `flatMap`, `merge` and `concatenate` are replaced with `flattenConcat`, `flattenMerge`, `flatMapConcat` and `flatMapMerge`.
15+
* Various documentation improvements and minor bug fixes.
16+
17+
Note that `Flow` **is not** leaving its [preview status](/docs/compatibility.md#flow-preview-api).
18+
19+
## Version 1.2.0-alpha-2
20+
21+
This release contains major [feature preview](/docs/compatibility.md#flow-preview-api): cold streams aka `Flow` (#254).
22+
23+
Performance:
24+
* Performance of `Dispatcher.Main` initialization is significantly improved (#878).
25+
26+
## Version 1.2.0-alpha
27+
28+
* Major debug agent improvements. Real stacktraces are merged with coroutine stacktraces for running coroutines, merging heuristic is improved, API is cleaned up and is on its road to stabilization (#997).
29+
* `CoroutineTimeout` rule or JUnit4 is introduced to simplify coroutines debugging (#938).
30+
* Stacktrace recovery improvements. Exceptions with custom properties are no longer copied, `CopyableThrowable` interface is introduced, machinery is [documented](https://github.com/Kotlin/kotlinx.coroutines/blob/develop/docs/debugging.md) (#921, #950).
31+
* `Dispatchers.Unconfined`, `MainCoroutineDispatcher.immediate`, `MainScope` and `CoroutineScope.cancel` are promoted to stable API (#972).
32+
* `CompletableJob` is introduced (#971).
33+
* Structured concurrency is integrated into futures and listenable futures (#1008).
34+
* `ensurePresent` and `isPresent` extensions for `ThreadLocal` (#1028).
35+
* `ensureActive` extensions for `CoroutineContext`, `CoroutineScope` and `Job` (#963).
36+
* `SendChannel.isFull` and `ReceiveChannel.isEmpty` are deprecated (#1053).
37+
* `withContext` checks cancellation on entering (#962).
38+
* Operator `invoke` on `CoroutineDispatcher` (#428).
39+
* Java 8 extensions for `delay` and `withTimeout` now properly handle too large values (#428).
40+
* A global exception handler for fatal exceptions in coroutines is introduced (#808, #773).
41+
* Major improvements in cancellation machinery and exceptions delivery consistency. Cancel with custom exception is completely removed.
42+
* Kotlin version is updated to 1.3.21.
43+
* Do not use private API on newer Androids to handle exceptions (#822).
44+
45+
Bug fixes:
46+
* Proper `select` support in debug agent (#931).
47+
* Proper `supervisorScope` support in debug agent (#915).
48+
* Throwing `initCause` does no longer trigger an internal error (#933).
49+
* Lazy actors are started when calling `close` in order to cleanup their resources (#939).
50+
* Minor bugs in reactive integrations are fixed (#1008).
51+
* Experimental scheduler shutdown sequence is fixed (#990).
52+
353
## Version 1.1.1
454

555
* Maintenance release, no changes in the codebase
@@ -184,7 +234,7 @@ Visible consequences of include more robust exception handling for large corouti
184234
* Introduced IO dispatcher to offload blocking I/O-intensive tasks (see #79).
185235
* Introduced `ExecutorCoroutineDispatcher` instead of `CloseableCoroutineDispatcher` (see #385).
186236
* Built with Kotlin 1.2.61 and Kotlin/Native 0.8.2.
187-
* JAR files for `kotlinx-coroutines` are now [JEP 238](http://openjdk.java.net/jeps/238) multi-release JAR files.
237+
* JAR files for `kotlinx-coroutines` are now [JEP 238](https://openjdk.java.net/jeps/238) multi-release JAR files.
188238
* On JDK9+ `VarHandle` is used for atomic operations instead of `Atomic*FieldUpdater` for better performance.
189239
* See [AtomicFu](https://github.com/Kotlin/kotlinx.atomicfu/blob/master/README.md) project for details.
190240
* Reversed addition of `BlockingChecker` extension point to control where `runBlocking` can be used (see #227).
@@ -221,7 +271,7 @@ Visible consequences of include more robust exception handling for large corouti
221271
* Includes multiple fixes to documentation contributed by @paolop, @SahilLone, @rocketraman, @bdavisx, @mtopolnik, @Groostav.
222272
* Experimental coroutines scheduler preview (JVM only):
223273
* Written from scratch and optimized for communicating coroutines.
224-
* Performs significantly better than ForkJoinPool on coroutine benchmarks and for connected applications with [ktor](http://ktor.io).
274+
* Performs significantly better than ForkJoinPool on coroutine benchmarks and for connected applications with [ktor](https://ktor.io).
225275
* Supports automatic creating of new threads for blocking operations running on the same thread pool (with an eye on solving #79), but there is no stable public API for it just yet.
226276
* For preview, run JVM with `-Dkotlinx.coroutines.scheduler` option. In this case `DefaultDispatcher` is set to new experimental scheduler instead of FJP-based `CommonPool`.
227277
* Submit your feedback to issue #261.
@@ -514,7 +564,7 @@ Visible consequences of include more robust exception handling for large corouti
514564
* Fixed bug in internal class LockFreeLinkedList that resulted in ISE under stress in extremely rare circumstances.
515565
* Integrations:
516566
* [quasar](integration/kotlinx-coroutines-quasar): Introduced integration with suspendable JVM functions
517-
that are instrumented with [Parallel Universe Quasar](http://docs.paralleluniverse.co/quasar/)
567+
that are instrumented with [Parallel Universe Quasar](https://docs.paralleluniverse.co/quasar/)
518568
(thanks to the help of @pron).
519569
* [reactor](reactive/kotlinx-coroutines-reactor): Replaced deprecated `setCancellation` with `onDipose` and
520570
updated to Aluminium-SR3 release (courtesy of @yxf07, see #96)

COMPATIBILITY.md

-25
This file was deleted.

README.md

+62-30
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
# kotlinx.coroutines
22

3-
[![official JetBrains project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
4-
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
5-
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.1.1) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.1.1)
3+
[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
4+
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
5+
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.2.0) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.2.0)
66

77
Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
8-
This is a companion version for Kotlin `1.3.20` release.
9-
10-
**NOTE**: `0.30.2` was the last release with Kotlin 1.2 and experimental coroutines.
11-
See [COMPATIBILITY.md](COMPATIBILITY.md) for details of migration onto the stable Kotlin 1.3 coroutines.
8+
This is a companion version for Kotlin `1.3.30` release.
129

1310
```kotlin
14-
GlobalScope.launch {
15-
delay(1000)
16-
println("Hello from Kotlin Coroutines!")
11+
suspend fun main() = coroutineScope {
12+
launch {
13+
delay(1000)
14+
println("Kotlin Coroutines World!")
15+
}
16+
println("Hello")
1717
}
1818
```
1919

20+
> Play with coroutines online [here](https://pl.kotl.in/hG_tKbid_)
21+
2022
## Modules
2123

22-
* [common](common/README.md) — common coroutines across all platforms:
24+
* [core](kotlinx-coroutines-core/README.md) — common coroutines across all platforms:
2325
* `launch` and `async` coroutine builders;
2426
* `Job` and `Deferred` light-weight future with cancellation support;
2527
* `MainScope` for Android and UI applications.
@@ -29,15 +31,17 @@ GlobalScope.launch {
2931
* `coroutineScope` and `supervisorScope` scope builders;
3032
* `SupervisorJob` and `CoroutineExceptionHandler` for supervision of coroutines hierarchies;
3133
* `select` expression support and more.
32-
* [core](core/README.md) — Kotlin/JVM implementation of common coroutines with additional features:
34+
* [core/jvm](kotlinx-coroutines-core/jvm/) — additional core features available on Kotlin/JVM:
3335
* `Dispatchers.IO` dispatcher for blocking coroutines;
3436
* `Executor.asCoroutineDispatcher()` extension, custom thread pools, and more.
35-
* [test](core/README.md) — test utilities for coroutines
37+
* [core/js](kotlinx-coroutines-core/js/) — additional core features available on Kotlin/JS:
38+
* Integration with `Promise`;
39+
* Integration with `Window`.
40+
* [test](kotlinx-coroutines-test/README.md) — test utilities for coroutines
3641
* `Dispatchers.setMain` to override `Dispatchers.Main` in tests.
37-
* [debug](core/README.md) — debug utilities for coroutines.
42+
* [debug](kotlinx-coroutines-debug/README.md) — debug utilities for coroutines.
3843
* `DebugProbes` API to probe, keep track of, print and dump active coroutines.
39-
* [js](js/README.md) — Kotlin/JS implementation of common coroutines with `Promise` support.
40-
* [native](native/README.md) — Kotlin/Native implementation of common coroutines with `runBlocking` single-threaded event loop.
44+
* `CoroutinesTimeout` test rule to automatically dump coroutines on test timeout.
4145
* [reactive](reactive/README.md) — modules that provide builders and iteration support for various reactive streams libraries:
4246
* Reactive Streams, RxJava 2.x, and Project Reactor.
4347
* [ui](ui/README.md) — modules that provide coroutine dispatchers for various single-threaded UI libraries:
@@ -53,12 +57,14 @@ GlobalScope.launch {
5357
* [Deep dive into Coroutines](https://www.youtube.com/watch?v=YrrUCSi72E8) (Roman Elizarov at KotlinConf 2017, [slides](https://www.slideshare.net/elizarov/deep-dive-into-coroutines-on-jvm-kotlinconf-2017))
5458
* [Kotlin Coroutines in Practice](https://www.youtube.com/watch?v=a3agLJQ6vt8) (Roman Elizarov at KotlinConf 2018, [slides](https://www.slideshare.net/elizarov/kotlin-coroutines-in-practice-kotlinconf-2018))
5559
* Guides and manuals:
56-
* [Guide to kotlinx.coroutines by example](docs/coroutines-guide.md) (**read it first**)
60+
* [Guide to kotlinx.coroutines by example](https://kotlinlang.org/docs/reference/coroutines/coroutines-guide.html) (**read it first**)
5761
* [Guide to UI programming with coroutines](ui/coroutines-guide-ui.md)
5862
* [Guide to reactive streams with coroutines](reactive/coroutines-guide-reactive.md)
63+
* [Debugging capabilities in kotlinx.coroutines](docs/debugging.md)
64+
* [Compatibility policy and experimental annotations](docs/compatibility.md)
5965
* [Change log for kotlinx.coroutines](CHANGES.md)
6066
* [Coroutines design document (KEEP)](https://github.com/Kotlin/KEEP/blob/master/proposals/coroutines.md)
61-
* [Full kotlinx.coroutines API reference](http://kotlin.github.io/kotlinx.coroutines)
67+
* [Full kotlinx.coroutines API reference](https://kotlin.github.io/kotlinx.coroutines)
6268

6369
## Using in your projects
6470

@@ -74,15 +80,15 @@ Add dependencies (you can also add other modules that you need):
7480
<dependency>
7581
<groupId>org.jetbrains.kotlinx</groupId>
7682
<artifactId>kotlinx-coroutines-core</artifactId>
77-
<version>1.1.1</version>
83+
<version>1.2.0</version>
7884
</dependency>
7985
```
8086

8187
And make sure that you use the latest Kotlin version:
8288

8389
```xml
8490
<properties>
85-
<kotlin.version>1.3.20</kotlin.version>
91+
<kotlin.version>1.3.30</kotlin.version>
8692
</properties>
8793
```
8894

@@ -92,15 +98,15 @@ Add dependencies (you can also add other modules that you need):
9298

9399
```groovy
94100
dependencies {
95-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1'
101+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.0'
96102
}
97103
```
98104

99105
And make sure that you use the latest Kotlin version:
100106

101107
```groovy
102108
buildscript {
103-
ext.kotlin_version = '1.3.20'
109+
ext.kotlin_version = '1.3.30'
104110
}
105111
```
106112

@@ -118,15 +124,15 @@ Add dependencies (you can also add other modules that you need):
118124

119125
```groovy
120126
dependencies {
121-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1")
127+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.0")
122128
}
123129
```
124130

125131
And make sure that you use the latest Kotlin version:
126132

127133
```groovy
128134
plugins {
129-
kotlin("jvm") version "1.3.20"
135+
kotlin("jvm") version "1.3.30"
130136
}
131137
```
132138

@@ -135,19 +141,20 @@ Make sure that you have either `jcenter()` or `mavenCentral()` in the list of re
135141
### Multiplatform
136142

137143
Core modules of `kotlinx.coroutines` are also available for
138-
[Kotlin/JS](js/README.md) and [Kotlin/Native](native/README.md). If you write
139-
a common code that should get compiled or different platforms, add
140-
[`org.jetbrains.kotlinx:kotlinx-coroutines-core-common:<version>`](common/kotlinx-coroutines-core-common/README.md)
141-
to your common code dependencies.
144+
[Kotlin/JS](#js) and [Kotlin/Native](#native).
145+
In common code that should get compiled for different platforms, add dependency to
146+
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.2.0/jar)
147+
(follow the link to get the dependency declaration snippet).
142148

143149
### Android
144150

145151
Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
146152
module as dependency when using `kotlinx.coroutines` on Android:
147153

148154
```groovy
149-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
155+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.0'
150156
```
157+
151158
This gives you access to Android [Dispatchers.Main](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-android/kotlinx.coroutines.android/kotlinx.coroutines.-dispatchers/index.html)
152159
coroutine dispatcher and also makes sure that in case of crashed coroutine with unhandled exception this
153160
exception is logged before crashing Android application, similarly to the way uncaught exceptions in
@@ -157,10 +164,35 @@ threads are handled by Android runtime.
157164

158165
For R8 no actions required, it will take obfuscation rules from the jar.
159166

160-
For Proguard you need to add options from [coroutines.pro](core/kotlinx-coroutines-core/resources/META-INF/proguard/coroutines.pro) to your rules manually.
167+
For Proguard you need to add options from [coroutines.pro](kotlinx-coroutines-core/jvm/resources/META-INF/proguard/coroutines.pro) to your rules manually.
161168

162169
R8 is a replacement for ProGuard in Android ecosystem, it is enabled by default since Android gradle plugin 3.3.0-beta.
163170

171+
### JS
172+
173+
[Kotlin/JS](https://kotlinlang.org/docs/reference/js-overview.html) version of `kotlinx.coroutines` is published as
174+
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.2.0/jar)
175+
(follow the link to get the dependency declaration snippet).
176+
177+
You can also use [`kotlinx-coroutines-core`](https://www.npmjs.com/package/kotlinx-coroutines-core) package via NPM.
178+
179+
### Native
180+
181+
[Kotlin/Native](https://kotlinlang.org/docs/reference/native-overview.html) version of `kotlinx.coroutines` is published as
182+
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.2.0/jar)
183+
(follow the link to get the dependency declaration snippet).
184+
185+
Only single-threaded code (JS-style) on Kotlin/Native is currently supported.
186+
Kotlin/Native supports only Gradle version 4.10 and you need to enable Gradle metadata in your
187+
`settings.gradle` file:
188+
189+
```groovy
190+
enableFeaturePreview('GRADLE_METADATA')
191+
```
192+
193+
Since Kotlin/Native does not generally provide binary compatibility between versions,
194+
you should use the same version of Kotlin/Native compiler as was used to build `kotlinx.coroutines`.
195+
164196
## Building
165197

166198
This library is built with Gradle. To build it, use `./gradlew build`.

RELEASE.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ To release new `<version>` of `kotlinx-coroutines`:
4949
* Wait until "Build" configuration for committed `master` branch passes tests.
5050
* Run "Deploy (Configure, RUN THIS ONE)" configuration with the corresponding new version.
5151

52-
2. In [GitHub](http://github.com/kotlin/kotlinx.coroutines) interface:
52+
2. In [GitHub](https://github.com/kotlin/kotlinx.coroutines) interface:
5353
* Create new release named as `<version>`.
5454
* Cut & paste lines from [`CHANGES.md`](CHANGES.md) into description.
5555

@@ -61,16 +61,20 @@ To release new `<version>` of `kotlinx-coroutines`:
6161
* Wait until newly published version becomes the most recent.
6262
* Sync to Maven Central.
6363

64-
5. Announce new release in [Slack](http://kotlinlang.slack.com)
64+
5. Announce new release in [Slack](https://kotlinlang.slack.com)
6565

66-
6. Switch into `develop` branch:<br>
66+
6. Create a ticket to update coroutines version on [try.kotlinlang.org](try.kotlinlang.org).
67+
* Use [KT-30870](https://youtrack.jetbrains.com/issue/KT-30870) as a template
68+
* This step should be skipped for eap versions that are not merged to `master`
69+
70+
7. Switch into `develop` branch:<br>
6771
`git checkout develop`
6872

69-
7. Fetch the latest `master`:<br>
73+
8. Fetch the latest `master`:<br>
7074
`git fetch`
7175

72-
8. Merge release from `master`:<br>
76+
9. Merge release from `master`:<br>
7377
`git merge origin/master`
7478

75-
9. Push updates to `develop`:<br>
79+
10. Push updates to `develop`:<br>
7680
`git push`

0 commit comments

Comments
 (0)