From fb10fbd619e5023cd5d2acc8cf1f7ee175f1f3bc Mon Sep 17 00:00:00 2001 From: alepedroza <39709865+AlejandraPedroza@users.noreply.github.com> Date: Mon, 10 Feb 2025 14:00:45 +0100 Subject: [PATCH 1/2] This PR contains updates for the DGP V2 Migration guide --- docs/topics/dokka-migration.md | 586 ++++++++++++++++++++++++--------- 1 file changed, 427 insertions(+), 159 deletions(-) diff --git a/docs/topics/dokka-migration.md b/docs/topics/dokka-migration.md index 52c104c02e..93ff3707aa 100644 --- a/docs/topics/dokka-migration.md +++ b/docs/topics/dokka-migration.md @@ -30,43 +30,61 @@ Before starting the migration, complete the following steps. Ensure that your project meets the minimum version requirements: -| **Tool** | **Version** | -|-----------------------|---------------| -| [Gradle](https://docs.gradle.org/current/userguide/upgrading_version_8.html) | 7.6 or higher | +| **Tool** | **Version** | +|-----------------------------------------------------------------------------------|---------------| +| [Gradle](https://docs.gradle.org/current/userguide/upgrading_version_8.html) | 7.6 or higher | | [Android Gradle plugin](https://developer.android.com/build/agp-upgrade-assistant) | 7.0 or higher | -| [Kotlin Gradle plugin](https://kotlinlang.org/docs/gradle-configure-project.html) | 1.9 or higher | +| [Kotlin Gradle plugin](https://kotlinlang.org/docs/gradle-configure-project.html) | 1.9 or higher | ### Enable the new Dokka Gradle plugin -1. Update the Dokka version to 2.0.0 in the `plugins {}` block of your project’s `build.gradle.kts` file: +Update the Dokka version to 2.0.0 in the `plugins {}` block of your project’s `build.gradle.kts` file: - ```kotlin - plugins { - kotlin("jvm") version "1.9.25" - id("org.jetbrains.dokka") version "2.0.0" - } - ``` +```kotlin +plugins { + kotlin("jvm") version "1.9.25" + id("org.jetbrains.dokka") version "2.0.0" +} +``` - Alternatively, you can use [version catalog](https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog) to enable the Dokka Gradle plugin v2. +Alternatively, +you can use [version catalog](https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog) +to enable the Dokka Gradle plugin v2. -2. In the project's `gradle.properties` file, set the following opt-in flag with helpers to activate the new plugin version: +> By default, the DGP v2 generates HTML documentation. To generate Javadoc or both HTML and Javadoc formats, +> add the appropriate plugins. For more information, see [Select documentation output format](#select-documentation-output-format). +> +{style="tip"} - ```text - org.jetbrains.dokka.experimental.gradle.pluginMode=V2EnabledWithHelpers - ``` +### Enable migration helpers + +In the project's `gradle.properties` file, set the following opt-in flag to activate the new plugin version with helpers: + +```text +org.jetbrains.dokka.experimental.gradle.pluginMode=V2EnabledWithHelpers +``` + +> If your project does not have a `gradle.properties` file, create one in the root directory of your project. +> +{style="tip"} - This flag activates the DGP v2 plugin with migration helpers, which prevent compilation errors when build scripts reference - tasks from DGP v1 that are no longer available in DGP v2. You have to [disable](#set-the-opt-in-flag) - the migration helpers after completing your migration. +This flag activates the DGP v2 plugin with migration helpers, which prevent compilation errors when build scripts reference +tasks from DGP v1 that are no longer available in DGP v2. + +> Migration helpers do not actively assist with the migration. They only keep your build script from breaking while you +> transition to the new API. +> +{style="note"} - > If your project does not have a `gradle.properties` file, create one in the root directory of your project. - > - {style="tip"} +Once you complete the migration, you have to [disable the migration helpers](#set-the-opt-in-flag). + +### Sync your project with Gradle -3. Sync your project with Gradle to ensure the new plugin is properly applied: +After enabling the new Dokka Gradle plugin and migration helpers, +sync your project with Gradle to ensure the new plugin is properly applied: - * If you use IntelliJ IDEA, click the **Reload All Gradle Projects** ![Reload button](gradle-reload-button.png){width=30}{type="joined"} button from the Gradle tool window. - * If you use Android Studio, select **File** | **Sync Project with Gradle Files**. +* If you use IntelliJ IDEA, click the **Reload All Gradle Projects** ![Reload button](gradle-reload-button.png){width=30}{type="joined"} button from the Gradle tool window. +* If you use Android Studio, select **File** | **Sync Project with Gradle Files**. ## Migrate your project @@ -77,157 +95,355 @@ After updating the Dokka Gradle plugin to v2, follow the migration steps applica DGP v2 introduces some changes in the [Gradle configuration options](dokka-gradle.md#configuration-options). In the `build.gradle.kts` file, adjust the configuration options according to your project setup: -* **New top-level DSL configuration:** Replace the old configuration syntax with the - new top-level `dokka {}` DSL configuration. For example: - - Previous configuration: - - ```kotlin - tasks.withType().configureEach { - dokkaSourceSets { - named("main") { - moduleName.set("Project Name") - includes.from("README.md") - sourceLink { - localDirectory.set(file("src/main/kotlin")) - remoteUrl.set(URL("https://example.com/src")) - remoteLineSuffix.set("#L") - } - } - } - } +#### New top-level DSL configuration - tasks.dokkaHtml { - pluginConfiguration { - customStyleSheets.set(listOf("styles.css")) - customAssets.set(listOf("logo.png")) - footerMessage.set("(c) Your Company") - } - } - ``` +Replace the old configuration syntax with the new top-level `dokka {}` DSL configuration. For example: + +Previous configuration: + +```kotlin +tasks.withType().configureEach { + dokkaSourceSets { + named("main") { + moduleName.set("Project Name") + includes.from("README.md") + sourceLink { + localDirectory.set(file("src/main/kotlin")) + remoteUrl.set(URL("https://example.com/src")) + remoteLineSuffix.set("#L") + } + } + } +} + +tasks.dokkaHtml { + pluginConfiguration { + customStyleSheets.set(listOf("styles.css")) + customAssets.set(listOf("logo.png")) + footerMessage.set("(c) Your Company") + } +} +``` - New configuration: - - ```kotlin - dokka { - moduleName.set("Project Name") - dokkaSourceSets.main { - includes.from("README.md") - sourceLink { - localDirectory.set(file("src/main/kotlin")) - remoteUrl("https://example.com/src") - remoteLineSuffix.set("#L") - } - } - pluginsConfiguration.html { - customStyleSheets.from("styles.css") - customAssets.from("logo.png") - footerMessage.set("(c) Your Company") - } - } - ``` +New configuration: -* **Visibility settings:** The `documentedVisibilities` property has changed from `Visibility.PUBLIC` to `VisibilityModifier.Public`. +```kotlin +dokka { + moduleName.set("Project Name") + dokkaSourceSets.main { + includes.from("README.md") + sourceLink { + localDirectory.set(file("src/main/kotlin")) + remoteUrl("https://example.com/src") + remoteLineSuffix.set("#L") + } + } + pluginsConfiguration.html { + customStyleSheets.from("styles.css") + customAssets.from("logo.png") + footerMessage.set("(c) Your Company") + } +} +``` - Previous configuration: +#### Visibility settings - ```kotlin - import org.jetbrains.dokka.DokkaConfiguration.Visibility - // ... - documentedVisibilities.set( - setOf(Visibility.PUBLIC) - ) - ``` +The `documentedVisibilities` property has changed from `Visibility.PUBLIC` to `VisibilityModifier.Public`. - New configuration: +Previous configuration: - ```kotlin - import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier - // ... - documentedVisibilities.set( - setOf(VisibilityModifier.Public) - ) - - // OR - - documentedVisibilities(VisibilityModifier.Public) - ``` +```kotlin +import org.jetbrains.dokka.DokkaConfiguration.Visibility - Additionally, DGP v2 has a [utility function](https://github.com/Kotlin/dokka/blob/220922378e6c68eb148fda2ec80528a1b81478c9/dokka-runners/dokka-gradle-plugin/src/main/kotlin/engine/parameters/HasConfigurableVisibilityModifiers.kt#L14-L16) for adding documented visibilities: - - ```kotlin - fun documentedVisibilities(vararg visibilities: VisibilityModifier): Unit = - documentedVisibilities.set(visibilities.asList()) - ``` +// ... +documentedVisibilities.set( + setOf(Visibility.PUBLIC) +) +``` -* **External documentation link:** 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. +New configuration: - Previous configuration: - - ```kotlin - remoteUrl.set(URL("https://github.com/your-repo")) - ``` - - New configuration: - - ```kotlin - remoteUrl.set(URI("https://github.com/your-repo")) - - // OR - - remoteUrl("https://github.com/your-repo") - ``` +```kotlin +import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier + +// ... +documentedVisibilities.set( + setOf(VisibilityModifier.Public) +) + +// OR + +documentedVisibilities(VisibilityModifier.Public) +``` + +Additionally, DGP v2 has a [utility function](https://github.com/Kotlin/dokka/blob/220922378e6c68eb148fda2ec80528a1b81478c9/dokka-runners/dokka-gradle-plugin/src/main/kotlin/engine/parameters/HasConfigurableVisibilityModifiers.kt#L14-L16) for adding documented visibilities: + +```kotlin +fun documentedVisibilities(vararg visibilities: VisibilityModifier): Unit = + documentedVisibilities.set(visibilities.asList()) +``` - Additionally, DGP v2 has two [utility functions](https://github.com/Kotlin/dokka/blob/220922378e6c68eb148fda2ec80528a1b81478c9/dokka-runners/dokka-gradle-plugin/src/main/kotlin/engine/parameters/DokkaSourceLinkSpec.kt#L82-L96) - for setting the URL: +#### Source links - ```kotlin - fun remoteUrl(@Language("http-url-reference") value: String): Unit = - remoteUrl.set(URI(value)) +Allow users to navigate from the generated documentation to the corresponding source code in a remote repository. +To configure source links, use the `dokkaSourceSets.main{}` block. + +Previous configuration: + +```kotlin + tasks.withType().configureEach { + dokkaSourceSets { + named("main") { + sourceLink { + localDirectory.set(file("src/main/kotlin")) + remoteUrl.set(URL("https://github.com/your-repo")) + remoteLineSuffix.set("#L") + } + } + } +} +``` + +New configuration: + +```kotlin + dokka { + moduleName.set("Project Name") + dokkaSourceSets.main { + includes.from("README.md") + sourceLink { + localDirectory.set(file("src/main/kotlin")) + remoteUrl("https://github.com/your-repo") + remoteLineSuffix.set("#L") + } + } +} +``` + +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. + +Previous configuration: + +```kotlin +remoteUrl.set(URL("https://github.com/your-repo")) +``` - // and +New configuration: + +```kotlin +remoteUrl.set(URI("https://github.com/your-repo")) + +// or + +remoteUrl("https://github.com/your-repo") +``` + +Additionally, DGP v2 has two [utility functions](https://github.com/Kotlin/dokka/blob/220922378e6c68eb148fda2ec80528a1b81478c9/dokka-runners/dokka-gradle-plugin/src/main/kotlin/engine/parameters/DokkaSourceLinkSpec.kt#L82-L96) +for setting the URL: + +```kotlin +fun remoteUrl(@Language("http-url-reference") value: String): Unit = + remoteUrl.set(URI(value)) + +// and + +fun remoteUrl(value: Provider): Unit = + remoteUrl.set(value.map(::URI)) +``` + +#### External documentation links configuration + +The `externalDocumentationLinks` API changed, using the `register()` method +to define each link and aligning with Gradle DSL conventions. + +Previous configuration: + +```kotlin +dokka { + this: DokkaExtension + dokkaSourceSets.configureEach { + this: DokkaSourceSetSpec + externalDocumentationLinks { + this: NamedDomainObjectContainerScope -> + url = URL("https://example.com/docs/") + packageListUrl = File("/path/to/package-list").toURI().toURL() + } + externalDocumentationLink { + url = URL("https://example.com/docs/") + packageListUrl = File("/path/to/package-list").toURI().toURL() + } + } +} +``` + +New configuration: + +```kotlin +dokka { + dokkaSourceSets.configureEach { + externalDocumentationLinks.register("example-docs") { + url("https://example.com/docs/") + packageListUrl("https://example.com/docs/package-list") + } + } +} +``` - fun remoteUrl(value: Provider): Unit = - remoteUrl.set(value.map(::URI)) - ``` +#### Custom assets +The [`customAssets`](dokka-html.md#customize-assets) property now uses collections of files ([`FileCollection`)](https://docs.gradle.org/8.10/userguide/lazy_configuration.html#working_with_files_in_lazy_properties) instead of lists (`var List`). -* **Custom assets:** The [`customAssets`](dokka-html.md#customize-assets) property now uses collections of files - ([`FileCollection`)](https://docs.gradle.org/8.10/userguide/lazy_configuration.html#working_with_files_in_lazy_properties) - instead of lists (`var List`). +Previous configuration: - Previous configuration: +```kotlin +customAssets = listOf(file("example.png"), file("example2.png")) +``` - ```kotlin - customAssets = listOf(file("example.png"), file("example2.png")) - ``` +New configuration: + +```kotlin +customAssets.from("example.png", "example2.png") +``` - New configuration: +#### Output directory - ```kotlin - customAssets.from("example.png", "example2.png") - ``` +Use the `dokka {}` block to specify the output directory for the generated Dokka documentation. -* **Output directory:** Use the `dokka {}` block to specify the output directory for generated Dokka documentation. +Previous configuration: + +```kotlin +tasks.dokkaHtml { + outputDirectory.set(layout.buildDirectory.dir("dokkaDir")) +} +``` - Previous configuration: +New configuration: - ```kotlin - tasks.dokkaHtml { +```kotlin +dokka { + dokkaPublications.html { outputDirectory.set(layout.buildDirectory.dir("dokkaDir")) } - ``` +} +``` - New configuration: +#### Output directory for additional files - ```kotlin - dokka { - dokkaPublications.html { - outputDirectory.set(layout.buildDirectory.dir("dokkaDir")) +The ability to set an output directory and include additional files, such as `README.md`, is still supported in +DGP v2. However, you have to now configure it under `dokkaPublications.html` in the `dokka {}` block of the root project. + +Previous configuration: + +```kotlin +tasks.dokkaHtmlMultiModule { + outputDirectory.set(rootDir.resolve("docs/api/0.x")) + includes.from(project.layout.projectDirectory.file("README.md")) +} +``` + +New configuration: + +```kotlin +dokka { + dokkaPublications.html { + outputDirectory.set(rootDir.resolve("docs/api/0.x")) + includes.from(project.layout.projectDirectory.file("README.md")) + } +} +``` + +### Configure Dokka plugins + +Configuring built-in Dokka plugins with JSON has been deprecated in favor of a type-safe DSL. This change improves compatibility +with Gradle's incremental build system and improves task input tracking. + +Previous configuration: + +In DGP v1, Dokka plugins were configured manually using JSON. This approach caused issues with [registering task inputs](https://docs.gradle.org/current/userguide/incremental_build.html) +for Gradle up-to-date checks. + +Here is an example of the deprecated JSON-based configuration for the [Dokka Versioning plugin](https://kotl.in/dokka-versioning-plugin): + +```kotlin +tasks.dokkaHtmlMultiModule { + pluginsMapConfiguration.set( + mapOf( + "org.jetbrains.dokka.versioning.VersioningPlugin" to """ + { "version": "1.2", "olderVersionsDir": "$projectDir/dokka-docs" } + """.trimIndent() + ) + ) +} +``` + +New configuration: + +DGP v2 replaces the JSON-based configuration with a type-safe DSL that is compatible with incremental builds. +Use the `pluginsConfiguration{}` block to configure Dokka plugins in a type-safe way: + +```kotlin +dokka { + pluginsConfiguration { + versioning { + version.set("1.2") + olderVersionsDir.set(projectDir.resolve("dokka-docs")) } } - ``` +} +``` + +### Configure custom Dokka plugins + +Dokka 2.0.0 allows you to extend its functionality by configuring custom plugins, +which enable additional processing or modifications to the documentation generation process. + +To configure a custom Dokka plugin, implement a custom `DokkaPluginParametersBaseSpec` +class in your `build.gradle.kts` file. The following example shows how to define and register a custom plugin parameter class: + +```kotlin +// build.gradle.kts + +plugins { + id("org.jetbrains.dokka") version "2.0.0-Beta" +} + +val dokkaScripts = layout.projectDirectory.dir("dokka-scripts") + +dokka { + pluginsConfiguration { + registerBinding(DokkaScriptsPluginParameters::class, DokkaScriptsPluginParameters::class) + register("DokkaScripts") { + scripts.from(dokkaScripts.asFileTree) + } + } +} + +@OptIn(DokkaInternalApi::class) +abstract class DokkaScriptsPluginParameters @Inject constructor( + name: String +) : DokkaPluginParametersBaseSpec(name, "ca.solostudios.dokkascript.plugin.DokkaScriptsPlugin") { + + @get:InputFiles + @get:PathSensitive(PathSensitivity.RELATIVE) + @get:NormalizeLineEndings + abstract val scripts: ConfigurableFileCollection + + override fun jsonEncode(): String { + val encodedScriptFiles = scripts.files.joinToString { "\"${it.canonicalFile.invariantSeparatorsPath}\"" } + return """ + { + "scripts": [ $encodedScriptFiles ] + } + """.trimIndent() + } +} +``` + +If you need to reuse the plugin across multiple projects, consider moving the class to a shared location like `buildSrc` or a convention plugin. + +> Currently, the `DokkaPluginParametersBaseSpec` implementation requires an opt-in for the internal Dokka Gradle API, but this restriction may be removed in the future. +> +{style="note"} ### Share Dokka configuration across modules @@ -246,8 +462,12 @@ After sharing the Dokka configuration, you can aggregate the documentation from #### Multi-module projects without convention plugins -To share the Dokka configuration in multi-module projects without convention plugins, you need to set up the `buildSrc` directory, -set up the convention plugin, and then apply the plugin to your modules (subprojects). +If you do not use convention plugins in your project, you can still share Dokka configurations by directly configuring each module. +This involves manually setting up the shared configuration in each module's `build.gradle.kts` file. While less centralized, +this approach avoids the need for additional setups like convention plugins. + +Otherwise, you can also share the Dokka configuration in multi-module projects by setting up the `buildSrc` directory and +the convention plugin, and then applying the plugin to your modules (subprojects). ##### Set up the buildSrc directory @@ -304,7 +524,7 @@ After setting up the `buildSrc` directory: Apply the Dokka convention plugin across your modules (subprojects) by adding it to each subproject's `build.gradle.kts` file: ```kotlin -plugins { +plugins { id("dokka-convention") } ``` @@ -321,12 +541,12 @@ Then, follow the steps to [set up the Dokka convention plugin](#set-up-the-dokka Dokka can aggregate the documentation from multiple modules (subprojects) into a single output or publication. As [explained](#apply-the-convention-plugin-to-your-modules), -you must apply the Dokka plugin to all documentable subprojects before aggregating the documentation. +you have to apply the Dokka plugin to all documentable subprojects before aggregating the documentation. -Aggregation in DGP v2 now uses the `dependencies {}` block instead of tasks, and can be added in any `build.gradle.kts` file. +Aggregation in DGP v2 now uses the `dependencies {}` block instead of tasks and can be added in any `build.gradle.kts` file. In DGP v1, aggregation was implicitly created in the root project. To replicate this behavior in DGP v2, add the `dependencies {}` block -in the `build.gradle.kts` file of the root project. +in the `build.gradle.kts` file of the root project. Previous aggregation: @@ -345,6 +565,54 @@ dependencies { } ``` +### Change directory of aggregated documentation + +When DGP aggregates modules, each subproject has its own subdirectory within the aggregated docs. + +In DGP v2, the aggregation mechanism has been updated to better align with Gradle conventions. +DGP v2 now preserves the full subproject directory to prevent conflicts when aggregating +documentation in any location. + +Previous aggregation directory: + +In DGP v1, aggregated documentation was placed in a collapsed directory structure. +For example, given a project with an aggregation in `:turbo-lib` and a nested subproject `:turbo-lib:maths`, +the generated documentation would be placed under: + +```text +turbo-lib/build/dokka/html/maths/ +``` + +New aggregation directory: + +DGP v2 ensures each subproject has a unique directory by retaining the full project structure. The same aggregated documentation +now follows this structure: + +```text +turbo-lib/build/dokka/html/turbo-lib/maths/ +``` + +This change prevents subprojects with the same name from clashing. However, because the directory has changed, external links +may become outdated and cause `404` errors. + +#### Revert to the previous directory behavior + +If your project depends on the old directory structure, you can revert this behavior by manually specifying the module directory. +Add the following configuration to the `build.gradle.kts` file of each subproject: + +```kotlin +// /turbo-lib/maths/build.gradle.kts + +plugins { + id("org.jetbrains.dokka") +} + +dokka { + // Overrides the module directory to match the V1 structure + modulePath.convention("maths") +} +``` + ### Generate documentation with the updated task DGP v2 has renamed the Gradle tasks that generate the API documentation. @@ -354,7 +622,7 @@ Previous task: ```text ./gradlew dokkaHtml -// OR +// or ./gradlew dokkaHtmlMultiModule ``` @@ -397,16 +665,16 @@ or both formats at the same time: 2. Run the corresponding Gradle task. -Here's a list of the plugin `id` and Gradle task that correspond to each format: +Here is a list of the plugin `id` and Gradle task that correspond to each format: | | **HTML** | **Javadoc** | **Both** | |-------------|--------------------------------|-------------------------------------|-----------------------------------| | Plugin `id` | `id("org.jetbrains.dokka")` | `id("org.jetbrains.dokka-javadoc")` | Use both HTML and Javadoc plugins | -| Gradle task | `./gradlew :dokkaGenerateHtml` | `./gradlew :dokkaGenerateJavadoc` | `./gradlew :dokkaGenerate` | +| Gradle task | `./gradlew :dokkaGeneratePublicationHtml` | `./gradlew :dokkaGeneratePublicationJavadoc` | `./gradlew :dokkaGenerate` | > The `dokkaGenerate` task generates documentation in all available formats based on the applied plugins. -> If both the HTML and Javadoc plugins are applied, you can choose to generate only HTML by running the `dokkaGenerateHtml` task, -> or only Javadoc by running the `dokkaGenerateJavadoc` task. +> If both the HTML and Javadoc plugins are applied, you can choose to generate only HTML by running the `dokkaGeneratePublicationHtml` task, +> or only Javadoc by running the `dokkaGeneratePublicationJavadoc` task. > {style="tip"} @@ -473,7 +741,7 @@ In this example, the maximum heap size is set to 4 GB (`"4g"`). Adjust and test 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's recommended that you configure Dokka in a convention +> 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"} From 66fc242c94d7819b38b3a21bf1f4bb6634e068a7 Mon Sep 17 00:00:00 2001 From: alepedroza <39709865+AlejandraPedroza@users.noreply.github.com> Date: Thu, 13 Feb 2025 13:53:22 +0100 Subject: [PATCH 2/2] atyrin review --- docs/topics/dokka-migration.md | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/docs/topics/dokka-migration.md b/docs/topics/dokka-migration.md index 93ff3707aa..a44ba2f2d1 100644 --- a/docs/topics/dokka-migration.md +++ b/docs/topics/dokka-migration.md @@ -42,7 +42,7 @@ Update the Dokka version to 2.0.0 in the `plugins {}` block of your project’s ```kotlin plugins { - kotlin("jvm") version "1.9.25" + kotlin("jvm") version "2.1.10" id("org.jetbrains.dokka") version "2.0.0" } ``` @@ -134,7 +134,7 @@ dokka { includes.from("README.md") sourceLink { localDirectory.set(file("src/main/kotlin")) - remoteUrl("https://example.com/src") + remoteUrl.set(URI("https://example.com/src")) remoteLineSuffix.set("#L") } } @@ -213,7 +213,7 @@ New configuration: includes.from("README.md") sourceLink { localDirectory.set(file("src/main/kotlin")) - remoteUrl("https://github.com/your-repo") + remoteUrl.set(URI("https://github.com/your-repo")) remoteLineSuffix.set("#L") } } @@ -259,18 +259,13 @@ to define each link and aligning with Gradle DSL conventions. Previous configuration: ```kotlin -dokka { - this: DokkaExtension - dokkaSourceSets.configureEach { - this: DokkaSourceSetSpec - externalDocumentationLinks { - this: NamedDomainObjectContainerScope -> - url = URL("https://example.com/docs/") - packageListUrl = File("/path/to/package-list").toURI().toURL() - } - externalDocumentationLink { - url = URL("https://example.com/docs/") - packageListUrl = File("/path/to/package-list").toURI().toURL() +tasks.dokkaHtml { + dokkaSourceSets { + configureEach { + externalDocumentationLink { + url = URL("https://example.com/docs/") + packageListUrl = File("/path/to/package-list").toURI().toURL() + } } } } @@ -404,7 +399,7 @@ class in your `build.gradle.kts` file. The following example shows how to define // build.gradle.kts plugins { - id("org.jetbrains.dokka") version "2.0.0-Beta" + id("org.jetbrains.dokka") version "2.0.0" } val dokkaScripts = layout.projectDirectory.dir("dokka-scripts") @@ -421,7 +416,7 @@ dokka { @OptIn(DokkaInternalApi::class) abstract class DokkaScriptsPluginParameters @Inject constructor( name: String -) : DokkaPluginParametersBaseSpec(name, "ca.solostudios.dokkascript.plugin.DokkaScriptsPlugin") { +) : DokkaPluginParametersBaseSpec(name, "example.dokkascript.plugin.DokkaScriptsPlugin") { @get:InputFiles @get:PathSensitive(PathSensitivity.RELATIVE)