You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<primary-labelid="experimental-general"name="Experimental"short-name="Experimental"href="components-stability.html#stability-levels-explained"color="red">The feature is Experimental. It may be dropped or changed at any time. Use it only for evaluation purposes.</primary-label>
11
+
<primary-labelid="experimental-opt-in"name="Experimental"short-name="Experimental"href="components-stability.html#stability-levels-explained"color="red" >The feature is Experimental. It may be dropped or changed at any time. Opt-in is required (see the details below), and you should use it only for evaluation purposes.</primary-label>
12
+
<primary-labelid="alpha"name="Alpha"short-name="α"href="components-stability.html#stability-levels-explained"color="strawberry">The feature is in Alpha. It may change incompatibly and require manual migration in the future.</primary-label>
13
+
<primary-labelid="beta"name="Beta"short-name="β"href="components-stability.html#stability-levels-explained"color="tangerine">The feature is in Beta. It is almost stable, but migration steps may be required in the future. We'll do our best to minimize any changes you have to make.</primary-label>
Copy file name to clipboardExpand all lines: docs/topics/dokka-get-started.md
+28-22Lines changed: 28 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,40 +5,44 @@ Below you can find simple instructions to help you get started with Dokka.
5
5
<tabsgroup="build-script">
6
6
<tabtitle="Gradle Kotlin DSL"group-key="kotlin">
7
7
8
-
> These instructions reflect Dokka Gradle plugin v1 configuration and tasks. Starting from Dokka 2.0.0, several configuration options, Gradle tasks, and steps to generate your documentation have been updated, including:
In large projects, Dokka can consume a significant amount of memory to generate documentation.
4
+
This can exceed Gradle’s memory limits, especially when processing large volumes of data.
5
+
6
+
When Dokka generation runs out of memory, the build fails,
7
+
and Gradle can throw exceptions like `java.lang.OutOfMemoryError: Metaspace`.
8
+
9
+
Active efforts are underway to improve Dokka's performance, although some limitations stem from Gradle.
10
+
11
+
If you encounter memory issues, try these workarounds:
12
+
13
+
*[Increasing heap space](#increase-heap-space)
14
+
*[Running Dokka within the Gradle process](#run-dokka-within-the-gradle-process)
15
+
16
+
### Increase heap space
17
+
18
+
One way to resolve memory issues is to increase the amount of Java heap memory for the Dokka generator process.
19
+
In the `build.gradle.kts` file, adjust the
20
+
following configuration option:
21
+
22
+
```kotlin
23
+
dokka {
24
+
// Dokka generates a new process managed by Gradle
25
+
dokkaGeneratorIsolation =ProcessIsolation {
26
+
// Configures heap size
27
+
maxHeapSize ="4g"
28
+
}
29
+
}
30
+
```
31
+
32
+
In this example, the maximum heap size is set to 4 GB (`"4g"`).
33
+
Adjust and test the value to find the optimal setting for your build.
34
+
35
+
If you find that Dokka requires a considerably expanded heap size,
36
+
for example, significantly higher than Gradle's own memory usage,
37
+
[create an issue on Dokka's GitHub repository](https://kotl.in/dokka-issues).
38
+
39
+
> You have to apply this configuration to each subproject.
40
+
> It is recommended that you configure Dokka in a convention
41
+
> plugin applied to all subprojects.
42
+
>
43
+
{style="note"}
44
+
45
+
### Run Dokka within the Gradle process
46
+
47
+
When both the Gradle build and Dokka generation require a lot of memory, they may run as separate processes,
48
+
consuming significant memory on a single machine.
49
+
50
+
To optimize memory usage, you can run Dokka within the same Gradle process instead of as a separate process.
51
+
This allows you to configure the memory for Gradle once instead of allocating it separately for each process.
52
+
53
+
To run Dokka within the same Gradle process, adjust the following configuration option in the `build.gradle.kts` file:
54
+
55
+
```kotlin
56
+
dokka {
57
+
// Runs Dokka in the current Gradle process
58
+
dokkaGeneratorIsolation =ClassLoaderIsolation()
59
+
}
60
+
```
61
+
62
+
As with [increasing heap space](#increase-heap-space), test this configuration to confirm it works well for your project.
63
+
64
+
For more details on configuring Gradle's JVM memory,
65
+
see the [Gradle documentation](https://docs.gradle.org/current/userguide/config_gradle.html#sec:configuring_jvm_memory).
66
+
67
+
> Changing the Java options for Gradle launches a new Gradle daemon, which may stay alive for a long time. You can [manually stop any other Gradle processes](https://docs.gradle.org/current/userguide/gradle_daemon.html#sec:stopping_an_existing_daemon).
68
+
>
69
+
> Additionally, Gradle issues with the `ClassLoaderIsolation()` configuration may [cause memory leaks](https://github.com/gradle/gradle/issues/18313).
Copy file name to clipboardExpand all lines: docs/topics/dokka-migration.md
+3-71Lines changed: 3 additions & 71 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,7 @@ The Dokka Gradle plugin (DGP) is a tool for generating comprehensive API documen
5
5
DGP seamlessly processes both Kotlin's KDoc comments and Java's Javadoc comments to extract information and create
6
6
structured documentation in [HTML or Javadoc](#select-documentation-output-format) format.
7
7
8
-
Starting with Dokka 2.0.0, you can try the Dokka Gradle plugin v2, the new version of DGP. With Dokka 2.0.0, you can use
9
-
the Dokka Gradle plugin either in v1 or v2 modes.
10
-
11
-
DGP v2 introduces significant improvements to DGP, aligning more closely with Gradle best practices:
8
+
The Dokka Gradle plugin v2 mode is enabled by default and aligns with Gradle best practices:
12
9
13
10
* Adopts Gradle types, which leads to better performance.
14
11
* Uses an intuitive top-level DSL configuration instead of a low-level task-based setup, which simplifies the build scripts and their readability.
@@ -17,6 +14,8 @@ DGP v2 introduces significant improvements to DGP, aligning more closely with Gr
17
14
* Fully supports Gradle [configuration cache](https://docs.gradle.org/current/userguide/configuration_cache.html) and
18
15
[build cache](https://docs.gradle.org/current/userguide/build_cache.html), which improves performance and simplifies build work.
19
16
17
+
Read this guide for further information between changes and migration from DGP v1 to v2 modes.
18
+
20
19
## Before you start
21
20
22
21
Before starting the migration, complete the following steps.
@@ -786,73 +785,6 @@ DGP v2 now supports Gradle build cache and configuration cache, improving build
786
785
* To enable build cache, follow instructions in the [Gradle build cache documentation](https://docs.gradle.org/current/userguide/build_cache.html#sec:build_cache_enable).
787
786
* To enable configuration cache, follow instructions in the [Gradle configuration cache documentation](https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:usage:enable ).
788
787
789
-
## Troubleshooting
790
-
791
-
In large projects, Dokka can consume a significant amount of memory to generate documentation.
792
-
This can exceed Gradle’s memory limits, especially when processing large volumes of data.
793
-
794
-
When Dokka generation runs out of memory, the build fails, and Gradle can throw exceptions like `java.lang.OutOfMemoryError: Metaspace`.
795
-
796
-
Active efforts are underway to improve Dokka's performance, although some limitations stem from Gradle.
797
-
798
-
If you encounter memory issues, try these workarounds:
799
-
800
-
* [Increasing heap space](#increase-heap-space)
801
-
* [RunningDokka within the Gradle process](#run-dokka-within-the-gradle-process)
802
-
803
-
### Increase heap space
804
-
805
-
One way to resolve memory issues is to increase the amount of Java heap memory for the Dokka generator process.
806
-
In the `build.gradle.kts` file, adjust the
807
-
following configuration option:
808
-
809
-
```kotlin
810
-
dokka {
811
-
// Dokka generates a new process managed by Gradle
812
-
dokkaGeneratorIsolation =ProcessIsolation {
813
-
// Configures heap size
814
-
maxHeapSize ="4g"
815
-
}
816
-
}
817
-
```
818
-
819
-
Inthis example, the maximum heap size is set to 4GB (`"4g"`). Adjustand test the value to find the optimal setting for your build.
820
-
821
-
If you find that Dokka requires a considerably expanded heap size, for example, significantly higher than Gradle's own memory usage,
822
-
[create an issue on Dokka's GitHub repository](https://kotl.in/dokka-issues).
823
-
824
-
>You have to apply this configuration to each subproject. Itis recommended that you configure Dokkain a convention
825
-
> plugin applied to all subprojects.
826
-
>
827
-
{style="note"}
828
-
829
-
### RunDokka within the Gradle process
830
-
831
-
When both the Gradle build andDokka generation require a lot of memory, they may run as separate processes,
832
-
consuming significant memory on a single machine.
833
-
834
-
To optimize memory usage, you can run Dokka within the same Gradle process instead of as a separate process. This
835
-
allows you to configure the memory forGradle once instead of allocating it separately for each process.
836
-
837
-
To run Dokka within the same Gradle process, adjust the following configuration option in the `build.gradle.kts` file:
838
-
839
-
```kotlin
840
-
dokka {
841
-
// Runs Dokka in the current Gradle process
842
-
dokkaGeneratorIsolation =ClassLoaderIsolation()
843
-
}
844
-
```
845
-
846
-
As with [increasing heap space](#increase-heap-space), test this configuration to confirm it works well for your project.
847
-
848
-
For more details on configuring Gradle's JVM memory, see the [Gradle documentation](https://docs.gradle.org/current/userguide/config_gradle.html#sec:configuring_jvm_memory).
849
-
850
-
> Changing the Java options for Gradle launches a new Gradle daemon, which may stay alive for a long time. You can [manually stop any other Gradle processes](https://docs.gradle.org/current/userguide/gradle_daemon.html#sec:stopping_an_existing_daemon).
851
-
>
852
-
> Additionally, Gradle issues with the `ClassLoaderIsolation()` configuration may [cause memory leaks](https://github.com/gradle/gradle/issues/18313).
853
-
>
854
-
{style="note"}
855
-
856
788
## What's next
857
789
858
790
* [Explore more DGP v2 project examples](https://github.com/Kotlin/dokka/tree/master/examples/gradle-v2).
0 commit comments