Skip to content

Commit 6687406

Browse files
committed
Merge branch 'master' into develop
2 parents 1748ce1 + 4c3be05 commit 6687406

File tree

2 files changed

+47
-13
lines changed

2 files changed

+47
-13
lines changed

README.md

+40-9
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ Library support for Kotlin coroutines with [multiplatform](#multiplatform) suppo
88
This is a companion version for Kotlin `1.3.30` release.
99

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

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

1924
* [core](kotlinx-coroutines-core/README.md) — common coroutines across all platforms:
@@ -52,7 +57,7 @@ GlobalScope.launch {
5257
* [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))
5358
* [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))
5459
* Guides and manuals:
55-
* [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**)
5661
* [Guide to UI programming with coroutines](ui/coroutines-guide-ui.md)
5762
* [Guide to reactive streams with coroutines](reactive/coroutines-guide-reactive.md)
5863
* [Debugging capabilities in kotlinx.coroutines](docs/debugging.md)
@@ -136,10 +141,10 @@ Make sure that you have either `jcenter()` or `mavenCentral()` in the list of re
136141
### Multiplatform
137142

138143
Core modules of `kotlinx.coroutines` are also available for
139-
[Kotlin/JS](js/README.md) and [Kotlin/Native](native/README.md). If you write
140-
a common code that should get compiled for different platforms, add
141-
[`org.jetbrains.kotlinx:kotlinx-coroutines-core-common:<version>`](common/kotlinx-coroutines-core-common/README.md)
142-
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).
143148

144149
### Android
145150

@@ -149,6 +154,7 @@ module as dependency when using `kotlinx.coroutines` on Android:
149154
```groovy
150155
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.0'
151156
```
157+
152158
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)
153159
coroutine dispatcher and also makes sure that in case of crashed coroutine with unhandled exception this
154160
exception is logged before crashing Android application, similarly to the way uncaught exceptions in
@@ -158,10 +164,35 @@ threads are handled by Android runtime.
158164

159165
For R8 no actions required, it will take obfuscation rules from the jar.
160166

161-
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.
162168

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

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+
165196
## Building
166197

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

kotlinx-coroutines-core/js/npm/README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ Library support for Kotlin coroutines in
44
[Kotlin/JS](https://kotlinlang.org/docs/reference/js-overview.html).
55

66
```kotlin
7-
launch {
8-
delay(1000)
9-
println("Hello from Kotlin Coroutines!")
7+
suspend fun main() = coroutineScope {
8+
launch {
9+
delay(1000)
10+
println("Kotlin Coroutines World!")
11+
}
12+
println("Hello")
1013
}
1114
```
1215

1316
## Documentation
1417

15-
* [Guide to kotlinx.coroutines by example on JVM](https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md) (**read it first**)
18+
* [Guide to kotlinx.coroutines by example on JVM](https://kotlinlang.org/docs/reference/coroutines/coroutines-guide.html) (**read it first**)
1619
* [Full kotlinx.coroutines API reference](https://kotlin.github.io/kotlinx.coroutines)

0 commit comments

Comments
 (0)