-
Notifications
You must be signed in to change notification settings - Fork 43
/
build.gradle.kts
126 lines (116 loc) · 4.15 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
123
124
125
126
import com.android.build.gradle.BaseExtension
import io.gitlab.arturbosch.detekt.Detekt
import kotlinx.kover.gradle.plugin.dsl.KoverReportExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
plugins {
alias(libs.plugins.detekt)
alias(libs.plugins.kover)
alias(libs.plugins.ktlint)
alias(libs.plugins.aboutlibraries) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.google.dagger.hilt.android) apply false
alias(libs.plugins.google.devtools.ksp) apply false
alias(libs.plugins.kotlin.android) apply false
}
subprojects {
afterEvaluate {
if (plugins.hasPlugin("android") || plugins.hasPlugin("android-library")) {
apply(plugin = "org.jetbrains.kotlinx.kover")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
configure<BaseExtension> {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
testOptions {
unitTests {
all {
it.ignoreFailures = true
}
}
}
}
configure<KotlinAndroidProjectExtension> {
jvmToolchain(17)
}
configure<KoverReportExtension> {
defaults {
mergeWith("debug")
}
}
configure<KtlintExtension> {
verbose = true
android = true
outputToConsole = true
disabledRules = listOf("max-line-length")
reporters {
reporter(ReporterType.PLAIN)
}
}
}
}
}
tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
}
tasks.register<Detekt>("detektCheck") {
parallel = true
setSource(files(projectDir))
include("**/*.kt")
include("**/*.kts")
exclude("**/resources/**")
exclude("**/build/**")
config.setFrom(files("$rootDir/config/detekt/detekt.yml"))
buildUponDefaultConfig = false
}
private val excludeProjects = setOf(
":core", // Container project
":core:compose", // UI Logic
":features", // Container project
":libraries", // Container project
":libraries:datasource", // Container project
":testing" // Test code
)
dependencies {
detektPlugins(libs.detekt.compose)
detektPlugins(libs.detekt.formatting)
detektPlugins(libs.detekt.kotlin.compiler)
subprojects.forEach { subproject ->
if (!excludeProjects.contains(subproject.path)) {
kover(subproject)
}
}
}
koverReport {
filters {
excludes {
classes(
listOf(
"*.databinding.*", // Autogen ViewBinding
"dagger.*", // Autogen Dagger code
"hilt_*", // Autogen Hilt code
"*BuildConfig", // Autogen Build file
"*ComposableSingletons\$*", // Autogen Compose code
"*JsonAdapter", // Autogen Moshi code
"*Directions\$*", // Autogen Navigation
"*_AssistedFactory_Impl", // Autogen Dagger code
"*_Factory", // Autogen Dagger code
"*_Factory\$*", // Autogen Dagger code
"*_HiltModules*", // Autogen Dagger code
"*_MembersInjector", // Autogen Dagger code
"*Activity", // Activities
"*Activity\$*", // Activities
"*Fragment", // Fragments
"*Fragment\$*", // Fragments
"*ScreenKt*", // Compose screens
"*ScreenKt*\$*", // Compose screens
"com.chesire.nekome.injection.*" // Dagger injection code
)
)
annotatedBy("androidx.compose.runtime.Composable")
}
}
}