This repository was archived by the owner on Oct 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
131 lines (113 loc) · 3.4 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 {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.9'
}
}
allprojects {
group 'io.t28'
version '0.2.2'
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'net.ltgt.errorprone'
repositories {
jcenter()
}
jacoco {
toolVersion = '0.7.9'
reportsDir = file("${project.buildDir}/reports/jacoco")
}
}
subprojects {
def javaVersion = JavaVersion.VERSION_1_8
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
repositories {
mavenCentral()
}
sourceSets {
main {
java.srcDirs = ['src/main/java', 'build/classes/main/generated']
}
}
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.0.18'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.7.5'
testCompile 'org.assertj:assertj-core:3.6.2'
}
tasks.withType(JavaCompile) {
options.compilerArgs += [
'-Xep:ImmutableEnumChecker:OFF',
'-Xep:ConstantField:ERROR',
'-Xep:MethodCanBeStatic:ERROR',
'-Xep:MixedArrayDimensions:ERROR',
'-Xep:MultiVariableDeclaration:ERROR',
'-Xep:MultipleTopLevelClasses:ERROR',
'-Xep:PackageLocation:ERROR',
'-Xep:PrivateConstructorForUtilityClass:ERROR',
'-Xep:RemoveUnusedImports:ERROR',
'-Xep:ThrowsUncheckedException:ERROR',
'-Xep:UnnecessaryStaticImport:ERROR',
'-Xep:WildcardImport:ERROR'
]
}
jacocoTestReport {
group = 'verification'
description = 'Generate test coverage reports'
dependsOn = ['test']
reports {
xml.enabled = false
csv.enabled = false
html.enabled = true
}
}
check.dependsOn jacocoTestReport
}
task jacocoRootReport(type: JacocoReport, group: 'verification') {
description = 'Generate an aggregated coverage report from all projects'
dependsOn = subprojects.findAll().test
additionalSourceDirs = files(subprojects.findAll().sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.findAll().sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.findAll().sourceSets.main.output)
executionData = files(subprojects.findAll().jacocoTestReport.executionData)
reports {
html.enabled = false
xml.enabled = true
csv.enabled = false
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}
// see https://github.com/codacy/codacy-coverage-reporter
configurations {
codacy
}
repositories {
maven {
url "https://jitpack.io"
}
maven {
url "http://dl.bintray.com/typesafe/maven-releases"
}
}
dependencies {
codacy 'com.github.codacy:codacy-coverage-reporter:-SNAPSHOT'
}
task sendCoverageToCodacy(type: JavaExec, group: 'other') {
dependsOn = ['jacocoRootReport']
main = "com.codacy.CodacyCoverageReporter"
classpath = configurations.codacy
args = [
"-l",
"Java",
"-r",
"${rootProject.buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
]
}