forked from open-telemetry/opentelemetry-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
223 lines (188 loc) · 7.94 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
}
dependencies {
classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.5.0'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.16'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8"
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.9.8'
}
}
// Display the version report using: ./gradlew dependencyUpdates
// Also see https://github.com/ben-manes/gradle-versions-plugin.
apply plugin: 'com.github.ben-manes.versions'
subprojects {
apply plugin: 'checkstyle'
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'idea'
apply plugin: 'signing'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
// The plugin only has an effect if a signature is specified
apply plugin: 'ru.vyarus.animalsniffer'
apply plugin: 'com.github.sherter.google-java-format'
apply plugin: 'net.ltgt.errorprone'
apply plugin: 'com.jfrog.artifactory'
group = "io.opentelemetry"
version = "0.2.0-SNAPSHOT" // CURRENT_VERSION
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenCentral()
mavenLocal()
}
[compileJava, compileTestJava].each() {
// We suppress the "try" warning because it disallows managing an auto-closeable with
// try-with-resources without referencing the auto-closeable within the try block.
// We suppress the "processing" warning as suggested in
// https://groups.google.com/forum/#!topic/bazel-discuss/_R3A9TJSoPM
it.options.compilerArgs += ["-Xlint:all", "-Xlint:-try", "-Xlint:-processing"]
it.options.compilerArgs += ["-XepAllDisabledChecksAsWarnings", "-XepDisableWarningsInGeneratedCode"]
// Doesn't currently use Var annotations.
it.options.compilerArgs += ["-Xep:Var:OFF"]
// ImmutableRefactoring suggests using com.google.errorprone.annotations.Immutable,
// but currently uses javax.annotation.concurrent.Immutable
it.options.compilerArgs += ["-Xep:ImmutableRefactoring:OFF"]
// NullPointerException is experimental and incomplete
// (https://github.com/google/error-prone/issues/1253).
it.options.compilerArgs += ["-Xep:NullableDereference:OFF"]
// ExpectedExceptionRefactoring and TestExceptionRefactoring suggest using
// assertThrows, but assertThrows only works well with lambdas.
it.options.compilerArgs += ["-Xep:ExpectedExceptionRefactoring:OFF"]
it.options.compilerArgs += ["-Xep:TestExceptionRefactoring:OFF"]
// AutoValueImmutableFields suggests returning Guava types from API methods
it.options.compilerArgs += ["-Xep:AutoValueImmutableFields:OFF"]
it.options.encoding = "UTF-8"
// Ignore warnings for protobuf generated files.
it.options.compilerArgs += ["-XepExcludedPaths:.*/build/generated/source/proto/.*"]
// Enforce errorprone warnings to be errors.
if (!JavaVersion.current().isJava9() && !JavaVersion.current().isJava10()) {
// TODO: Enable -Werror for Java 9+
it.options.compilerArgs += ["-Werror"]
}
}
compileTestJava {
// serialVersionUID is basically guaranteed to be useless in tests
options.compilerArgs += ["-Xlint:-serial"]
}
jar.manifest {
attributes('Implementation-Title': name,
'Implementation-Version': version,
'Built-By': System.getProperty('user.name'),
'Built-JDK': System.getProperty('java.version'),
'Source-Compatibility': sourceCompatibility,
'Target-Compatibility': targetCompatibility)
}
javadoc.options {
encoding = 'UTF-8'
links 'https://docs.oracle.com/javase/8/docs/api/'
}
ext {
autoValueVersion = '1.6.6'
errorProneVersion = '2.3.3'
findBugsJsr305Version = '3.0.2'
grpcVersion = '1.24.0'
guavaVersion = '28.1-android'
opentracingVersion = '0.33.0'
protobufVersion = '3.9.0'
protocVersion = '3.9.0'
libraries = [
auto_value: "com.google.auto.value:auto-value:${autoValueVersion}",
auto_value_annotation: "com.google.auto.value:auto-value-annotations:${autoValueVersion}",
disruptor: 'com.lmax:disruptor:3.4.2',
errorprone_annotation: "com.google.errorprone:error_prone_annotations:${errorProneVersion}",
grpc_api: "io.grpc:grpc-api:${grpcVersion}",
grpc_context: "io.grpc:grpc-context:${grpcVersion}",
grpc_protobuf: "io.grpc:grpc-protobuf:${grpcVersion}",
grpc_stub: "io.grpc:grpc-stub:${grpcVersion}",
guava: "com.google.guava:guava:${guavaVersion}",
jsr305: "com.google.code.findbugs:jsr305:${findBugsJsr305Version}",
protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}",
protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}",
// Compatibility layer
opentracing: "io.opentracing:opentracing-api:${opentracingVersion}",
// Test dependencies.
guava_testlib: "com.google.guava:guava-testlib:${guavaVersion}",
junit: 'junit:junit:4.12',
mockito: 'org.mockito:mockito-core:2.25.1',
truth: 'com.google.truth:truth:1.0',
slf4jsimple: 'org.slf4j:slf4j-simple:1.7.25', // Compatibility layer
awaitility: 'org.awaitility:awaitility:3.0.0', // Compatibility layer
]
}
configurations {
compile {
// Detect Maven Enforcer's dependencyConvergence failures. We only
// care for artifacts used as libraries by others.
// TODO: Enable failOnVersionConflict()
resolutionStrategy.preferProjectModules()
}
}
dependencies {
compileOnly libraries.auto_value_annotation,
libraries.errorprone_annotation,
libraries.jsr305
testImplementation libraries.junit,
libraries.mockito,
libraries.truth,
libraries.guava_testlib
// The ErrorProne plugin defaults to the latest, which would break our
// build if error prone releases a new version with a new check
errorprone "com.google.errorprone:error_prone_core:${errorProneVersion}"
}
checkstyle {
configFile = file("$rootDir/buildscripts/checkstyle.xml")
toolVersion = "8.12"
ignoreFailures = false
configProperties["rootDir"] = rootDir
}
googleJavaFormat {
toolVersion '1.7'
}
afterEvaluate { // Allow subproject to add more source sets.
tasks.googleJavaFormat {
source = sourceSets*.allJava
include '**/*.java'
}
tasks.verifyGoogleJavaFormat {
source = sourceSets*.allJava
include '**/*.java'
}
}
signing {
required false
sign configurations.archives
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
// At a test failure, log the stack trace to the console so that we don't
// have to open the HTML in a browser.
test {
testLogging {
exceptionFormat = 'full'
showExceptions true
showCauses true
showStackTraces true
}
maxHeapSize = '1500m'
}
apply from: "${rootProject.projectDir}/gradle/publish.gradle"
}