-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle.kts
122 lines (105 loc) · 3.32 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* Designed and developed by Duckie Team, 2022~2023
*
* Licensed under the MIT.
* Please see full license: https://github.com/duckie-team/quack-quack-android/blob/master/LICENSE
*/
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension
plugins {
alias(libs.plugins.kotlin.detekt)
alias(libs.plugins.kotlin.ktlint)
alias(libs.plugins.kotlin.dokka)
alias(libs.plugins.gradle.dependency.graph)
alias(libs.plugins.gradle.dependency.handler.extensions)
alias(libs.plugins.test.roborazzi) apply false
idea
}
tasks.dokkaHtmlMultiModule {
outputDirectory.set(file("website/static/api"))
}
private val quackquackColor = "#36bcf5"
private val projectDependencyInfoMap = mapOf(
"casa" to DependencyInfo(color = "#D4C5F9"),
"catalog" to DependencyInfo(color = "#8ED610", isBoxShape = true),
"aide" to DependencyInfo(color = "#98E1CF"),
"sugar" to DependencyInfo(color = "#BFD4F2"),
"runtime" to DependencyInfo(color = quackquackColor),
"material" to DependencyInfo(color = quackquackColor),
"animation" to DependencyInfo(color = quackquackColor),
"ui" to DependencyInfo(color = quackquackColor),
)
dependencyGraphConfig {
dotFilePath = "assets/project-dependency-graph.dot"
outputFormat = OutputFormat.SVG
dependencyBuilder { project ->
val projectSimpleName = project.name.split("-").first()
projectDependencyInfoMap[projectSimpleName]
}
}
@Suppress("ktlint")
tasks.matching { task ->
task.name.contains("dependencyGraph")
}.configureEach {
notCompatibleWithConfigurationCache("https://github.com/jisungbin/dependency-graph-plugin/issues/8")
}
idea {
module {
excludeDirs = excludeDirs + file("website")
}
}
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath(libs.kotlin.dokka)
classpath(libs.kotlin.gradle)
classpath(libs.gradle.android)
}
}
allprojects {
val nospotless = File(projectDir, ".nospotless").exists()
repositories {
google()
mavenCentral()
}
apply {
plugin(rootProject.libs.plugins.kotlin.dokka.get().pluginId)
plugin(rootProject.libs.plugins.gradle.dependency.handler.extensions.get().pluginId)
if (!nospotless) {
plugin(rootProject.libs.plugins.kotlin.detekt.get().pluginId)
plugin(rootProject.libs.plugins.kotlin.ktlint.get().pluginId)
}
}
afterEvaluate {
if (pluginManager.hasPlugin(rootProject.libs.plugins.kotlin.detekt.get().pluginId)) {
extensions.configure<DetektExtension> {
parallel = true
buildUponDefaultConfig = true
toolVersion = libs.versions.kotlin.detekt.get()
config.setFrom(files("$rootDir/detekt-config.yml"))
}
}
if (pluginManager.hasPlugin(rootProject.libs.plugins.kotlin.ktlint.get().pluginId)) {
extensions.configure<KtlintExtension> {
version.set(rootProject.libs.versions.kotlin.ktlint.source.get())
android.set(true)
verbose.set(true)
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + listOf(
"-opt-in=kotlin.OptIn",
"-opt-in=kotlin.RequiresOptIn",
)
}
}
}
}
tasks.register("cleanAll", type = Delete::class) {
allprojects.map(Project::getBuildDir).forEach(::delete)
}