Skip to content

Commit

Permalink
Upgrade to newest Dokka and Knit (#2805)
Browse files Browse the repository at this point in the history
* Migrate to Dokka pre-1.5.0

Co-authored-by: Kamil Doległo <kamilok1965@interia.pl>
Co-authored-by: dkhalanskyjb <52952525+dkhalanskyjb@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 7, 2021
1 parent 4863d73 commit 01994dd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
41 changes: 26 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@

import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.konan.target.HostManager
import org.gradle.util.VersionNumber
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask

apply plugin: 'jdk-convention'
apply from: rootProject.file("gradle/experimental.gradle")

def coreModule = "kotlinx-coroutines-core"
// Not applicable for Kotlin plugin
def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'integration-testing']
def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'integration-testing']
def sourceless = ['kotlinx.coroutines', 'kotlinx-coroutines-bom', 'integration-testing']
def internal = ['kotlinx.coroutines', 'benchmarks', 'integration-testing']
// Not published
def unpublished = internal + ['example-frontend-js', 'android-unit-tests']

Expand Down Expand Up @@ -43,7 +46,7 @@ buildscript {
rootProject.properties.each { key, value ->
if (key.endsWith("_version") && value instanceof String && value.endsWith("-SNAPSHOT")) {
println("NOTE: USING SNAPSHOT VERSION: $key=$value")
ext.using_snapshot_version=true
ext.using_snapshot_version = true
}
}

Expand All @@ -54,11 +57,10 @@ buildscript {
}

repositories {
// Leftover until we migrated to Dokka 1.4.30
maven { url "https://kotlin.bintray.com/kotlin-dev" }
maven { url "https://jetbrains.bintray.com/kotlin-native-dependencies" }
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/" }
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" }
mavenLocal()
}

dependencies {
Expand Down Expand Up @@ -125,7 +127,6 @@ apply plugin: "binary-compatibility-validator"
apiValidation {
ignoredProjects += unpublished + ["kotlinx-coroutines-bom"]
if (build_snapshot_train) {
ignoredProjects.remove("site")
ignoredProjects.remove("example-frontend-js")
ignoredProjects.add("kotlinx-coroutines-core")
}
Expand All @@ -139,6 +140,8 @@ allprojects {
* google should be first in the repository list because some of the play services
* transitive dependencies was removed from jcenter, thus breaking gradle dependency resolution
*/
mavenLocal()
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/" }
google()
mavenCentral()
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" }
Expand Down Expand Up @@ -226,23 +229,25 @@ configure(subprojects.findAll {
}

def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/$coreModule/"
def core_docs_file = "$projectDir/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list"
def core_docs_file = "$projectDir/kotlinx-coroutines-core/build/dokka/htmlPartial/package-list"
apply plugin: "org.jetbrains.dokka"

configure(subprojects.findAll { !unpublished.contains(it.name) }) {
if (it.name != 'kotlinx-coroutines-bom') {
apply from: rootProject.file('gradle/dokka.gradle')
apply from: rootProject.file('gradle/dokka.gradle.kts')
}
apply from: rootProject.file('gradle/publish.gradle')
}

configure(subprojects.findAll { !unpublished.contains(it.name) }) {
if (it.name != "kotlinx-coroutines-bom") {
if (it.name != coreModule) {
dokka.dependsOn project(":$coreModule").dokka
tasks.withType(dokka.getClass()) {
externalDocumentationLink {
url = new URL(core_docs_url)
packageListUrl = new File(core_docs_file).toURI().toURL()
tasks.withType(DokkaTaskPartial.class) {
dokkaSourceSets.configureEach {
externalDocumentationLink {
url.set(new URL(core_docs_url))
packageListUrl.set(new File(core_docs_file).toURI().toURL())
}
}
}
}
Expand Down Expand Up @@ -275,9 +280,15 @@ apply plugin: 'kotlinx-knit'
knit {
siteRoot = "https://kotlin.github.io/kotlinx.coroutines"
moduleRoots = [".", "integration", "reactive", "ui"]
moduleDocs = "build/dokka/htmlPartial"
dokkaMultiModuleRoot = "build/dokka/htmlMultiModule/"
}

knitPrepare.dependsOn getTasksByName("dokka", true)
knitPrepare.dependsOn getTasksByName("dokkaHtmlMultiModule", true)

dependencies {
dokkaHtmlMultiModulePlugin("org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version")
}

// Disable binary compatibility check for JVM IR compiler output by default
if (jvm_ir_enabled) {
Expand Down
4 changes: 4 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ val cacheRedirectorEnabled = System.getenv("CACHE_REDIRECTOR")?.toBoolean() == t
val buildSnapshotTrain = properties["build_snapshot_train"]?.toString()?.toBoolean() == true

repositories {
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/")
mavenLocal()

if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev")
Expand Down Expand Up @@ -47,4 +50,5 @@ fun version(target: String): String {
dependencies {
implementation(kotlin("gradle-plugin", version("kotlin")))
implementation("org.jetbrains.dokka:dokka-gradle-plugin:${version("dokka")}")
implementation("org.jetbrains.dokka:dokka-core:${version("dokka")}")
}
1 change: 1 addition & 0 deletions kotlinx-coroutines-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

apply plugin: 'org.jetbrains.kotlin.multiplatform'
apply plugin: 'org.jetbrains.dokka'
apply from: rootProject.file("gradle/compile-jvm-multiplatform.gradle")
apply from: rootProject.file("gradle/compile-common.gradle")

Expand Down

0 comments on commit 01994dd

Please sign in to comment.