1/* 2 * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5apply plugin: 'kotlin' 6apply plugin: 'org.jetbrains.dokka' 7 8def documentedSubprojects = ["kotlinx-serialization-core", 9 "kotlinx-serialization-json", 10 "kotlinx-serialization-json-okio", 11 "kotlinx-serialization-cbor", 12 "kotlinx-serialization-properties", 13 "kotlinx-serialization-hocon", 14 "kotlinx-serialization-protobuf"] 15 16subprojects { 17 if (!(name in documentedSubprojects)) return 18 apply plugin: 'org.jetbrains.dokka' 19 dependencies { 20 dokkaPlugin("org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version") 21 } 22 23 tasks.named('dokkaHtmlPartial') { 24 outputDirectory = file("build/dokka") 25 pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase": """{ "templatesDir": "${rootProject.projectDir.toString().replace('\\', '/')}/dokka-templates" }"""]) 26 27 dokkaSourceSets { 28 configureEach { 29 includes.from(rootProject.file('dokka/moduledoc.md').path) 30 31 perPackageOption { 32 matchingRegex.set("kotlinx\\.serialization(\$|\\.).*") 33 reportUndocumented.set(true) 34 skipDeprecated.set(true) 35 } 36 37 // Internal API 38 perPackageOption { 39 matchingRegex.set("kotlinx\\.serialization.internal(\$|\\.).*") 40 suppress.set(true) 41 } 42 43 // Internal JSON API 44 perPackageOption { 45 matchingRegex.set("kotlinx\\.serialization.json.internal(\$|\\.).*") 46 suppress.set(true) 47 reportUndocumented.set(false) 48 } 49 50 // Workaround for typealias 51 perPackageOption { 52 matchingRegex.set("kotlinx\\.serialization.protobuf.internal(\$|\\.).*") 53 suppress.set(true) 54 reportUndocumented.set(false) 55 } 56 57 // Deprecated migrations 58 perPackageOption { 59 matchingRegex.set("kotlinx\\.protobuf(\$|\\.).*") 60 reportUndocumented.set(true) 61 skipDeprecated.set(true) 62 } 63 64 // Deprecated migrations 65 perPackageOption { 66 matchingRegex.set("org\\.jetbrains\\.kotlinx\\.serialization\\.config(\$|\\.).*") 67 reportUndocumented.set(false) 68 skipDeprecated.set(true) 69 } 70 71 // JS/Native implementation of JVM-only `org.intellij.lang.annotations.Language` class to add syntax support by IDE. 72 perPackageOption { 73 matchingRegex.set("org\\.intellij\\.lang\\.annotations(\$|\\.).*") 74 suppress.set(true) 75 } 76 77 sourceLink { 78 localDirectory.set(rootDir) 79 remoteUrl.set(new URL("https://github.com/Kotlin/kotlinx.serialization/tree/master")) 80 remoteLineSuffix.set("#L") 81 } 82 } 83 } 84 } 85} 86 87// Knit relies on Dokka task and it's pretty convenient 88task dokka(dependsOn: dokkaHtmlMultiModule) {} 89