-
Notifications
You must be signed in to change notification settings - Fork 470
Dokka Gradle plugin doc update #4354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AlejandraPedroza
wants to merge
2
commits into
master
Choose a base branch
from
DGPv2-update-docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+879
−841
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| - Copyright 2014-2025 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
| --> | ||
|
|
||
| <!DOCTYPE labels SYSTEM "https://resources.jetbrains.com/writerside/1.0/labels-list.dtd"> | ||
| <labels xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/labels.xsd"> | ||
|
|
||
| <primary-label id="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> | ||
| <primary-label id="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> | ||
| <primary-label id="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> | ||
| <primary-label id="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> | ||
| <primary-label id="advanced" name="Advanced" short-name="☆" color="purple"></primary-label> | ||
| <primary-label id="eap" name="EAP" short-name="EAP" color="red">This functionality is available only in the latest EAP version.</primary-label> | ||
|
|
||
| <secondary-label id="eap" name="EAP" color="red">This functionality is available only in the latest EAP version.</secondary-label> | ||
| </labels> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| [//]: # (title: Dokka Gradle troubleshooting) | ||
|
|
||
| In large projects, Dokka can consume a significant amount of memory to generate documentation. | ||
| This can exceed Gradle’s memory limits, especially when processing large volumes of data. | ||
|
|
||
| When Dokka generation runs out of memory, the build fails, | ||
| and Gradle can throw exceptions like `java.lang.OutOfMemoryError: Metaspace`. | ||
|
|
||
| Active efforts are underway to improve Dokka's performance, although some limitations stem from Gradle. | ||
adam-enko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| If you encounter memory issues, try these workarounds: | ||
|
|
||
| * [Increasing heap space](#increase-heap-space) | ||
| * [Running Dokka within the Gradle process](#run-dokka-within-the-gradle-process) | ||
|
|
||
| ### Increase heap space | ||
|
|
||
| One way to resolve memory issues is to increase the amount of Java heap memory for the Dokka generator process. | ||
| In the `build.gradle.kts` file, adjust the | ||
| following configuration option: | ||
|
|
||
| ```kotlin | ||
| dokka { | ||
| // Dokka generates a new process managed by Gradle | ||
| dokkaGeneratorIsolation = ProcessIsolation { | ||
| // Configures heap size | ||
| maxHeapSize = "4g" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| In this example, the maximum heap size is set to 4 GB (`"4g"`). | ||
| Adjust and test the value to find the optimal setting for your build. | ||
|
|
||
| If you find that Dokka requires a considerably expanded heap size, | ||
| for example, significantly higher than Gradle's own memory usage, | ||
| [create an issue on Dokka's GitHub repository](https://kotl.in/dokka-issues). | ||
|
|
||
| > You have to apply this configuration to each subproject. | ||
| > It is recommended that you configure Dokka in a convention | ||
| > plugin applied to all subprojects. | ||
| > | ||
| {style="note"} | ||
|
|
||
| ### Run Dokka within the Gradle process | ||
|
|
||
| When both the Gradle build and Dokka generation require a lot of memory, they may run as separate processes, | ||
| consuming significant memory on a single machine. | ||
|
|
||
| To optimize memory usage, you can run Dokka within the same Gradle process instead of as a separate process. | ||
| This allows you to configure the memory for Gradle once instead of allocating it separately for each process. | ||
|
|
||
| To run Dokka within the same Gradle process, adjust the following configuration option in the `build.gradle.kts` file: | ||
|
|
||
| ```kotlin | ||
| dokka { | ||
| // Runs Dokka in the current Gradle process | ||
| dokkaGeneratorIsolation = ClassLoaderIsolation() | ||
| } | ||
| ``` | ||
|
|
||
| As with [increasing heap space](#increase-heap-space), test this configuration to confirm it works well for your project. | ||
|
|
||
| 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). | ||
|
|
||
| > 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). | ||
| > | ||
| > Additionally, Gradle issues with the `ClassLoaderIsolation()` configuration may [cause memory leaks](https://github.com/gradle/gradle/issues/18313). | ||
| > | ||
| {style="note"} | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change intentional? Or what it affects? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I took the Troubleshooting out of the migration guide. From what I see, the troubleshooting information is useful for DGP v2, and now that DGP v2 is the default, this information is useful for everyone using DGP with the defaul version, not only related to migration. Is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree, having a separate page for this is really nice!
My question was mostly about its usage as a
start-pageattribute value. I don't fully understand what it affects, but it appears to be wrong.