forked from chennaione/sugar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
103 lines (88 loc) · 2.51 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
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'java'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.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 {
mavenLocal()
mavenCentral()
jcenter()
}
}
subprojects { proj ->
apply plugin: 'jacoco'
jacoco {
version "0.7.1.201405082137"
}
task jacocoTestReport(type: JacocoReport) {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = true
html.enabled = true
}
classDirectories = fileTree(
dir: 'build/intermediates/classes/debug',
excludes: ['**/R*.class',
'**/BuildConfig*'])
sourceDirectories = files('src/main/java')
executionData = 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.7.1.201405082137"
}
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
group = "Reporting"
description = 'Generates an aggregate report from all subprojects'
dependsOn(subprojects.jacocoTestReport)
additionalSourceDirs = files('library/src/main/java')
sourceDirectories = files('library/src/main/java')
classDirectories = files('library/build/intermediates/classes/debug')
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
}
onlyIf = {
true
}
doFirst {
executionData = 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' }
}