Skip to content

Commit

Permalink
Merge pull request #2001 from Kotlin/version-1.3.6
Browse files Browse the repository at this point in the history
Version 1.3.6
  • Loading branch information
qwwdfsad committed May 8, 2020
2 parents ae6b2c4 + a922194 commit 583ec6e
Show file tree
Hide file tree
Showing 250 changed files with 7,474 additions and 1,770 deletions.
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

0 comments on commit 583ec6e

Please sign in to comment.