Skip to content

Commit

Permalink
update Dokka version to 1.8.20 (#89)
Browse files Browse the repository at this point in the history
* update Dokka version to 1.8.20, and update example & template projects

* update KGP to 1.8.22 in Dokkatoo example&test projects

* update 'DON'T COPY' instructions in example projects

* implement Dokkatoo convention plugin in multiplatform-example

* use JS IR in multiplatform-example

* set JVM Toolchain of 8 in it-basic project

* update test values and assertions for new Dokka/Dokkatoo/Kotlin versions

* add doc to dokka-convention example
  • Loading branch information
aSemy authored Jun 12, 2023
1 parent 153c711 commit d63819b
Show file tree
Hide file tree
Showing 57 changed files with 180 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ fun createDokkatooExampleProjectsSettings(
val settingsFiles = projectDir.asFileTree
.matching {
include(
"**/*dokkatoo*/settings.gradle.kts",
"**/*dokkatoo*/settings.gradle",
"**/*dokkatoo*/**/settings.gradle.kts",
"**/*dokkatoo*/**/settings.gradle",
)
}.files

Expand Down Expand Up @@ -105,6 +105,10 @@ val updateDokkatooExamplesBuildFiles by tasks.registering {

val dokkatooVersion = dokkatooVersion

val dokkatooDependencyVersionMatcher = """
\"dev\.adamko\.dokkatoo\:dokkatoo\-plugin\:([^"]+?)\"
""".trimIndent().toRegex()

val dokkatooPluginVersionMatcher = """
id[^"]+?"dev\.adamko\.dokkatoo".+?version "([^"]+?)"
""".trimIndent().toRegex()
Expand All @@ -117,18 +121,23 @@ val updateDokkatooExamplesBuildFiles by tasks.registering {
"**/*dokkatoo*/**/build.gradle",
)
}.elements

outputs.files(gradleBuildFiles)

doLast {
gradleBuildFiles.get().forEach { fileLocation ->
val file = fileLocation.asFile
if (file.exists()) {
file.writeText(
file.readText().replace(dokkatooPluginVersionMatcher) {
val oldVersion = it.groupValues[1]
it.value.replace(oldVersion, dokkatooVersion.get())
})
file.readText()
.replace(dokkatooPluginVersionMatcher) {
val oldVersion = it.groupValues[1]
it.value.replace(oldVersion, dokkatooVersion.get())
}
.replace(dokkatooDependencyVersionMatcher) {
val oldVersion = it.groupValues[1]
it.value.replace(oldVersion, dokkatooVersion.get())
}
)
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions examples/custom-format-example/dokka/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.DokkaBaseConfiguration

plugins {
kotlin("jvm") version "1.8.10"
id("org.jetbrains.dokka") version ("1.7.20")
kotlin("jvm") version "1.8.20"
id("org.jetbrains.dokka") version "1.8.20"
}

buildscript {
dependencies {
classpath("org.jetbrains.dokka:dokka-base:1.7.20")
classpath("org.jetbrains.dokka:dokka-base:1.8.20")
}
}

Expand All @@ -31,6 +31,5 @@ tasks.dokkaHtml {
}

dependencies {
implementation(kotlin("stdlib"))
testImplementation(kotlin("test-junit"))
}
2 changes: 1 addition & 1 deletion examples/custom-format-example/dokkatoo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.8.10"
kotlin("jvm") version "1.8.22"
id("dev.adamko.dokkatoo") version "1.5.0-SNAPSHOT"
}

Expand Down
5 changes: 2 additions & 3 deletions examples/gradle-example/dokka/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import org.jetbrains.dokka.gradle.DokkaTask
import java.net.URL

plugins {
kotlin("jvm") version "1.8.10"
id("org.jetbrains.dokka") version ("1.7.20")
kotlin("jvm") version "1.8.20"
id("org.jetbrains.dokka") version "1.8.20"
}

repositories {
mavenCentral()
}

dependencies {
implementation(kotlin("stdlib"))
testImplementation(kotlin("test-junit"))
}

Expand Down
3 changes: 1 addition & 2 deletions examples/gradle-example/dokkatoo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.8.10"
kotlin("jvm") version "1.8.22"
id("dev.adamko.dokkatoo") version "1.5.0-SNAPSHOT"
}

Expand All @@ -17,7 +17,6 @@ dokkatoo {
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl("https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-gradle-example/src/main/kotlin")
//remoteUrl("https://github.com/adamko-dev/dokkatoo/tree/main/examples/gradle-example/dokkatoo/src/main/kotlin")
remoteLineSuffix.set("#L")
}
}
Expand Down
11 changes: 5 additions & 6 deletions examples/kotlin-as-java-example/dokka/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
plugins {
kotlin("jvm") version "1.8.10"
id("org.jetbrains.dokka") version ("1.7.20")
kotlin("jvm") version "1.8.20"
id("org.jetbrains.dokka") version "1.8.20"
}

repositories {
mavenCentral()
}

dependencies {
implementation(kotlin("stdlib"))
testImplementation(kotlin("test-junit"))

// Will apply the plugin to all Dokka tasks
dokkaPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.7.20")
dokkaPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.8.20")

// Will apply the plugin only to the `:dokkaHtml` task
//dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.7.20")
//dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.8.20")

// Will apply the plugin only to the `:dokkaGfm` task
//dokkaGfmPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.7.20")
//dokkaGfmPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.8.20")
}
9 changes: 2 additions & 7 deletions examples/library-publishing-example/dokka/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
kotlin("jvm") version "1.8.10"
id("org.jetbrains.dokka") version ("1.7.20")
kotlin("jvm") version "1.8.20"
id("org.jetbrains.dokka") version "1.8.20"
`java-library`
`maven-publish`
}
Expand All @@ -10,7 +10,6 @@ repositories {
}

dependencies {
implementation(kotlin("stdlib"))
testImplementation(kotlin("test-junit"))
}

Expand Down Expand Up @@ -38,7 +37,3 @@ publishing {
}
}
}




15 changes: 10 additions & 5 deletions examples/multimodule-example/dokka/parentProject/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.jetbrains.dokka.DokkaConfiguration.Visibility
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import java.net.URL

plugins {
kotlin("jvm")
Expand All @@ -17,6 +18,15 @@ subprojects {
Visibility.PUBLIC,
Visibility.PROTECTED
))

// Read docs for more details: https://kotlinlang.org/docs/dokka-gradle.html#source-link-configuration
sourceLink {
val exampleDir = "https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-multimodule-example"

localDirectory.set(rootProject.projectDir)
remoteUrl.set(URL("$exampleDir"))
remoteLineSuffix.set("#L")
}
}
}
}
Expand All @@ -26,8 +36,3 @@ subprojects {
tasks.dokkaHtmlMultiModule {
moduleName.set("Dokka MultiModule Example")
}

dependencies {
implementation(kotlin("stdlib"))
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ plugins {
id("org.jetbrains.dokka")
}

dependencies {
implementation(kotlin("stdlib"))
}

// configuration specific to this subproject.
// notice the use of Partial task
tasks.withType<DokkaTaskPartial>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ plugins {
id("org.jetbrains.dokka")
}

dependencies {
implementation(kotlin("stdlib"))
}

// configuration specific to this subproject.
// notice the use of Partial task
tasks.withType<DokkaTaskPartial>().configureEach {
Expand Down
10 changes: 10 additions & 0 deletions examples/multimodule-example/dokkatoo/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import org.gradle.kotlin.dsl.support.expectedKotlinDslPluginsVersion

plugins {
`kotlin-dsl`
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22")
implementation("dev.adamko.dokkatoo:dokkatoo-plugin:1.5.0-SNAPSHOT")
}
21 changes: 21 additions & 0 deletions examples/multimodule-example/dokkatoo/buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
rootProject.name = "buildSrc"

pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven(providers.gradleProperty("testMavenRepo"))
}
}

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {

repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

repositories {
mavenCentral()
gradlePluginPortal()
maven(providers.gradleProperty("testMavenRepo"))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Common conventions for generating documentation with Dokkatoo.
*/

plugins {
id("dev.adamko.dokkatoo")
}

dokkatoo {
dokkatooSourceSets.configureEach {
sourceLink {
// Read docs for more details: https://kotlinlang.org/docs/dokka-gradle.html#source-link-configuration
remoteUrl("https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-multimodule-example")
localDirectory.set(rootDir)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
plugins {
kotlin("jvm") version "1.7.20" apply false
id("dev.adamko.dokkatoo") version "1.5.0-SNAPSHOT"
kotlin("jvm") apply false
`dokka-convention`
}

dependencies {
dokkatoo(project(":parentProject:childProjectA"))
dokkatoo(project(":parentProject:childProjectB"))
dokkatooPluginHtml("org.jetbrains.dokka:all-modules-page-plugin:1.7.20")
dokkatooPluginHtml("org.jetbrains.dokka:templating-plugin:1.7.20")
dokkatooPluginHtml(
dokkatoo.versions.jetbrainsDokka.map { dokkaVersion ->
"org.jetbrains.dokka:all-modules-page-plugin:$dokkaVersion"
}
)
dokkatooPluginHtml(
dokkatoo.versions.jetbrainsDokka.map { dokkaVersion ->
"org.jetbrains.dokka:templating-plugin:$dokkaVersion"
}
)
}

dokkatoo {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
plugins {
kotlin("jvm")
id("dev.adamko.dokkatoo") version "1.5.0-SNAPSHOT"
`dokka-convention`
}

dokkatoo {
dokkatooSourceSets.configureEach {
includes.from("ModuleA.md")
}
modulePath.set("childProjectA") // match the original dokka default
}

//region DON'T COPY - this is only needed for internal Dokkatoo integration tests
dokkatoo {
modulePath.set("childProjectA") // match the original dokka default
}
tasks.withType<dev.adamko.dokkatoo.tasks.DokkatooGenerateTask>().configureEach {
generator.dokkaSourceSets.configureEach {
sourceSetScope.set(":parentProject:childProjectA:dokkaHtmlPartial")
}
}
//endregion
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
plugins {
kotlin("jvm")
id("dev.adamko.dokkatoo") version "1.5.0-SNAPSHOT"
`dokka-convention`
}

dokkatoo {
dokkatooSourceSets.configureEach {
includes.from("ModuleB.md")
}
modulePath.set("childProjectB") // match the original dokka default
}

//region DON'T COPY - this is only needed for internal Dokkatoo integration tests
dokkatoo {
modulePath.set("childProjectB") // match the original dokka default
}
tasks.withType<dev.adamko.dokkatoo.tasks.DokkatooGenerateTask>().configureEach {
generator.dokkaSourceSets.configureEach {
sourceSetScope.set(":parentProject:childProjectB:dokkaHtmlPartial")
}
}
//endregion
5 changes: 1 addition & 4 deletions examples/multimodule-example/dokkatoo/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
rootProject.name = "dokkatoo-multimodule-example"

pluginManagement {
plugins {
kotlin("jvm") version "1.7.20"
}
repositories {
gradlePluginPortal()
mavenCentral()
gradlePluginPortal()
maven(providers.gradleProperty("testMavenRepo"))
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/multiplatform-example/dokka/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.Platform

plugins {
kotlin("multiplatform") version "1.8.10"
id("org.jetbrains.dokka") version "1.7.20"
kotlin("multiplatform") version "1.8.20"
id("org.jetbrains.dokka") version "1.8.20"
}

repositories {
Expand Down
Loading

0 comments on commit d63819b

Please sign in to comment.