Skip to content

Commit 729484a

Browse files
Developer's reviews
1 parent c4520f9 commit 729484a

File tree

8 files changed

+205
-216
lines changed

8 files changed

+205
-216
lines changed

docs/topics/dokka-get-started.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ Below you can find simple instructions to help you get started with Dokka.
55
<tabs group="build-script">
66
<tab title="Gradle Kotlin DSL" group-key="kotlin">
77

8+
> This guide applies to Dokka Gradle Plugin (DGP) v2 mode. The previous DGP v1 mode is no longer supported.
9+
> If you're upgrading from v1 to v2 mode, see the [Migration guide](dokka-migration.md).
10+
>
11+
{style="note"}
12+
813
**Apply the Gradle Dokka plugin**
914

1015
Apply the Dokka Gradle plugin (DGP) in the root build script of your project:
@@ -15,16 +20,16 @@ plugins {
1520
}
1621
```
1722

18-
**Document multi-module projects**
23+
**Document multi-project builds**
1924

20-
When documenting [multi-module projects (multi-project builds)](https://docs.gradle.org/current/userguide/multi_project_builds.html),
21-
you don't need to apply the plugin to every module or subproject you want to document. Instead, share Dokka configuration across modules
25+
When documenting [multi-project builds](https://docs.gradle.org/current/userguide/multi_project_builds.html),
26+
you need to apply the plugin to every subproject you want to document. Share Dokka configuration across subprojects
2227
by using one of the following approaches:
2328

2429
* Convention plugin
25-
* Direct configuration in each module if you’re not using convention plugins
30+
* Direct configuration in each subproject if you’re not using convention plugins
2631

27-
For more information about sharing Dokka configuration in multi-module projects,
32+
For more information about sharing Dokka configuration in multi-project builds,
2833
see [Multi-project configuration](dokka-gradle.md#multi-project-configuration).
2934

3035
**Generate documentation**
@@ -35,13 +40,13 @@ To generate documentation, run the following Gradle task:
3540
./gradlew :dokkaGenerate
3641
```
3742

38-
This task works for both single and multi-module projects.
43+
This task works for both single and multi-project builds.
3944
You can use different tasks to generate output in [HTML](dokka-html.md),
4045
[Javadoc](dokka-javadoc.md) or both [HTML and Javadoc](dokka-gradle.md#configure-documentation-output-format).
4146

4247
**Set output directory**
4348

44-
By default, the output directory is set to `/build/dokka/html` for both multi-module and single-module projects,
49+
By default, the output directory is set to `/build/dokka/html` for both multi-project and single-project builds,
4550
but you can [configure it](dokka-gradle.md#general-configuration).
4651

4752
To learn more about using Dokka with Gradle, see [Gradle](dokka-gradle.md).

docs/topics/dokka-migration.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Update the Dokka version to 2.0.0 in the `plugins {}` block of your project’s
4343
```kotlin
4444
plugins {
4545
kotlin("jvm") version "2.1.10"
46-
id("org.jetbrains.dokka") version "2.0.0"
46+
id("org.jetbrains.dokka") version "%dokkaVersion%"
4747
}
4848
```
4949

@@ -525,15 +525,15 @@ For an example of the DGP v2 configuration, see the
525525
DGP v2 allows you to extend its functionality by [configuring custom plugins](https://github.com/Kotlin/dokka/blob/ae3840edb4e4afd7b3e3768a5fddfe8ec0e08f31/examples/gradle-v2/custom-dokka-plugin-example/demo-library/build.gradle.kts).
526526
Custom plugins enable additional processing or modifications to the documentation generation process.
527527

528-
### Share Dokka configuration across modules
528+
### Share Dokka configuration across subprojects
529529

530-
DPG v2 moves away from using `subprojects {}` or `allprojects {}` to share configuration across modules. In future Gradle versions,
530+
DPG v2 moves away from using `subprojects {}` or `allprojects {}` to share configuration across subprojects. In future Gradle versions,
531531
using these approaches will [lead to errors](https://docs.gradle.org/current/userguide/isolated_projects.html).
532532

533533
Follow the steps below to properly share Dokka configuration in multi-module projects [with existing convention plugins](#multi-module-projects-with-convention-plugins)
534534
or [without convention plugins](#multi-module-projects-without-convention-plugins).
535535

536-
After sharing the Dokka configuration, you can aggregate the documentation from multiple modules into a single output. For more information, see
536+
After sharing the Dokka configuration, you can aggregate the documentation from multiple subprojects into a single output. For more information, see
537537
[Update documentation aggregation in multi-module projects](#update-documentation-aggregation-in-multi-module-projects).
538538

539539
> For a multi-module project example, see the [Dokka GitHub repository](https://github.com/Kotlin/dokka/tree/master/examples/gradle-v2/multimodule-example).
@@ -542,12 +542,12 @@ After sharing the Dokka configuration, you can aggregate the documentation from
542542

543543
#### Multi-module projects without convention plugins
544544

545-
If your project doesn't use convention plugins, you can still share Dokka configurations by directly configuring each module.
546-
This involves manually setting up the shared configuration in each module's `build.gradle.kts` file. While this approach is less centralized,
545+
If your project doesn't use convention plugins, you can still share Dokka configurations by directly configuring each subproject.
546+
This involves manually setting up the shared configuration in each subproject's `build.gradle.kts` file. While this approach is less centralized,
547547
it avoids the need for additional setups like convention plugins.
548548

549549
Otherwise, if your project uses convention plugins, you can also share the Dokka configuration in multi-module projects
550-
by creating a convention plugin in the `buildSrc` directory, and then applying the plugin to your modules (subprojects).
550+
by creating a convention plugin in the `buildSrc` directory, and then applying the plugin to your subprojects.
551551

552552
##### Set up the buildSrc directory
553553

@@ -599,9 +599,9 @@ After setting up the `buildSrc` directory:
599599
You need to add the shared Dokka [configuration](#adjust-configuration-options) common to all subprojects within the `dokka {}` block.
600600
Also, you don't need to specify a Dokka version. The version is already set in the `buildSrc/build.gradle.kts` file.
601601
602-
##### Apply the convention plugin to your modules
602+
##### Apply the convention plugin to your subprojects
603603
604-
Apply the Dokka convention plugin across your modules (subprojects) by adding it to each subproject's `build.gradle.kts` file:
604+
Apply the Dokka convention plugin across your subprojects by adding it to each subproject's `build.gradle.kts` file:
605605

606606
```kotlin
607607
plugins {
@@ -614,13 +614,13 @@ plugins {
614614
If you already have convention plugins, create a dedicated Dokka convention plugin following [Gradle's documentation](https://docs.gradle.org/current/userguide/custom_plugins.html#sec:convention_plugins).
615615
616616
Then, follow the steps to [set up the Dokka convention plugin](#set-up-the-dokka-convention-plugin) and
617-
[apply it across your modules](#apply-the-convention-plugin-to-your-modules).
617+
[apply it across your subprojects](#apply-the-convention-plugin-to-your-subprojects).
618618
619619
### Update documentation aggregation in multi-module projects
620620
621-
Dokka can aggregate the documentation from multiple modules (subprojects) into a single output or publication.
621+
Dokka can aggregate the documentation from multiple subprojects into a single output or publication.
622622
623-
As [explained](#apply-the-convention-plugin-to-your-modules), apply the Dokka plugin to all documentable subprojects before aggregating the documentation.
623+
As [explained](#apply-the-convention-plugin-to-your-subprojects), apply the Dokka plugin to all documentable subprojects before aggregating the documentation.
624624
625625
Aggregation in DGP v2 uses the `dependencies {}` block instead of tasks and can be added in any `build.gradle.kts` file.
626626
@@ -646,7 +646,7 @@ dependencies {
646646
647647
### Change directory of aggregated documentation
648648
649-
When DGP aggregates modules, each subproject has its own subdirectory within the aggregated documentation.
649+
When DGP aggregates subprojects, each subproject has its own subdirectory within the aggregated documentation.
650650
651651
In DGP v2, the aggregation mechanism has been updated to better align with Gradle conventions.
652652
DGP v2 now preserves the full subproject directory to prevent conflicts when aggregating
@@ -676,7 +676,7 @@ may become outdated, potentially causing `404` errors.
676676
677677
#### Revert to the DGP v1 directory behavior
678678
679-
If your project depends on the directory structure used in DGP v1, you can revert this behavior by manually specifying the module directory.
679+
If your project depends on the directory structure used in DGP v1, you can revert this behavior by manually specifying the subproject directory.
680680
Add the following configuration to the `build.gradle.kts` file of each subproject:
681681
682682
```kotlin
@@ -687,7 +687,7 @@ plugins {
687687
}
688688
689689
dokka {
690-
// Overrides the module directory to match the V1 structure
690+
// Overrides the subproject directory to match the V1 structure
691691
modulePath.set("maths")
692692
}
693693
```
@@ -733,10 +733,10 @@ or both formats at the same time:
733733
```kotlin
734734
plugins {
735735
// Generates HTML documentation
736-
id("org.jetbrains.dokka") version "2.0.0"
736+
id("org.jetbrains.dokka") version "%dokkaVersion%"
737737

738738
// Generates Javadoc documentation
739-
id("org.jetbrains.dokka-javadoc") version "2.0.0"
739+
id("org.jetbrains.dokka-javadoc") version "%dokkaVersion%"
740740

741741
// Keeping both plugin IDs generates both formats
742742
}

docs/topics/dokka-module-and-package-docs.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
[//]: # (title: Module documentation)
1+
[//]: # (title: Subproject documentation)
22

3-
Documentation for a module as a whole, as well as packages in that module, can be provided as separate Markdown files.
3+
Documentation for a subproject as a whole, as well as packages in that subproject, can be provided as separate Markdown files.
44

55
## File format
66

7-
Inside the Markdown file, the documentation for the module as a whole and for individual packages is introduced by the corresponding
8-
first-level headings. The text of the heading **must** be **Module `<module name>`** for a module, and **Package `<package qualified name>`**
7+
Inside the Markdown file, the documentation for the subproject as a whole and for individual packages is introduced by the corresponding
8+
first-level headings. The text of the heading **must** be **Module `<module name>`** for a subproject, and **Package `<package qualified name>`**
99
for a package.
1010

11-
The file doesn't have to contain both module and package documentation. You can have files that contain only package or
12-
module documentation. You can even have a Markdown file per module or package.
11+
The file doesn't have to contain both subproject and package documentation. You can have files that contain only package or
12+
subproject documentation. You can even have a Markdown file per subproject or package.
1313

1414
Using [Markdown syntax](https://www.markdownguide.org/basic-syntax/), you can add:
1515
* Headings up to level 6
@@ -19,12 +19,12 @@ Using [Markdown syntax](https://www.markdownguide.org/basic-syntax/), you can ad
1919
* Code blocks
2020
* Blockquotes
2121

22-
Here's an example file containing both module and package documentation:
22+
Here's an example file containing both subproject and package documentation:
2323

2424
```text
2525
# Module kotlin-demo
2626
27-
This content appears under your module name.
27+
This content appears under your subproject name.
2828
2929
# Package org.jetbrains.kotlin.demo
3030

docs/topics/dokka-plugins.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
[//]: # (title: Dokka plugins)
22

3+
> This guide applies to Dokka Gradle Plugin (DGP) v2 mode. The previous DGP v1 mode is no longer supported.
4+
> If you're upgrading from v1 to v2 mode, see the [Migration guide](dokka-migration.md).
5+
>
6+
{style="note"}
7+
38
Dokka was built from the ground up to be easily extensible and highly customizable, which allows the community
49
to implement plugins for missing or very specific features that are not provided out of the box.
510

@@ -30,24 +35,21 @@ to your project:
3035
<tabs group="build-script">
3136
<tab title="Kotlin" group-key="kotlin">
3237

33-
The way to apply Dokka plugins is unified under the `dokka {}` DSL:
38+
The way to apply Dokka plugins is:
3439

3540
```kotlin
3641
plugins {
37-
id("org.jetbrains.dokka") version "2.0.0"
42+
id("org.jetbrains.dokka") version "%dokkaVersion%"
3843
}
3944

40-
dokka {
41-
dependencies {
42-
dokkaPlugin("org.jetbrains.dokka:mathjax-plugin:2.0.0")
43-
}
44-
45+
dependencies {
46+
dokkaPlugin("org.jetbrains.dokka:mathjax-plugin")
4547
}
4648
```
4749

4850
> * Built-in plugins (like HTML and Javadoc) are always applied automatically. You only configure them and do not need dependencies for them.
4951
>
50-
> * When documenting multi-module projects (multi-project builds), you need to [share Dokka configuration and plugins across modules](dokka-gradle.md#multi-project-configuration).
52+
> * When documenting multi-module projects (multi-project builds), you need to [share Dokka configuration and plugins across subprojects](dokka-gradle.md#multi-project-configuration).
5153
>
5254
{style="note"}
5355

@@ -138,7 +140,7 @@ custom style sheets (`customStyleSheets` option), and a modified footer message
138140
<tabs group="build-script">
139141
<tab title="Kotlin" group-key="kotlin">
140142

141-
To configure Dokka plugins in a type-safe way, use the `pluginsConfiguration{}` block:
143+
To configure Dokka plugins in a type-safe way, use the `dokka.pluginsConfiguration {}` block:
142144

143145
```kotlin
144146
dokka {
@@ -155,7 +157,7 @@ For an example of Dokka plugins configuration, see the
155157

156158
Dokka allows you
157159
to extend its functionality
158-
by [configuring custom plugins](https://github.com/Kotlin/dokka/blob/ae3840edb4e4afd7b3e3768a5fddfe8ec0e08f31/examples/gradle-v2/custom-dokka-plugin-example/demo-library/build.gradle.kts).
160+
by [configuring custom plugins](https://github.com/Kotlin/dokka/blob/v2.1.0/examples/gradle-v2/custom-dokka-plugin-example/demo-library/build.gradle.kts).
159161
Custom plugins enable additional processing or modifications to the documentation generation process.
160162

161163
</tab>

docs/topics/formats/dokka-html.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
[//]: # (title: HTML)
22

3-
HTML is Dokka's default and recommended output format.
4-
You can see an example of the output by browsing documentation
5-
for [kotlinx.coroutines](https://kotlinlang.org/api/kotlinx.coroutines/).
3+
> This guide applies to Dokka Gradle Plugin (DGP) v2 mode. The previous DGP v1 mode is no longer supported.
4+
> If you're upgrading from v1 to v2 mode, see the [Migration guide](dokka-migration.md).
5+
>
6+
{style="note"}
7+
8+
HTML is Dokka's default and recommended output format.
9+
It provides support for Kotlin Multiplatform, Android, and Java projects.
10+
Additionally, you can use the HTML format to document both single and multi-project builds.
11+
12+
For examples of the HTML output format, check the following docs:
13+
* [kotlinx.coroutines](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/)
14+
* [Bitmovin](https://cdn.bitmovin.com/player/android/3/docs/index.html)
15+
* [Hexagon](https://hexagontk.com/stable/api/)
16+
* [Ktor](https://api.ktor.io/)
17+
* [OkHttp](https://square.github.io/okhttp/5.x/okhttp/okhttp3/)
18+
* [Gradle](https://docs.gradle.org/current/kotlin-dsl/index.html)
619

720
## Generate HTML documentation
821

922
HTML as an output format is supported by all runners. To generate HTML documentation, follow these steps depending on
1023
your build tool or runner:
1124

1225
* For [Gradle](dokka-gradle.md#generate-documentation), run the following tasks:
13-
* `dokkaGeneratePublicationHtml` to generate documentation only in HTML format.
1426
* `dokkaGenerate` to generate documentation in [all available formats based on the applied plugins](dokka-gradle.md#configure-documentation-output-format).
27+
This is the recommended task for most users. When using this task in IntelliJ IDEA, it logs a clickable link to the output.
28+
* `dokkaGeneratePublicationHtml` to generate documentation only in HTML format. This task exposes the output directory
29+
as an `@OutputDirectory`. Use this task when you need to consume the generated files in other Gradle tasks, such
30+
as uploading them to a server, moving them into a GitHub Pages directory, or packaging them into a `javadoc.jar`.
31+
This task is intentionally not shown in Gradle task groups because it is not meant for everyday use.
1532
* For [Maven](dokka-maven.md#generate-documentation), run the `dokka:dokka` goal.
1633
* For [CLI runner](dokka-cli.md#generate-documentation), run with HTML dependencies set.
1734

@@ -206,7 +223,7 @@ You can modify text in the footer by using the `footerMessage` [configuration op
206223
Dokka provides the ability to modify [FreeMarker](https://freemarker.apache.org/) templates used for generating
207224
documentation pages.
208225

209-
You can change the header completely, add your own banners/menus/search, load analytics, change body styling and so on.
226+
You can change the header completely, add your own banners/menus/search, load analytics, change body styling, and so on.
210227

211228
Dokka uses the following templates:
212229

@@ -255,4 +272,4 @@ You can also use the following Dokka-defined [directives](https://freemarker.apa
255272
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
256273
| `<@content/>` | The main page content. |
257274
| `<@resources/>` | Resources such as scripts and stylesheets. |
258-
| `<@version/>` | The module version taken from configuration. If the [versioning plugin](https://github.com/Kotlin/dokka/tree/%dokkaVersion%/dokka-subprojects/plugin-versioning) is applied, it is replaced with a version navigator. |
275+
| `<@version/>` | The subproject version taken from configuration. If the [versioning plugin](https://github.com/Kotlin/dokka/tree/%dokkaVersion%/dokka-subprojects/plugin-versioning) is applied, it is replaced with a version navigator. |

docs/topics/formats/dokka-javadoc.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
[//]: # (title: Javadoc)
22
<primary-label ref="alpha"/>
33

4+
> This guide applies to Dokka Gradle Plugin (DGP) v2 mode. The previous DGP v1 mode is no longer supported.
5+
> If you're upgrading from v1 to v2 mode, see the [Migration guide](dokka-migration.md).
6+
>
7+
{style="note"}
8+
49
Dokka's Javadoc output format is a lookalike of Java's
510
[Javadoc HTML format](https://docs.oracle.com/en/java/javase/19/docs/api/index.html).
611

@@ -19,12 +24,9 @@ and you can find the source code on [GitHub](https://github.com/Kotlin/dokka/tre
1924

2025
## Generate Javadoc documentation
2126

22-
> These instructions reflect Dokka Gradle plugin v1 configuration and tasks. Starting from Dokka 2.0.0, [the Gradle tasks to generate documentation changed](dokka-migration.md#select-documentation-output-format).
23-
> For more details and the full list of changes in Dokka Gradle Plugin v2, see the [Migration guide](dokka-migration.md).
24-
>
25-
> The Javadoc format does not support multiplatform projects.
27+
> The Javadoc format does not support multi-project builds or Kotlin Multiplatform projects.
2628
>
27-
{style="warning"}
29+
{style="tip"}
2830

2931

3032
<tabs group="build-script">
@@ -35,13 +37,14 @@ You need to apply the corresponding plugin id in the `plugins {}` block of your
3537

3638
```kotlin
3739
plugins {
38-
id("org.jetbrains.dokka-javadoc") version "2.0.0"
40+
id("org.jetbrains.dokka-javadoc") version "%dokkaVersion%"
3941
}
4042
```
4143

4244
Once you applied the plugin, you can run the following tasks:
43-
* `dokkaGeneratePublicationJavadoc` to generate documentation only in Javadoc format.
45+
4446
* `dokkaGenerate` to generate documentation in [all available formats based on the applied plugins](dokka-gradle.md#configure-documentation-output-format).
47+
* `dokkaGeneratePublicationJavadoc` to generate documentation only in Javadoc format.
4548

4649
The `javadoc.jar` file can be generated separately. For more information, see [Building `javadoc.jar`](dokka-gradle.md#build-javadoc-jar).
4750

0 commit comments

Comments
 (0)