-
Notifications
You must be signed in to change notification settings - Fork 122
/
build.gradle.kts
63 lines (54 loc) · 1.98 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
kotlin("multiplatform").version(libs.versions.kotlin).apply(false)
alias(libs.plugins.publish).apply(false)
alias(libs.plugins.dokka)
alias(libs.plugins.kotlinBinaryCompatibilityValidator)
}
apiValidation {
// https://github.com/Kotlin/binary-compatibility-validator/issues/3
project("samples").subprojects.mapTo(ignoredProjects) { it.name }
}
fun getPublishVersion(): String {
val version = project.property("VERSION_NAME").toString()
// Call gradle with -PsnapshotVersion to set the version as a snapshot.
if (!project.hasProperty("snapshotVersion")) return version
val buildNumber = System.getenv("GITHUB_RUN_NUMBER") ?: "0"
return "$version.$buildNumber-SNAPSHOT"
}
private val dokkaConfig = mapOf(
"org.jetbrains.dokka.base.DokkaBase" to """{
"footerMessage": "Copyright © 2018 AJ Alt"
}"""
)
subprojects {
project.setProperty("VERSION_NAME", getPublishVersion())
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
tasks.withType<JavaCompile>().configureEach {
options.release.set(8)
}
pluginManager.withPlugin("com.vanniktech.maven.publish") {
apply(plugin = "org.jetbrains.dokka")
}
tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets.configureEach {
reportUndocumented.set(false)
skipDeprecated.set(false)
}
}
tasks.withType<DokkaTaskPartial>().configureEach {
pluginsMapConfiguration.set(dokkaConfig)
}
}
tasks.named<DokkaMultiModuleTask>("dokkaHtmlMultiModule") {
outputDirectory.set(rootProject.rootDir.resolve("docs/api"))
pluginsMapConfiguration.set(dokkaConfig)
}