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
Dokka 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),
222
+
which enable additional processing or modifications to the documentation generation process.
223
+
221
224
## Community
222
225
223
226
Dokka has a dedicated `#dokka` channel in [Kotlin Community Slack](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up)
Given that the source link configuration has [changed](https://docs.gradle.org/current/userguide/upgrading_version_8.html#deprecated_invalid_url_decoding), the remote URL is now specified using the `URI` class instead of the `URL` class.
224
300
225
301
Previous configuration:
@@ -324,8 +400,10 @@ dokka {
324
400
325
401
#### Output directory for additional files
326
402
327
-
The ability to set an output directory and include additional files, such as `README.md`, is still supported in
328
-
DGP v2. However, you have to now configure it under `dokkaPublications.html` in the `dokka {}` block of the root project.
403
+
In DGP v2, the configuration for single-module and multi-module projects is now unified under the `dokka {}` block.
404
+
Instead of configuring `dokkaHtml` and `dokkaHtmlMultiModule` tasks separately, you now specify settings inside the `dokkaPublications.html {}` block.
405
+
406
+
For multi-module projects, you can set the output directory and include additional files (such as `README.md`) in the `dokka {}` block of the root project.
329
407
330
408
Previous configuration:
331
409
@@ -338,7 +416,16 @@ tasks.dokkaHtmlMultiModule {
338
416
339
417
New configuration:
340
418
419
+
Using `build.gradle.kts` files differs from using `.kt` files (such as custom plugins)
420
+
due to the use of type-safe accessors in Kotlin DSL.
Configuring built-in Dokka plugins with JSON has been deprecated in favor of a type-safe DSL. This change improves compatibility
@@ -373,7 +482,9 @@ tasks.dokkaHtmlMultiModule {
373
482
374
483
New configuration:
375
484
376
-
DGP v2 replaces the JSON-based configuration with a type-safe DSL that is compatible with incremental builds.
485
+
DGP v2 replaces the JSON-based configuration with a type-safe DSL that is compatible with incremental builds. See the
486
+
configuration of [Dokka's versioning plugin example](https://github.com/Kotlin/dokka/tree/master/examples/gradle-v2/versioning-multimodule-example).
487
+
377
488
Use the `pluginsConfiguration{}` block to configure Dokka plugins in a type-safe way:
378
489
379
490
```kotlin
@@ -387,59 +498,9 @@ dokka {
387
498
}
388
499
```
389
500
390
-
### Configure custom Dokka plugins
391
-
392
-
Dokka 2.0.0 allows you to extend its functionality by configuring custom plugins,
501
+
Dokka 2.0.0 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),
393
502
which enable additional processing or modifications to the documentation generation process.
394
503
395
-
To configure a custom Dokka plugin, implement a custom `DokkaPluginParametersBaseSpec`
396
-
class in your `build.gradle.kts` file. The following example shows how to define and register a custom plugin parameter class:
397
-
398
-
```kotlin
399
-
// build.gradle.kts
400
-
401
-
plugins {
402
-
id("org.jetbrains.dokka") version "2.0.0"
403
-
}
404
-
405
-
val dokkaScripts = layout.projectDirectory.dir("dokka-scripts")
val encodedScriptFiles = scripts.files.joinToString { "\"${it.canonicalFile.invariantSeparatorsPath}\"" }
428
-
return"""
429
-
{
430
-
"scripts": [ $encodedScriptFiles ]
431
-
}
432
-
""".trimIndent()
433
-
}
434
-
}
435
-
```
436
-
437
-
If you need to reuse the plugin across multiple projects, consider moving the class to a shared location like `buildSrc` or a convention plugin.
438
-
439
-
> Currently, the `DokkaPluginParametersBaseSpec` implementation requires an opt-in for the internal Dokka Gradle API, but this restriction may be removed in the future.
440
-
>
441
-
{style="note"}
442
-
443
504
### Share Dokka configuration across modules
444
505
445
506
DPG v2 moves away from using `subprojects {}` or `allprojects {}` to share configuration across modules. In future Gradle versions,
0 commit comments