Skip to content

Commit

Permalink
1. apply migration script
Browse files Browse the repository at this point in the history
  • Loading branch information
Quattro8 committed Sep 25, 2024
1 parent d8d6f8f commit c1f504e
Show file tree
Hide file tree
Showing 16 changed files with 288 additions and 295 deletions.
15 changes: 7 additions & 8 deletions docs/cfg/buildprofiles.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<buildprofiles>
<variables>
<enable-browser-edits>true</enable-browser-edits>
<browser-edits-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/</browser-edits-url>
<allow-indexable-eaps>true</allow-indexable-eaps>
</variables>
<build-profile product="kc"/>
</buildprofiles>
<variables>
<enable-browser-edits>true</enable-browser-edits>
<browser-edits-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/</browser-edits-url>
<allow-indexable-eaps>true</allow-indexable-eaps>
</variables>
<build-profile instance="kc"/>
</buildprofiles>
44 changes: 19 additions & 25 deletions docs/kc.tree
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE product-profile
SYSTEM "https://resources.jetbrains.com/stardust/product-profile.dtd">

<product-profile id="kc"
name="Kotlin coroutines"
start-page="coroutines-guide.md">

<chunk include-id="coroutines">
<toc-element id="coroutines-guide.md"/>
<toc-element id="coroutines-basics.md" accepts-web-file-names="basics.html,coroutines-basic-jvm.html"/>
<toc-element id="coroutines-and-channels.md"/>
<toc-element id="cancellation-and-timeouts.md"/>
<toc-element id="composing-suspending-functions.md"/>
<toc-element id="coroutine-context-and-dispatchers.md"/>
<toc-element id="flow.md"/>
<toc-element id="channels.md"/>
<toc-element id="exception-handling.md"/>
<toc-element id="shared-mutable-state-and-concurrency.md"/>
<toc-element id="select-expression.md"/>
<toc-element id="debug-coroutines-with-idea.md"/>
<toc-element id="debug-flow-with-idea.md"/>
</chunk>
</product-profile>
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE instance-profile SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">
<instance-profile id="kc" name="Kotlin coroutines" start-page="coroutines-guide.md">
<snippet id="coroutines">
<toc-element topic="coroutines-guide.md"/>
<toc-element accepts-web-file-names="basics.html,coroutines-basic-jvm.html" topic="coroutines-basics.md"/>
<toc-element topic="coroutines-and-channels.md"/>
<toc-element topic="cancellation-and-timeouts.md"/>
<toc-element topic="composing-suspending-functions.md"/>
<toc-element topic="coroutine-context-and-dispatchers.md"/>
<toc-element topic="flow.md"/>
<toc-element topic="channels.md"/>
<toc-element topic="exception-handling.md"/>
<toc-element topic="shared-mutable-state-and-concurrency.md"/>
<toc-element topic="select-expression.md"/>
<toc-element topic="debug-coroutines-with-idea.md"/>
<toc-element topic="debug-flow-with-idea.md"/>
</snippet>
</instance-profile>
14 changes: 0 additions & 14 deletions docs/project.ihp

This file was deleted.

42 changes: 21 additions & 21 deletions docs/topics/cancellation-and-timeouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-01.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-01.kt).
>
{type="note"}
{style="note"}

It produces the following output:

Expand Down Expand Up @@ -86,9 +86,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-02.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-02.kt).
>
{type="note"}
{style="note"}

Run it to see that it continues to print "I'm sleeping" even after cancellation
until the job completes by itself after five iterations.
Expand Down Expand Up @@ -131,9 +131,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-03.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-03.kt).
>
{type="note"}
{style="note"}

While catching `Exception` is an anti-pattern, this issue may surface in more subtle ways, like when using the
[`runCatching`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/run-catching.html) function,
Expand Down Expand Up @@ -173,9 +173,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-04.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-04.kt).
>
{type="note"}
{style="note"}

As you can see, now this loop is cancelled. [isActive] is an extension property
available inside the coroutine via the [CoroutineScope] object.
Expand Down Expand Up @@ -218,9 +218,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-05.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-05.kt).
>
{type="note"}
{style="note"}

Both [join][Job.join] and [cancelAndJoin] wait for all finalization actions to complete,
so the example above produces the following output:
Expand Down Expand Up @@ -273,9 +273,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-06.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-06.kt).
>
{type="note"}
{style="note"}

<!--- TEST
job: I'm sleeping 0 ...
Expand Down Expand Up @@ -311,9 +311,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-07.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-07.kt).
>
{type="note"}
{style="note"}

It produces the following output:

Expand Down Expand Up @@ -354,9 +354,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-08.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-08.kt).
>
{type="note"}
{style="note"}

There is no longer an exception when running this code:

Expand Down Expand Up @@ -415,9 +415,9 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-09.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-09.kt).
>
{type="note"}
{style="note"}

<!--- CLEAR -->

Expand All @@ -428,7 +428,7 @@ of your machine. You may need to tweak the timeout in this example to actually s
> since it always happens from the same thread, the one used by `runBlocking`.
> More on that will be explained in the chapter on coroutine context.
>
{type="note"}
{style="note"}

To work around this problem you can store a reference to the resource in a variable instead of returning it
from the `withTimeout` block.
Expand Down Expand Up @@ -468,9 +468,9 @@ fun main() {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-10.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-10.kt).
>
{type="note"}
{style="note"}

This example always prints zero. Resources do not leak.

Expand Down
42 changes: 21 additions & 21 deletions docs/topics/channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-01.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-channel-01.kt).
>
{type="note"}
{style="note"}

The output of this code is:

Expand Down Expand Up @@ -77,9 +77,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-02.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-channel-02.kt).
>
{type="note"}
{style="note"}

<!--- TEST
1
Expand Down Expand Up @@ -118,9 +118,9 @@ fun main() = runBlocking {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-03.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-channel-03.kt).
>
{type="note"}
{style="note"}

<!--- TEST
1
Expand Down Expand Up @@ -182,9 +182,9 @@ fun CoroutineScope.square(numbers: ReceiveChannel<Int>): ReceiveChannel<Int> = p
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-channel-04.kt).
>
{type="note"}
{style="note"}

<!--- TEST
1
Expand All @@ -199,7 +199,7 @@ Done!
> so that we can rely on [structured concurrency](composing-suspending-functions.md#structured-concurrency-with-async) to make
> sure that we don't have lingering global coroutines in our application.
>
{type="note"}
{style="note"}

## Prime numbers with pipeline

Expand Down Expand Up @@ -266,9 +266,9 @@ fun CoroutineScope.filter(numbers: ReceiveChannel<Int>, prime: Int) = produce<In
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-05.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-channel-05.kt).
>
{type="note"}
{style="note"}

The output of this code is:

Expand Down Expand Up @@ -360,9 +360,9 @@ fun CoroutineScope.launchProcessor(id: Int, channel: ReceiveChannel<Int>) = laun
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-06.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-channel-06.kt).
>
{type="note"}
{style="note"}

The output will be similar to the following one, albeit the processor ids that receive
each specific integer may be different:
Expand Down Expand Up @@ -435,9 +435,9 @@ suspend fun sendString(channel: SendChannel<String>, s: String, time: Long) {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-07.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-channel-07.kt).
>
{type="note"}
{style="note"}

The output is:

Expand Down Expand Up @@ -485,9 +485,9 @@ fun main() = runBlocking<Unit> {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-08.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-channel-08.kt).
>
{type="note"}
{style="note"}

It prints "sending" _five_ times using a buffered channel with capacity of _four_:

Expand Down Expand Up @@ -538,9 +538,9 @@ suspend fun player(name: String, table: Channel<Ball>) {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-09.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-channel-09.kt).
>
{type="note"}
{style="note"}

The "ping" coroutine is started first, so it is the first one to receive the ball. Even though "ping"
coroutine immediately starts receiving the ball again after sending it back to the table, the ball gets
Expand Down Expand Up @@ -602,9 +602,9 @@ fun main() = runBlocking<Unit> {
```
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}

> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-10.kt).
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-channel-10.kt).
>
{type="note"}
{style="note"}

It prints following lines:

Expand Down
Loading

0 comments on commit c1f504e

Please sign in to comment.