commit | 1ac3dc2f60a03c51fe60e72ac73a99fcf1ac44e3 | [log] [tgz] |
---|---|---|
author | Roman Elizarov <elizarov@gmail.com> | Fri Feb 14 15:39:09 2020 +0300 |
committer | GitHub <noreply@github.com> | Fri Feb 14 15:39:09 2020 +0300 |
tree | 61a95dd899a27150dc64fe715752b6ab8dac0158 | |
parent | 660c2d70dd2f6d7e7c2752d323d8780a1248678b [diff] |
Build project using JDK 11 (#1733) * Support build on both JDK 1.8 & 11, check for publishing under JDK 11 * Up the Robolectric version to support JDK11. According to https://github.com/robolectric/robolectric/issues/4085, by 4.0.2 it should support JDK11. Tests do pass after setting the version to 4.0.2, but they fail for every version released after that up to 4.3.1. It is unclear what causes this. I commit this to check how it works on the build agents, as some comments in the issue imply that on MacOS this version, too, does not work with JDK11. * Fix fully qualified names in stacktraces in tests: - With move to JDK11, the `park` method changed its fully qualified name. * Add new sanitazing to verification of stacktraces: - Now stacktraces have additional substrings, separated by a slash: java-base/java.util.lang - They are stripped away. - Also, the placement of tabs has changed, and so the tabs are also completely removed. * Refactor `verifyStackTrace` - It used to wrap the only loop where something happened in two other loops that did nothing. Now, only the innermost loop is left. * Use a separate JavaFx dependency. * Improve error handling for JavaFX initialization - Now, the JavaFX initialization may fail with an exception in case something went wrong. - The driver for this change was that the initialization started hanging in headless environments with transition to JDK 11. - Before, the initialization logic had a flaw. If a call to one API failed, another API would be attempted. However, this approach is problematic: if the first call failed with an exception for some reason, it would leave JavaFX in a broken state where a flag would imply that the system is being initialized. Subsequent calls would then proceed to wait forever for the initialization to complete. - Now, exceptions are checked more carefully, ensuring that we only fall back to the internal API in case the public one is unavailable and not failed for some valid reason. This differentiation also allows to more boldly rethrow exceptions upwards, being more or less confident that these are relevant to the user. * Additionally test JavaFX integration with JDK8 Co-authored-by: Dmitry Khalanskiy <dmitry.khalanskiy@jetbrains.com> Co-authored-by: Roman Elizarov <elizarov@gmail.com>
Library support for Kotlin coroutines with multiplatform support. This is a companion version for Kotlin 1.3.61
release.
suspend fun main() = coroutineScope { launch { delay(1000) println("Kotlin Coroutines World!") } println("Hello") }
Play with coroutines online here
Promise
via Promise.await and promise builder;Window
via Window.asCoroutineDispatcher, etc.The libraries are published to kotlinx bintray repository, linked to JCenter and pushed to Maven Central.
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.3</version> </dependency>
And make sure that you use the latest Kotlin version:
<properties> <kotlin.version>1.3.61</kotlin.version> </properties>
Add dependencies (you can also add other modules that you need):
dependencies { implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3' }
And make sure that you use the latest Kotlin version:
buildscript { ext.kotlin_version = '1.3.61' }
Make sure that you have either jcenter()
or mavenCentral()
in the list of repositories:
repository { jcenter() }
Add dependencies (you can also add other modules that you need):
dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3") }
And make sure that you use the latest Kotlin version:
plugins { kotlin("jvm") version "1.3.61" }
Make sure that you have either jcenter()
or mavenCentral()
in the list of repositories.
Core modules of kotlinx.coroutines
are also available for Kotlin/JS and Kotlin/Native. In common code that should get compiled for different platforms, add dependency tokotlinx-coroutines-core-common
(follow the link to get the dependency declaration snippet).
Add kotlinx-coroutines-android
module as dependency when using kotlinx.coroutines
on Android:
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
This gives you access to Android Dispatchers.Main coroutine dispatcher and also makes sure that in case of crashed coroutine with unhandled exception this exception is logged before crashing Android application, similarly to the way uncaught exceptions in threads are handled by Android runtime.
For R8 no actions required, it will take obfuscation rules from the jar.
For Proguard you need to add options from coroutines.pro to your rules manually.
R8 is a replacement for ProGuard in Android ecosystem, it is enabled by default since Android gradle plugin 3.4.0 (3.3.0-beta also had it enabled).
Kotlin/JS version of kotlinx.coroutines
is published as kotlinx-coroutines-core-js
(follow the link to get the dependency declaration snippet).
You can also use kotlinx-coroutines-core
package via NPM.
Kotlin/Native version of kotlinx.coroutines
is published as kotlinx-coroutines-core-native
(follow the link to get the dependency declaration snippet).
Only single-threaded code (JS-style) on Kotlin/Native is currently supported. Kotlin/Native supports only Gradle version 4.10 and you need to enable Gradle metadata in your settings.gradle
file:
enableFeaturePreview('GRADLE_METADATA')
Since Kotlin/Native does not generally provide binary compatibility between versions, you should use the same version of Kotlin/Native compiler as was used to build kotlinx.coroutines
.
This library is built with Gradle. To build it, use ./gradlew build
. You can import this project into IDEA, but you have to delegate build actions to Gradle (in Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle -> Runner)
JAVA_HOME
environment variable.JDK_16
environment variable. It is okay to have JDK_16
pointing to JAVA_HOME
for external contributions.JDK_18
environment variable. Only used by nightly stress-tests. It is okay to have JDK_16
pointing to JAVA_HOME
for external contributions.All development (both new features and bug fixes) is performed in develop
branch. This way master
sources always contain sources of the most recently released version. Please send PRs with bug fixes to develop
branch. Fixes to documentation in markdown files are an exception to this rule. They are updated directly in master
.
The develop
branch is pushed to master
during release.
./gradlew knit
../gradlew apiDump
.