103 lines
2.6 KiB
Groovy
103 lines
2.6 KiB
Groovy
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) {
|
|
api it
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private Closure includeSourcesInDokka(String... approximateNames) {
|
|
return {
|
|
parent.subprojects.forEach {
|
|
if (it != project) {
|
|
File srcDir = new File(it.projectDir.absolutePath, "src")
|
|
if (srcDir.exists() && srcDir.isDirectory()) {
|
|
srcDir.eachFile { file ->
|
|
if (approximateNames.any { file.name.contains(it) } && file.isDirectory()) {
|
|
String pathToSrc = file.absolutePath
|
|
sourceRoot {
|
|
path = pathToSrc
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
dokkaSourceSets {
|
|
configureEach {
|
|
skipDeprecated.set(true)
|
|
|
|
sourceLink {
|
|
localDirectory.set(file("./"))
|
|
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/"))
|
|
remoteLineSuffix.set("#L")
|
|
}
|
|
}
|
|
|
|
named("commonMain") {
|
|
includeSourcesInDokka("commonMain")
|
|
}
|
|
|
|
named("jsMain") {
|
|
includeSourcesInDokka("jsMain/*", "commonMain/*")
|
|
}
|
|
|
|
named("jvmMain") {
|
|
includeSourcesInDokka("jvmMain/*", "commonMain/*")
|
|
}
|
|
}
|
|
}
|