-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
89 lines (76 loc) · 2.69 KB
/
build.gradle.kts
File metadata and controls
89 lines (76 loc) · 2.69 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
import dev.detekt.gradle.Detekt
import dev.detekt.gradle.DetektCreateBaselineTask
import dev.detekt.gradle.extensions.DetektExtension
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.detekt)
alias(libs.plugins.dagger.hilt) apply false
// Add Firebase plugins here
alias(libs.plugins.google.gms.services) apply false
alias(libs.plugins.google.firebase.crashlytic) apply false
}
extensions.configure<DetektExtension> {
config.setFrom(rootProject.file("config/detekt/detekt.yml"))
baseline.set(rootProject.file("config/detekt/baseline.xml"))
buildUponDefaultConfig = true
parallel = true
ignoreFailures = false
basePath.set(rootProject.projectDir)
}
subprojects {
fun configureDetekt() {
pluginManager.apply("dev.detekt")
extensions.configure<DetektExtension> {
config.setFrom(rootProject.file("config/detekt/detekt.yml"))
baseline.set(rootProject.file("config/detekt/baseline.xml"))
buildUponDefaultConfig = true
parallel = true
ignoreFailures = false
basePath.set(rootProject.projectDir)
}
tasks.withType(Detekt::class.java).configureEach {
jvmTarget.set("21")
exclude("**/build/**")
reports {
checkstyle.required.set(true)
html.required.set(true)
sarif.required.set(true)
markdown.required.set(true)
}
}
tasks.withType(DetektCreateBaselineTask::class.java).configureEach {
jvmTarget.set("21")
exclude("**/build/**")
enabled = false
}
}
pluginManager.withPlugin("com.android.application") {
configureDetekt()
}
pluginManager.withPlugin("com.android.library") {
configureDetekt()
}
}
val detektProjectBaseline by tasks.registering(DetektCreateBaselineTask::class) {
description = "Creates a shared detekt baseline for all Gradle modules."
buildUponDefaultConfig.set(true)
debug.set(false)
ignoreFailures.set(true)
multiPlatformEnabled.set(false)
noJdk.set(false)
parallel.set(true)
jvmTarget.set("21")
setSource(files(subprojects.map { it.projectDir }))
config.setFrom(files("$rootDir/config/detekt/detekt.yml"))
baseline.set(file("$rootDir/config/detekt/baseline.xml"))
include("**/*.kt")
exclude("**/resources/**")
exclude("**/build/**")
exclude("**/.gradle/**")
}
// Fast way to clean project
tasks.register("clean", Delete::class) {
delete(rootProject.layout.buildDirectory)
}