Skip to content

Commit

Permalink
Added utility functions code snippets and fixed code lines
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandraPedroza committed Oct 16, 2024
1 parent a7df554 commit 9e2d6b4
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions docs/topics/dokka-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,40 +147,65 @@ options according to your project setup:
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())
```
* **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.
Previous configuration:
```text
```kotlin
remoteUrl.set(URL("https://github.com/your-repo"))
```
New configuration:
```text
```kotlin
remoteUrl.set(URI("https://github.com/your-repo"))
// OR
// 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<String>): 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<File>`).
Previous configuration:
```text
```kotlin
customAssets = listOf(file("example.png"), file("example2.png"))
```
New configuration:
```text
```kotlin
customAssets.from("example.png", "example2.png")
```
Expand Down Expand Up @@ -235,7 +260,7 @@ set up the convention plugin, and then apply the plugin to your modules (subproj
2. In the `buildSrc/settings.gradle.kts` file, add the following snippet:
```text
```kotlin
rootProject.name = "buildSrc"
```
Expand Down Expand Up @@ -331,7 +356,7 @@ Previous task:
```text
./gradlew dokkaHtml

// OR
// or

./gradlew dokkaHtmlMultiModule
```
Expand Down Expand Up @@ -419,4 +444,4 @@ DGP v2 now supports Gradle build cache and configuration cache, improving build

* Explore more [DGP v2 project examples](https://github.com/Kotlin/dokka/tree/master/examples/gradle-v2).
* [Get started with Dokka](dokka-get-started.md).
* [Learn more about Dokka plugins](dokka-plugins.md).
* [Learn more about Dokka plugins](dokka-plugins.md).

0 comments on commit 9e2d6b4

Please sign in to comment.