-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
70 lines (63 loc) · 2.71 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
70 lines (63 loc) · 2.71 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
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.android.kmp.library) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.sqldelight) apply false
alias(libs.plugins.ktlint)
alias(libs.plugins.detekt)
}
allprojects {
apply(plugin = rootProject.libs.plugins.ktlint.get().pluginId)
apply(plugin = rootProject.libs.plugins.detekt.get().pluginId)
// Generated sources are excluded through .editorconfig rather than a ktlint filter here:
// the filter closure captures Project, which the configuration cache rejects.
detekt {
buildUponDefaultConfig = true
config.setFrom(rootProject.files("config/detekt/detekt.yml"))
parallel = true
}
// detekt 1.23 embeds a Kotlin compiler whose IntelliJ `JavaVersion.parse` cannot read a
// JDK 25 version string, and dies with `IllegalArgumentException: 25.0.3` before it
// analyses anything. The task has no `javaLauncher`, so the JVM is pinned in
// gradle.properties instead. This only sets the bytecode target.
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
jvmTarget = "21"
}
}
/**
* The gate CI runs, and the one to run locally before pushing.
*
* Ordered cheapest-first so a formatting slip fails in seconds rather than after a full
* Android build. `ktlintCheck` only verifies; `./gradlew ktlintFormat` fixes what it can.
*/
tasks.register("ciCheck") {
group = "verification"
description = "Formatting, static analysis, unit tests and a debug build."
dependsOn(
"ktlintCheck",
"detekt",
// The KMP module has no plain `test` task; its unit tests are the Android host tests.
":shared:testAndroid",
":composeApp:testDebugUnitTest",
":composeApp:assembleDebug",
// Android Lint catches a different class of problem from ktlint and detekt: invalid
// resources, manifest mistakes, unsafe API levels. It is what failed the first
// release build, long after the code itself was "clean".
":composeApp:lintDebug",
)
}
/**
* The same gate plus the instrumented suite, which needs a device or emulator attached.
* Kept separate from [ciCheck] so the common case stays device-free and fast.
*/
tasks.register("ciCheckDevice") {
group = "verification"
description = "Everything ciCheck runs, plus the on-device end-to-end tests."
dependsOn("ciCheck", ":composeApp:connectedDebugAndroidTest")
}
tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}