Skip to content
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

Version 1.3.6 #2001

Merged
merged 42 commits into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e8705fe
Remove unused AbstractChannel.describeSendConflated
elizarov Mar 18, 2020
3fdd3fe
Refactor select impl to make its internal state easier to understand
elizarov Mar 19, 2020
5b610bb
Fix publication validator not looking in the local maven repository (…
dkhalanskyjb Mar 27, 2020
9cbad7d
Enable strict explicit mode (#1877)
qwwdfsad Mar 27, 2020
96b41b4
Fix DefaultExecutor not being able to exit (#1876)
dkhalanskyjb Mar 30, 2020
52dcddc
Merge remote-tracking branch 'origin/master' into develop
elizarov Mar 31, 2020
6e66695
Fix leak of subscription reference in closed ArrayBroadcastChannel (#…
elizarov Mar 31, 2020
df8316f
Update CoroutineScope docs (#1882)
elizarov Apr 6, 2020
02b403d
BlockHound integration (#1873)
dkhalanskyjb Apr 6, 2020
de29acd
Flow onEmpty (#1904)
qwwdfsad Apr 7, 2020
532368f
Update Kotlin version to 1.3.71 (#1906)
qwwdfsad Apr 7, 2020
d75d02a
Make the list of segments more abstract (#1563)
ndkoval Apr 10, 2020
5eaf83c
Fix in gradle for JS IR in case it doesn't exist (#1912)
Apr 13, 2020
94970df
Improve docs for CoroutineExceptionHandler (#1886)
elizarov Apr 22, 2020
dc8eeb0
Migrate to androidx.annotation from legacy android.support.annotion (…
elizarov Apr 22, 2020
ac42be9
Add linearizability tests for Mutex and Semaphore and fix them (#1898)
ndkoval Apr 23, 2020
bd7ac85
Merge remote-tracking branch 'origin/master' into develop
qwwdfsad Apr 24, 2020
70a7487
Extract debugger (#1905)
qwwdfsad Apr 24, 2020
64d23a0
Kotlin DSL. Add version extension (#1939)
turansky Apr 24, 2020
3250e47
Integration with RxJava3 (#1950)
qwwdfsad Apr 24, 2020
5073704
Remove unused Gradle wrapper (#1958)
turansky Apr 27, 2020
eb4e7d3
Breaking change: Experimental Flow.onCompletion contract for cause (#…
elizarov Apr 27, 2020
cd5ab49
Setup cancellation eagerly in suspendCancellableCoroutine to properly…
qwwdfsad Apr 27, 2020
515e86a
Add a lincheck test for `remove` in the segment list algorithm (#1964)
ndkoval Apr 28, 2020
5b00e48
Remove experimental status from Flow API (#1963)
qwwdfsad Apr 28, 2020
a8f4b64
Common java version method (#1965)
turansky Apr 28, 2020
76e6440
Gradle 6.3
h0tk3y Apr 17, 2020
52135fb
Fix JS example warnings (#1968)
turansky Apr 28, 2020
d5766f3
Revert "Gradle 6.3"
elizarov Apr 29, 2020
be85455
Fix class cast exception during undispatched resume of cancellable co…
qwwdfsad Apr 29, 2020
8d6e464
Support thread interrupting blocking functions (#1972)
qwwdfsad Apr 29, 2020
0f15812
Kts transition (#1951)
qwwdfsad Apr 29, 2020
9982979
Plugin versions in 'plugins' block (#1977)
turansky May 2, 2020
1beebf1
'reactor_vesion' -> 'reactor_veRsion' (#1976)
turansky May 2, 2020
de38890
Platform util in 'buildSrc' (#1969)
turansky May 2, 2020
18f68ad
Use standard random API (#1988)
turansky May 6, 2020
5ecebe1
Fix logic that determines future removal for scheduled executors (#1995)
elizarov May 7, 2020
134a4bc
Improve docs & code style in runInterruptibe (#1994)
elizarov May 7, 2020
171fcc1
Fix typos in comments to ticker channels (#1987)
vadimsemenov May 3, 2020
9291b00
Additional VCS configuration options
elizarov May 7, 2020
1541886
StateFlow implementation (#1974)
elizarov May 7, 2020
a922194
Version 1.3.6
qwwdfsad May 8, 2020
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
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Change log for kotlinx.coroutines

## Version 1.3.6

### Flow

* `StateFlow`, new primitive for state handling (#1973, #1816, #395). The `StateFlow` is designed to eventually replace `ConflatedBroadcastChannel` for state publication scenarios. Please, try it and share your feedback. Note, that Flow-based primitives to publish events will be added later. For events you should continue to either use `BroadcastChannel(1)`, if you put events into the `StateFlow`, protect them from double-processing with flags.
* `Flow.onEmpty` operator is introduced (#1890).
* Behavioural change in `Flow.onCompletion`, it is aligned with `invokeOnCompletion` now and passes `CancellationException` to its cause parameter (#1693).
* A lot of Flow operators have left its experimental status and are promoted to stable API.

### Other

* `runInterruptible` primitive to tie cancellation with thread interruption for blocking calls. Contributed by @jxdabc (#1947).
* Integration module with RxJava3 is introduced. Contributed by @ZacSweers (#1883)
* Integration with [BlockHound](https://github.com/reactor/BlockHound) in `kotlinx-coroutines-debug` module (#1821, #1060).
* Memory leak in ArrayBroadcastChannel is fixed (#1885).
* Behavioural change in `suspendCancellableCoroutine`, cancellation is established before invoking passed block argument (#1671).
* Debug agent internals are moved into `kotlinx-coroutines-core` for better integration with IDEA. It should not affect library users and all the redundant code should be properly eliminated with R8.
* ClassCastException with reusable continuations bug is fixed (#1966).
* More precise scheduler detection for `Executor.asCoroutineDispatcher` (#1992).
* Kotlin updated to 1.3.71.

## Version 1.3.5

* `firstOrNull` operator. Contributed by @bradynpoulsen.
Expand Down
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

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

Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
This is a companion version for Kotlin `1.3.70` release.
This is a companion version for Kotlin `1.3.71` release.

```kotlin
suspend fun main() = coroutineScope {
Expand Down Expand Up @@ -47,6 +47,7 @@ suspend fun main() = coroutineScope {
* Reactive Streams ([Publisher.collect], [Publisher.awaitSingle], [publish], etc),
* Flow (JDK 9) (the same interface as for Reactive Streams),
* RxJava 2.x ([rxFlowable], [rxSingle], etc), and
* RxJava 3.x ([rxFlowable], [rxSingle], etc), and
* Project Reactor ([flux], [mono], etc).
* [ui](ui/README.md) — modules that provide coroutine dispatchers for various single-threaded UI libraries:
* Android, JavaFX, and Swing.
Expand Down Expand Up @@ -83,15 +84,15 @@ Add dependencies (you can also add other modules that you need):
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>1.3.5</version>
<version>1.3.6</version>
</dependency>
```

And make sure that you use the latest Kotlin version:

```xml
<properties>
<kotlin.version>1.3.70</kotlin.version>
<kotlin.version>1.3.71</kotlin.version>
</properties>
```

Expand All @@ -101,15 +102,15 @@ Add dependencies (you can also add other modules that you need):

```groovy
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.6'
}
```

And make sure that you use the latest Kotlin version:

```groovy
buildscript {
ext.kotlin_version = '1.3.70'
ext.kotlin_version = '1.3.71'
}
```

Expand All @@ -127,15 +128,15 @@ Add dependencies (you can also add other modules that you need):

```groovy
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.6")
}
```

And make sure that you use the latest Kotlin version:

```groovy
plugins {
kotlin("jvm") version "1.3.70"
kotlin("jvm") version "1.3.71"
}
```

Expand All @@ -146,7 +147,7 @@ Make sure that you have either `jcenter()` or `mavenCentral()` in the list of re
Core modules of `kotlinx.coroutines` are also available for
[Kotlin/JS](#js) and [Kotlin/Native](#native).
In common code that should get compiled for different platforms, add dependency to
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.3.5/jar)
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.3.6/jar)
(follow the link to get the dependency declaration snippet).

### Android
Expand All @@ -155,7 +156,7 @@ Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
module as dependency when using `kotlinx.coroutines` on Android:

```groovy
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.6'
```

This gives you access to Android [Dispatchers.Main]
Expand All @@ -171,15 +172,15 @@ For more details see ["Optimization" section for Android](ui/kotlinx-coroutines-
### JS

[Kotlin/JS](https://kotlinlang.org/docs/reference/js-overview.html) version of `kotlinx.coroutines` is published as
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.3.5/jar)
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.3.6/jar)
(follow the link to get the dependency declaration snippet).

You can also use [`kotlinx-coroutines-core`](https://www.npmjs.com/package/kotlinx-coroutines-core) package via NPM.

### Native

[Kotlin/Native](https://kotlinlang.org/docs/reference/native-overview.html) version of `kotlinx.coroutines` is published as
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.3.5/jar)
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.3.6/jar)
(follow the link to get the dependency declaration snippet).

Only single-threaded code (JS-style) on Kotlin/Native is currently supported.
Expand Down Expand Up @@ -288,6 +289,8 @@ The `develop` branch is pushed to `master` during release.
<!--- INDEX kotlinx.coroutines.rx2 -->
[rxFlowable]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-rx2/kotlinx.coroutines.rx2/rx-flowable.html
[rxSingle]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-rx2/kotlinx.coroutines.rx2/rx-single.html
<!--- MODULE kotlinx-coroutines-rx2 -->
<!--- INDEX kotlinx.coroutines.rx2 -->
<!--- MODULE kotlinx-coroutines-reactor -->
<!--- INDEX kotlinx.coroutines.reactor -->
[flux]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-reactor/kotlinx.coroutines.reactor/flux.html
Expand Down
79 changes: 0 additions & 79 deletions benchmarks/build.gradle

This file was deleted.

85 changes: 85 additions & 0 deletions benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("net.ltgt.apt")
id("com.github.johnrengelman.shadow")
id("me.champeau.gradle.jmh")
}

repositories {
maven("https://repo.typesafe.com/typesafe/releases/")
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
}

tasks.compileJmhKotlin {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=enable"
}

/*
* Due to a bug in the inliner it sometimes does not remove inlined symbols (that are later renamed) from unused code paths,
* and it breaks JMH that tries to post-process these symbols and fails because they are renamed.
*/
val removeRedundantFiles = tasks.register<Delete>("removeRedundantFiles") {
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$2\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$2\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$2\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$2\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble//SaneFlowPlaysScrabble\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class")

// Primes
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$2\$1.class")
delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$1.class")
}

tasks.jmhRunBytecodeGenerator {
dependsOn(removeRedundantFiles)
}

// It is better to use the following to run benchmarks, otherwise you may get unexpected errors:
// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark"
jmh {
jmhVersion = "1.21"
duplicateClassesStrategy = DuplicatesStrategy.INCLUDE
failOnError = true
resultFormat = "CSV"
project.findProperty("jmh")?.also {
include = listOf(".*$it.*")
}
// includeTests = false
}

tasks.jmhJar {
baseName = "benchmarks"
classifier = null
version = null
destinationDir = file("$rootDir")
}

dependencies {
compile("org.openjdk.jmh:jmh-core:1.21")
compile("io.projectreactor:reactor-core:${version("reactor")}")
compile("io.reactivex.rxjava2:rxjava:2.1.9")
compile("com.github.akarnokd:rxjava2-extensions:0.20.8")

compile("org.openjdk.jmh:jmh-core:1.21")
compile("com.typesafe.akka:akka-actor_2.12:2.5.0")
compile(project(":kotlinx-coroutines-core"))

// add jmh dependency on main
jmhImplementation(sourceSets.main.get().runtimeClasspath)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package benchmarks.common

import java.util.concurrent.*

fun doGeomDistrWork(work: Int) {
public fun doGeomDistrWork(work: Int) {
// We use geometric distribution here. We also checked on macbook pro 13" (2017) that the resulting work times
// are distributed geometrically, see https://github.com/Kotlin/kotlinx.coroutines/pull/1464#discussion_r355705325
val p = 1.0 / work
Expand Down
26 changes: 6 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,11 @@ apply from: rootProject.file("gradle/experimental.gradle")
def rootModule = "kotlinx.coroutines"
def coreModule = "kotlinx-coroutines-core"
// Not applicable for Kotlin plugin
def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'publication-validator']
def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'publication-validator']
def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'integration-testing']
def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'integration-testing']
// Not published
def unpublished = internal + ['example-frontend-js', 'android-unit-tests']

static def platformOf(project) {
def name = project.name
if (name.endsWith("-js")) return "js"
if (name.endsWith("-common") || name.endsWith("-native")) {
throw IllegalStateException("$name platform is not supported")
}
return "jvm"
}

buildscript {
/*
* These property group is used to build kotlinx.coroutines against Kotlin compiler snapshot.
Expand Down Expand Up @@ -83,8 +74,6 @@ buildscript {

// JMH plugins
classpath "com.github.jengelman.gradle.plugins:shadow:5.1.0"
classpath "me.champeau.gradle:jmh-gradle-plugin:0.5.0-rc-2"
classpath "net.ltgt.gradle:gradle-apt-plugin:0.21"
}
}

Expand Down Expand Up @@ -166,7 +155,7 @@ allprojects {
// Add dependency to core source sets. Core is configured in kx-core/build.gradle
configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != coreModule }) {
evaluationDependsOn(":$coreModule")
def platform = platformOf(it)
def platform = PlatformKt.platformOf(it)
apply from: rootProject.file("gradle/compile-${platform}.gradle")
dependencies {
// See comment below for rationale, it will be replaced with "project" dependency
Expand Down Expand Up @@ -227,7 +216,7 @@ if (build_snapshot_train) {
* but publishing plugin does not re-read artifact names for kotlin-jvm projects, so renaming is not applied in pom files
* for JVM-only projects.
*
* We artificially replace "project" dependency with "module" one to have proper names in pom files, but then substitute it
* We artificially replace "project" dependency with "module" one to have proper names in pom files, but then substitute it
* to have out "project" dependency back.
*/
configure(subprojects.findAll { it.name != coreModule && it.name != rootModule }) {
Expand Down Expand Up @@ -278,11 +267,8 @@ println("Using Kotlin compiler version: $org.jetbrains.kotlin.config.KotlinCompi
// --------------- Publish only from under JDK11+ ---------------
task checkJdkForPublish {
doFirst {
String javaVersion = System.properties["java.version"]
int i = javaVersion.indexOf('.')
int javaVersionMajor = (i < 0 ? javaVersion : javaVersion.substring(0, i)).toInteger()
if (javaVersionMajor < 11) {
throw new GradleException("Project can be build for publishing only under JDK 11+, but found ${javaVersion}")
if (JavaVersionKt.javaVersionMajor < 11) {
throw new GradleException("Project can be build for publishing only under JDK 11+, but found ${JavaVersionKt.javaVersion}")
}
}
}
Expand Down
Loading