From aa78d991792f8e9083235f20d4b07fb27b82d0fc Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 11 May 2020 01:09:07 +0600 Subject: [PATCH] add docs project --- docs/build.gradle | 87 ++++++++++++++++++++++++++++++++++++++++++ docs/gradle.properties | 1 + settings.gradle | 1 + 3 files changed, 89 insertions(+) create mode 100644 docs/build.gradle create mode 100644 docs/gradle.properties diff --git a/docs/build.gradle b/docs/build.gradle new file mode 100644 index 0000000000..32373a856f --- /dev/null +++ b/docs/build.gradle @@ -0,0 +1,87 @@ +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" version "$kotlin_version" + id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" + id "org.jetbrains.dokka" version "$dokka_version" +} + +repositories { + mavenLocal() + jcenter() + mavenCentral() +} + +kotlin { + jvm() + js() + + sourceSets { + commonMain { + dependencies { + implementation kotlin('stdlib') + + project.parent.subprojects.forEach { + if (it != project) { + api it + } + } + } + } + } +} + +private Closure includeSourcesInDokka(String approximateName) { + return { + parent.subprojects.forEach { + if (it != project) { + File srcDir = new File(it.projectDir.absolutePath, "src") + if (srcDir.exists() && srcDir.isDirectory()) { + srcDir.eachFile { + println(it.absolutePath) + if (it.name.contains(approximateName) && it.isDirectory()) { + String pathToSrc = it.absolutePath + sourceRoot { + path = pathToSrc + } + } + } + } + } + } + } +} + +dokka { + outputFormat = 'html' + outputDirectory = "$buildDir/dokka" + disableAutoconfiguration = true + + multiplatform { + global { + skipDeprecated = true + + sourceLink { + path = "./" + url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/" + lineSuffix = "#L" + } + } + + common(includeSourcesInDokka("commonMain")) + js(includeSourcesInDokka("jsMain")) + jvm(includeSourcesInDokka("jvmMain")) + } +} diff --git a/docs/gradle.properties b/docs/gradle.properties new file mode 100644 index 0000000000..8bc46f176d --- /dev/null +++ b/docs/gradle.properties @@ -0,0 +1 @@ +dokka_version=0.10.1 diff --git a/settings.gradle b/settings.gradle index 001fc379e6..80b7407c7b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,4 @@ include ":TelegramBotAPI" include ":TelegramBotAPI-extensions-api" include ":TelegramBotAPI-extensions-utils" +include ":docs"