-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
73 lines (65 loc) · 2.09 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
64
65
66
67
68
69
70
71
72
73
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
import org.jetbrains.dokka.versioning.VersioningConfiguration
import org.jetbrains.dokka.versioning.VersioningPlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.3")
classpath(embeddedKotlin("gradle-plugin"))
classpath("org.jetbrains.dokka:versioning-plugin:1.5.31")
}
}
plugins {
id("com.diffplug.spotless")
id("org.jetbrains.dokka")
}
allprojects {
apply(plugin = "com.diffplug.spotless")
spotless {
kotlin {
target("**/*.kt")
targetExclude("$buildDir/**/*.kt")
ktlint()
}
kotlinGradle {
ktlint()
}
}
tasks.withType(KotlinCompile::class).all {
if (System.getenv("CI") == "true") kotlinOptions.allWarningsAsErrors = true
}
}
val dokkaHtmlMultiModule by tasks.existing(DokkaMultiModuleTask::class) {
failOnWarning.set(true)
pluginConfiguration<VersioningPlugin, VersioningConfiguration> {
val olderDokkaVersionsDir: String? by project
version = liveCallbackVersion
olderVersionsDir = olderDokkaVersionsDir?.let { projectDir.resolve(it) }
}
}
val dokkaHtmlMultiModuleVersioning by tasks.registering {
dependsOn(dokkaHtmlMultiModule)
doLast {
val olderDokkaVersionsDir: String? by project
val docsOutputDir: String by project
val outputDir = dokkaHtmlMultiModule.map(DokkaMultiModuleTask::outputDirectory)
val createdVersionDir = "$olderDokkaVersionsDir/$liveCallbackVersion"
copy {
from(outputDir)
into(docsOutputDir)
}
copy {
from(docsOutputDir)
into(createdVersionDir)
exclude("older/")
}
}
}
val liveCallbackVersion by extra("1.0.0")
val lifecycleVersion by extra("2.4.0")
val junitVersion by extra("4.13.2")