-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
115 lines (103 loc) · 3.98 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
115 lines (103 loc) · 3.98 KB
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
import io.gitlab.arturbosch.detekt.DetektPlugin
plugins {
base // expose `clear` task, so we can modify it
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
alias(libs.plugins.android.lint) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.jetbrains.compose) apply false
alias(libs.plugins.detekt)
alias(libs.plugins.hilt) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.m2p) apply false
}
detekt {
config.from(files("config/detekt/detekt.yml"))
buildUponDefaultConfig = true
parallel = true
}
// not include `includeBuild` (tiamat-dest gradle & kotlin plugins)
// as they are not projects (they are count as included-projects)
allprojects {
apply<DetektPlugin>()
detekt {
buildUponDefaultConfig = true
parallel = true
autoCorrect = true
source.from(
files(
"src/commonMain/kotlin",
"src/commonTest/kotlin",
"src/jvmMain/kotlin",
"src/desktopMain/kotlin",
"src/androidMain/kotlin",
"src/iosMain/kotlin",
"src/wasmJsMain/kotlin",
)
)
}
dependencies {
detektPlugins(rootProject.project.libs.detekt.compose)
detektPlugins(rootProject.project.libs.detekt.formatting)
}
}
// check ABI
tasks.register("checkAbi") {
dependsOn(":tiamat:checkLegacyAbi")
dependsOn(gradle.includedBuild("tiamat-destinations-compiler").task(":checkLegacyAbi"))
dependsOn(gradle.includedBuild("tiamat-destinations-gradle-plugin").task(":checkLegacyAbi"))
}
// update ABI
tasks.register("updateAbi") {
dependsOn(":tiamat:updateLegacyAbi")
dependsOn(gradle.includedBuild("tiamat-destinations-compiler").task(":updateLegacyAbi"))
dependsOn(gradle.includedBuild("tiamat-destinations-gradle-plugin").task(":updateLegacyAbi"))
}
// run static analysis on all projects
tasks.register("runStaticAnalysis") {
allprojects {
tasks.matching { it.name == "detekt" }.forEach { detektTask ->
dependsOn(detektTask)
}
}
dependsOn(":tiamat:lint")
}
// root `clean` task not include subprojects by default, so add them directly
rootProject.tasks["clean"].apply {
dependsOn(gradle.includedBuild("tiamat-destinations-compiler").task(":clean"))
dependsOn(gradle.includedBuild("tiamat-destinations-gradle-plugin").task(":clean"))
}
rootProject.tasks.register("createLocalM2") {
val publishTasks = allprojects
.filter { it.extensions.findByType<M2PExtension>() != null }
.map { it.tasks["publish"] }
dependsOn(publishTasks)
dependsOn(gradle.includedBuild("tiamat-destinations-compiler").task(":publish"))
dependsOn(gradle.includedBuild("tiamat-destinations-gradle-plugin").task(":publish"))
doLast {
val m2Dir = File(rootDir, "build/m2")
fileTree(m2Dir).files.onEach {
if (
it.name.endsWith(".asc.md5") or
it.name.endsWith(".asc.sha1") or
it.name.endsWith(".sha256") or
it.name.endsWith(".sha512") or
it.name.equals("maven-metadata.xml.sha1") or
it.name.equals("maven-metadata.xml.md5") or
it.name.equals("maven-metadata.xml")
) it.delete()
}
}
}
rootProject.tasks.register("tiamatCleanJvmTest") {
dependsOn(":tiamat:cleanJvmTest")
dependsOn("tiamat-destinations:tiamat-destinations:cleanJvmTest")
}
rootProject.tasks.register("tiamatJvmTests") {
dependsOn(":tiamat:jvmTest")
dependsOn("tiamat-destinations:tiamat-destinations:jvmTest")
dependsOn(gradle.includedBuild("tiamat-destinations-compiler").task(":test"))
}
rootProject.tasks["tiamatJvmTests"].shouldRunAfter("tiamat-destinations:tiamat-destinations:cleanJvmTest")