forked from stephanenicolas/toothpick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
137 lines (115 loc) · 4.16 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
132
133
134
135
136
137
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3'
}
}
repositories {
mavenCentral()
jcenter()
}
//from https://gist.github.com/aalmiray/e6f54aa4b3803be0bcac
task jacocoTestReport << {
FileCollection executionData = files()
subprojects.findAll { subproject -> subproject.pluginManager.hasPlugin('java') && subproject.pluginManager.hasPlugin('jacoco')
}.each { subproject -> executionData += subproject.tasks.jacocoTestReport.executionData
}
executionData = files(executionData.findAll {
it.exists()
})
ant.taskdef(name: 'jacocoReport', classname: 'org.jacoco.ant.ReportTask',
classpath: configurations.jacocoAnt.asPath)
ant.jacocoReport {
executiondata {
executionData.addToAntBuilder(ant, 'resources')
}
structure(name: project.name) {
subprojects.findAll { subproject -> subproject.pluginManager.hasPlugin('java')
}.each { subproject ->
group(name: subproject.name) {
classfiles {
((FileCollection) subproject.sourceSets.main.output).filter {
it.exists()
}.addToAntBuilder(ant, 'resources')
}
sourcefiles {
files((Set<File>) subproject.sourceSets.main.allJava.srcDirs).filter {
it.exists()
}.addToAntBuilder(ant, 'resources')
}
}
}
}
html(destdir: "${buildDir}/reports/jacoco/${name}/html")
xml(destfile: "${buildDir}/reports/jacoco/${name}/${name}.xml")
// Uncomment for CSV
//csv(destfile: "${buildDir}/reports/jacoco/${name}/${name}.csv")
}
}
coveralls {
jacocoReportPath = 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'
sourceDirs = files(subprojects.collect { subproject -> "${subproject.projectDir}/src/main/java" }).files.absolutePath
}
tasks.coveralls {
dependsOn 'jacocoTestReport'
}
subprojects { project ->
group = GROUP
version = VERSION_NAME
repositories {
mavenCentral()
jcenter()
}
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'maven'
checkstyle {
configFile rootProject.file('checkstyle.xml')
}
task checkstyle(type: Checkstyle) {
source 'src/main/java'
ignoreFailures true
showViolations true
include '**/*.java'
classpath = files()
}
afterEvaluate {
if (project.tasks.findByName('check') && project.pluginManager.hasPlugin('java')) {
check.dependsOn('checkstyle')
check.dependsOn('jacocoTestReport')
tasks.withType(Test) {
testLogging {
events "passed", "skipped", "failed"
}
// ensure tasks don't overwrite the default report directories used by the 'test' task
reports.html.destination = "${buildDir}/reports/${name}"
reports.junitXml.destination = "${buildDir}/reports/${name}/results"
binResultsDir = file("${buildDir}/reports/${name}/results/binary/${name}")
}
}
}
}
ext.deps = [// Common
inject : 'javax.inject:javax.inject:1',
// Compiler
javapoet : 'com.squareup:javapoet:1.4.0',
// Android
android : 'com.google.android:android:4.1.1.4',
supportv4 : 'com.google.android:support-v4:r7',
supportAnnotations : 'com.android.support:support-annotations:23.3.0',
butterknife : 'com.jakewharton:butterknife:8.0.0',
butterknife_compiler: 'com.jakewharton:butterknife-compiler:8.0.0',
rxandroid : 'io.reactivex:rxandroid:0.23.0',
// Test dependencies
junit : 'junit:junit:4.12',
hamcrest : 'org.hamcrest:java-hamcrest:2.0.0.0',
truth : 'com.google.truth:truth:0.27',
compiletesting : 'com.google.testing.compile:compile-testing:0.7',
easymock : 'org.easymock:easymock:3.4',
powermock : 'org.powermock:powermock-easymock-release-full:1.6.4',
robolectric : 'org.robolectric:robolectric:3.0',]