From 5b325a8ff94d3233b3933e9a929b1194382c40a1 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 28 Oct 2020 14:47:12 +0600 Subject: [PATCH] add dokka --- dokka/build.gradle | 88 +++++++++++++++++++++++++++++++++++++++++ dokka/gradle.properties | 3 ++ settings.gradle | 4 +- 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 dokka/build.gradle create mode 100644 dokka/gradle.properties diff --git a/dokka/build.gradle b/dokka/build.gradle new file mode 100644 index 00000000000..b619aa90912 --- /dev/null +++ b/dokka/build.gradle @@ -0,0 +1,88 @@ +buildscript { + repositories { + mavenLocal() + jcenter() + mavenCentral() + } + + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" + classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" + } +} + +plugins { + id "org.jetbrains.kotlin.multiplatform" + id "org.jetbrains.kotlin.plugin.serialization" + id "org.jetbrains.dokka" version "$dokka_version" +} + +repositories { + mavenLocal() + jcenter() + mavenCentral() +} + +kotlin { + jvm() + js(BOTH) { + browser() + nodejs() + } + + sourceSets { + commonMain { + dependencies { + implementation kotlin('stdlib') + + project.parent.subprojects.forEach { + if ( + it != project + && it.hasProperty("kotlin") + && it.kotlin.sourceSets.any { it.name.contains("commonMain") } + ) { + api it + } + } + } + } + } +} + +private List findSourcesWithName(String... approximateNames) { + return parent.subprojects + .findAll { it != project && it.hasProperty("kotlin") } + .collectMany { it.kotlin.sourceSets } + .findAll { sourceSet -> + approximateNames.any { nameToFilter -> + sourceSet.name.contains(nameToFilter) + } + }.collect { it.kotlin } +} + +tasks.dokkaHtml { + dokkaSourceSets { + configureEach { + skipDeprecated.set(true) + + sourceLink { + localDirectory.set(file("./")) + remoteUrl.set(new URL("https://github.com/InsanusMokrassar/MicroUtils/blob/master/")) + remoteLineSuffix.set("#L") + } + } + + named("commonMain") { + sourceRoots.setFrom(findSourcesWithName("commonMain")) + } + + named("jsMain") { + sourceRoots.setFrom(findSourcesWithName("jsMain", "commonMain")) + } + + named("jvmMain") { + sourceRoots.setFrom(findSourcesWithName("jvmMain", "commonMain")) + } + } +} diff --git a/dokka/gradle.properties b/dokka/gradle.properties new file mode 100644 index 00000000000..55021b5f4e7 --- /dev/null +++ b/dokka/gradle.properties @@ -0,0 +1,3 @@ +dokka_version=1.4.0 + +org.gradle.jvmargs=-Xmx1024m diff --git a/settings.gradle b/settings.gradle index 54fb4ed3371..92804fc0013 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,7 +16,9 @@ String[] includes = [ ":ktor:server", ":ktor:common", ":ktor:client", - ":coroutines" + ":coroutines", + + ":dokka" ]