forked from chennaione/sugar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
107 lines (91 loc) · 2.64 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
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'java'
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1'
}
}
def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}
test {
testLogging {
exceptionFormat = 'full'
}
}
allprojects {
version = VERSION_NAME
group = GROUP
repositories {
google()
mavenLocal()
mavenCentral()
jcenter()
}
}
subprojects { proj ->
apply plugin: 'jacoco'
jacoco {
version "0.8.6"
}
task jacocoTestReport(type: JacocoReport) {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = true
html.enabled = true
}
getClassDirectories().setFrom(fileTree(
dir: 'build/intermediates/classes/debug',
excludes: ['**/R*.class',
'**/BuildConfig*']))
getSourceDirectories().setFrom(files('src/main/java'))
getExecutionData().setFrom(files('build/jacoco/testDebugUnitTest.exec'))
doFirst {
files('build/intermediates/classes/debug').getFiles().each { file ->
if (file.name.contains('$$')) {
file.renameTo(file.path.replace('$$', '$'))
}
}
}
}
}
jacoco {
toolVersion "0.8.6"
}
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
group = "RFeporting"
description = 'Generates an aggregate report from all subprojects'
dependsOn(subprojects.jacocoTestReport)
getAdditionalSourceDirs().setFrom(files('library/src/main/java'))
getSourceDirectories().setFrom(files('library/src/main/java'))
getClassDirectories().setFrom(files('library/build/intermediates/classes/debug'))
getExecutionData().setFrom(files(subprojects.jacocoTestReport.executionData))
reports {
html.enabled = true
xml.enabled = true
}
onlyIf = {
true
}
doFirst {
getExecutionData().setFrom(files(executionData.findAll { it.exists() }))
}
}
coveralls {
sourceDirs = files('library/src/main/java').flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}
tasks.coveralls {
group = 'Coverage reports'
description = 'Uploads the aggregated coverage report to Coveralls'
dependsOn jacocoRootReport
onlyIf { System.env.'CI' }
}