tgbotapi/docs/build.gradle

103 lines
2.6 KiB
Groovy
Raw Normal View History

2020-05-10 19:09:07 +00:00
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
2020-10-19 01:38:16 +00:00
classpath("org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}")
2020-05-10 19:09:07 +00:00
}
}
plugins {
2020-08-18 06:50:11 +00:00
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization"
2020-05-10 19:09:07 +00:00
id "org.jetbrains.dokka" version "$dokka_version"
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
kotlin {
jvm()
2020-08-20 04:51:05 +00:00
js(BOTH) {
2020-08-19 07:49:30 +00:00
browser()
nodejs()
}
2020-05-10 19:09:07 +00:00
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib')
project.parent.subprojects.forEach {
if (it != project) {
api it
}
}
}
}
}
}
2020-05-11 07:56:09 +00:00
private Closure includeSourcesInDokka(String... approximateNames) {
2020-05-10 19:09:07 +00:00
return {
parent.subprojects.forEach {
if (it != project) {
File srcDir = new File(it.projectDir.absolutePath, "src")
if (srcDir.exists() && srcDir.isDirectory()) {
2020-05-11 07:56:09 +00:00
srcDir.eachFile { file ->
if (approximateNames.any { file.name.contains(it) } && file.isDirectory()) {
String pathToSrc = file.absolutePath
2020-05-10 19:09:07 +00:00
sourceRoot {
path = pathToSrc
}
}
}
}
}
}
}
}
2020-10-19 01:38:16 +00:00
tasks.dokkaHtml {
switch (true) {
case project.hasProperty("DOKKA_PATH"):
outputDirectory = project.property("DOKKA_PATH").toString()
break
case System.getenv("DOKKA_PATH") != null:
outputDirectory = System.getenv("DOKKA_PATH")
break
}
2020-05-10 19:09:07 +00:00
2020-10-19 01:38:16 +00:00
dokkaSourceSets {
configureEach {
skipDeprecated.set(true)
2020-05-10 19:09:07 +00:00
sourceLink {
2020-10-19 01:38:16 +00:00
localDirectory.set(file("./"))
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/"))
remoteLineSuffix.set("#L")
2020-05-10 19:09:07 +00:00
}
}
2020-10-19 01:38:16 +00:00
named("commonMain") {
includeSourcesInDokka("commonMain")
}
named("jsMain") {
includeSourcesInDokka("jsMain/*", "commonMain/*")
}
named("jvmMain") {
includeSourcesInDokka("jvmMain/*", "commonMain/*")
}
2020-05-10 19:09:07 +00:00
}
}