-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
131 lines (119 loc) · 4.1 KB
/
build.gradle
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
127
128
129
130
131
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath(libs.gradle)
classpath(libs.agp)
classpath(libs.karumi.shot)
classpath libs.hilt.android.gradle.plugin
classpath libs.jacoco
}
}
plugins {
alias(libs.plugins.com.android.application) apply false
alias(libs.plugins.com.android.library) apply false
alias(libs.plugins.org.jetbrains.kotlin.android) apply false
alias(libs.plugins.com.google.dagger.hilt.android) apply false
alias(libs.plugins.io.gitlab.arturbosch.detekt)
alias(libs.plugins.com.google.devtools.ksp) apply false
id("application")
}
project.afterEvaluate {
tasks.register('unitTests', TestReport) {
description = "Generates a combined test report for all modules"
group = "verification"
def results = subprojects.collect { subproject ->
subproject.tasks.findAll { task ->
if (task.name == "testDebugUnitTest") {
dependsOn task
task.binaryResultsDirectory
}
}
}
testResults.from(results)
destinationDirectory = file("$buildDir/reports/tests/aggregate")
}
tasks.register("jacocoCoverageVerification", JacocoCoverageVerification) {
classDirectories = tasks.named("generateJacocoCoverageReport").get().classDirectories
executionData = tasks.named("generateJacocoCoverageReport").get().executionData
violationRules {
rule {
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.8
}
}
}
}
tasks.register("generateJacocoCoverageReport", JacocoReport) {
group = "Reporting"
description = "Generate JaCoCo coverage report for the debug build."
dependsOn tasks.named("unitTests").get()
finalizedBy(tasks.named("jacocoCoverageVerification").get())
def excludedFiles = [
'**/screens/**',
'**/components/**',
'**/compose/**',
'**/uiprovider/**',
'**/state/**',
'**/navigation/**',
'**/core/**',
'**/di/**',
'**/properties/**',
'**/model/**',
'**/theme/**',
'**/*ScreenKt.class',
'**/*Activity.class',
'**/dagger/**',
'**/hilt/**',
'**/generated/**',
'**/*_*.java',
'**/*_HiltComponents*',
'**/*Dagger*',
'**/*Hilt*',
'**/*\$*',
'**/*_Factory*',
'**/*_Impl*',
'**/*_MembersInjector*',
'**/*_Module*',
'**/*_Subcomponent*',
'**/*_Component*',
]
def classes = subprojects.collect { project ->
"${project.buildDir}/intermediates/classes/debug"
}
def debugFileTree = classes.collect { path ->
fileTree(
dir: path,
excludes: excludedFiles,
includes: ['**/com/jmp/**']
)
}
def sources = subprojects.collect { project ->
[
"${project.projectDir.name}/src/main/java"
]
}.flatten()
def executions = subprojects.collect { project ->
"${project.buildDir}/outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec"
}
classDirectories = files([debugFileTree])
sourceDirectories = files([sources])
executionData = files(executions)
}
}
allprojects {
apply plugin: libs.plugins.jacoco.get().pluginId
apply plugin: libs.plugins.io.gitlab.arturbosch.detekt.get().pluginId
detekt {
buildUponDefaultConfig = false
config.setFrom(rootProject.files("config/detekt/detekt.yml"))
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}