forked from Nike-Inc/wingtips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
171 lines (145 loc) · 6 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// ========== GRADLE PLUGINS / REPOSITORIES SETUP
buildscript {
repositories {
jcenter()
}
dependencies {
// STUFF FOR BINTRAY
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
}
}
allprojects {
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'project-report'
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: classes) {
classifier = 'javadoc'
from javadoc
}
javadoc {
failOnError = false
}
artifacts {
archives sourcesJar, javadocJar
}
repositories {
jcenter()
}
idea {
module {
downloadSources = true
}
}
test {
// Minimize console spam while running tests without swallowing critical debugging info.
testLogging {
exceptionFormat "FULL"
events "passed", "skipped", "failed"
displayGranularity = 0
showExceptions true
showCauses true
showStackTraces true
}
ignoreFailures = false
}
// http://www.gradle.org/docs/current/userguide/java_plugin.html
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
// Disable jar, sourcesJar, and javadoc tasks for the root project - we only want them to run for submodules
jar.enabled = false
sourcesJar.enabled = false
javadocJar.enabled = false
// ========== PROPERTIES FOR GRADLE BUILD - DEPENDENCY VERSIONS / ETC
ext {
slf4jVersion = '1.7.25'
servletApiVersion = '3.0.1'
zipkinVersion = '1.16.2'
zipkin2Version = '2.10.1'
zipkin2ReporterVersion = '2.7.6'
spring4Version = '4.3.7.RELEASE'
spring5Version = '5.1.9.RELEASE'
springboot1Version = '1.5.2.RELEASE'
springboot2Version = '2.1.8.RELEASE'
apacheHttpClientVersion = '4.4.1'
apacheCommonsCodecVersion = '1.11'
jersey2Version = '2.23.2'
lightstepTracerVersion = '0.15.4'
lightstepHttpVersion = '0.16.2'
grpcNettyVersion = '1.14.0'
nettyTcnativeBoringVersion = '2.0.12.Final'
nikeInternalUtilVersion = '0.9.0.1'
jetbrainsAnnotationsVersion = '16.0.3'
junitVersion = '4.11'
mockitoVersion = '1.9.5'
logbackVersion = '1.2.3'
jacksonVersion = '2.4.2'
assertJVersion = '2.5.0'
junitDataproviderVersion = '1.10.1'
restAssuredVersion = '3.0.1'
apacheCommonsIoVersion = '2.5'
apacheCommonsLangVersion = '2.6'
jettyVersion = '9.3.21.v20170918'
// JACOCO PROPERTIES
jacocoToolVersion = '0.8.4'
// Anything in this jacocoExclusions list will be excluded from coverage reports. The format is paths to class
// files, with wildcards allowed. e.g.: jacocoExclusions = [ "com/nike/Foo.class", "**/Bar*.*" ]
jacocoExclusions = []
jacocoCoverageThresholdSetup = {
configure(subprojects.findAll { isSubprojectIncludedInJacocoReports(it) }) {
// We have to split out the wingtips-zipkin and wingtips-lightstep coverage numbers because (1) they don't
// contain much code, and (2) they use some features like try-with-resources that generate many many
// branches in the bytecode that are realistically impossible to get coverage for. The combination of
// those issues mean we get artificially low coverage numbers even though it's clean correct code,
// so we just have to visually verify it.
boolean isModuleWithLowerCodeCovReqs = (it.name.contains("wingtips-zipkin") ||
it.name.contains("wingtips-lightstep"))
float minInstructionCodeCov = (isModuleWithLowerCodeCovReqs) ? 0.9 : 0.95
float minBranchCodeCov = (isModuleWithLowerCodeCovReqs) ? 0.8 : 0.95
// Configure the minimum code coverage rules.
jacocoTestCoverageVerification { JacocoCoverageVerification v ->
violationRules {
rule { JacocoViolationRule r ->
enabled = true
limit {
minimum = minInstructionCodeCov
counter = "INSTRUCTION"
}
}
rule { JacocoViolationRule r ->
enabled = true
limit {
minimum = minBranchCodeCov
counter = "BRANCH"
}
}
}
}
}
}
// Configure which subprojects we're doing jacoco for.
isSubprojectIncludedInJacocoReports = { Project subProj ->
// For this repo we'll include everything that's not a sample or testonly module.
return !subProj.name.startsWith("sample") && !subProj.getName().startsWith("testonly")
}
// BINTRAY STUFF
bintrayUser = project.hasProperty('bintrayUser') ? property('bintrayUser') : 'UNDEFINED'
bintrayKey = project.hasProperty('bintrayKey') ? property('bintrayKey') : 'UNDEFINED'
bintrayVersion = "$version"
}
// ========== COMBO TEST REPORT - View the combined/merged report at: [project_root]/build/reports/tests/index.html
apply from: file(rootProject.projectDir.getAbsolutePath() + '/gradle/junitComboTestReport.gradle')
// ========== JACOCO SETUP - View the combined/merged report at: [project_root]/build/reports/jacoco/jacocoRootReport/html/index.html.
// Individual reports for each submodule can be found at: [project_root]/[submodule]/build/reports/jacoco/test/html/index.html
apply from: file(rootProject.projectDir.getAbsolutePath() + '/gradle/jacoco.gradle')
// ========== BINTRAY PUBLISHING
apply from: file(rootProject.projectDir.getAbsolutePath() + '/gradle/bintrayPublishing.gradle')
// ========== MISCELLANEOUS BUILD STUFF
allprojects {
group = groupId // Necessary for the maven install task to function correctly
}