blob: 07bc7a88a9b1a829eb68ce491d8492b4b9f59699 [file] [log] [blame]
Bogdan Drutu00202c02017-03-21 10:52:28 -07001buildscript {
2 repositories {
3 mavenCentral()
4 mavenLocal()
5 maven {
6 url "https://plugins.gradle.org/m2/"
7 }
8 }
9 dependencies {
Stefan Schmidt09189862017-10-31 01:58:58 +010010 classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.4.2'
Kristen Kozakd7745ef2017-11-10 18:23:35 -080011 classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.13'
Bogdan Drutua5ff0dc2017-03-29 10:44:45 -070012 classpath "net.ltgt.gradle:gradle-apt-plugin:0.10"
Stefan Schmidt7bfe9252018-01-08 20:20:31 +010013 classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
Bogdan Drutu6cb4dd22017-11-03 09:25:12 +110014 classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.6"
Bogdan Drutu00202c02017-03-21 10:52:28 -070015 }
16}
17
Stefan Schmidte220edb2017-08-18 20:49:18 +020018// Display the version report using: ./gradlew dependencyUpdates
19// Also see https://github.com/ben-manes/gradle-versions-plugin.
20apply plugin: 'com.github.ben-manes.versions'
21
Kristen Kozaka5f4a102017-12-19 20:02:00 -080022// Don't use the Checker Framework by default, since it interferes with Error Prone.
23def useCheckerFramework = rootProject.hasProperty('checkerFramework')
24def useErrorProne = !useCheckerFramework
25
Bogdan Drutu00202c02017-03-21 10:52:28 -070026subprojects {
27 apply plugin: "checkstyle"
28 apply plugin: 'maven'
29 apply plugin: 'idea'
Fabian Lange5430ec72018-02-02 14:23:58 -080030 apply plugin: 'eclipse'
Bogdan Drutu00202c02017-03-21 10:52:28 -070031 apply plugin: 'java'
32 apply plugin: "signing"
33 apply plugin: "jacoco"
Bogdan Drutub0e60502017-03-22 19:23:35 -070034 // The plugin only has an effect if a signature is specified
35 apply plugin: 'ru.vyarus.animalsniffer'
Bogdan Drutu07f0dd22017-03-22 08:54:53 -070036 apply plugin: 'findbugs'
Bogdan Drutu6cb4dd22017-11-03 09:25:12 +110037 apply plugin: 'net.ltgt.apt'
Bogdan Drutub0e60502017-03-22 19:23:35 -070038 // Plugins that require java8
39 if (JavaVersion.current().isJava8Compatible()) {
Kristen Kozaka5f4a102017-12-19 20:02:00 -080040 if (useErrorProne) {
41 apply plugin: "net.ltgt.errorprone"
42 }
Bogdan Drutu6cb4dd22017-11-03 09:25:12 +110043 apply plugin: 'com.github.sherter.google-java-format'
Bogdan Drutub0e60502017-03-22 19:23:35 -070044 }
Bogdan Drutu00202c02017-03-21 10:52:28 -070045
Bogdan Drutu1d2eda62017-06-19 23:54:11 -070046 group = "io.opencensus"
Yang Song1cc55542018-04-27 17:36:44 -070047 version = "0.14.0-SNAPSHOT" // CURRENT_OPENCENSUS_VERSION
Bogdan Drutu00202c02017-03-21 10:52:28 -070048
49 sourceCompatibility = 1.6
50 targetCompatibility = 1.6
51
52 repositories {
53 mavenCentral()
54 mavenLocal()
55 }
56
Kristen Kozaka5f4a102017-12-19 20:02:00 -080057 if (useCheckerFramework) {
58 configurations {
59 checkerFrameworkJavac {
60 description = 'a customization of the Open JDK javac compiler with additional support for type annotations'
61 }
62 checkerFrameworkAnnotatedJDK {
63 description = 'a copy of JDK classes with Checker Framework type qualifiers inserted'
64 }
65 }
66 }
67
Bogdan Drutu00202c02017-03-21 10:52:28 -070068 [compileJava, compileTestJava].each() {
Kristen Kozakebb2d1d2018-02-26 16:07:52 -080069 // We suppress the "try" warning because it disallows managing an auto-closeable with
70 // try-with-resources without referencing the auto-closeable within the try block.
Kristen Kozak9cb23842017-03-21 17:51:20 -070071 // We suppress the "processing" warning as suggested in
72 // https://groups.google.com/forum/#!topic/bazel-discuss/_R3A9TJSoPM
73 it.options.compilerArgs += ["-Xlint:all", "-Xlint:-try", "-Xlint:-processing"]
Kristen Kozaka5f4a102017-12-19 20:02:00 -080074 if (useErrorProne) {
75 if (JavaVersion.current().isJava8Compatible()) {
76 it.options.compilerArgs += ["-XepDisableWarningsInGeneratedCode"]
Bogdan Drutu709d97a2018-05-30 16:32:34 -070077 // Exclude generated protobuf from error-prone checks.
78 it.options.compilerArgs += ["-XepExcludedPaths:.*/gen_gradle/.*"]
Kristen Kozaka5f4a102017-12-19 20:02:00 -080079 // TODO(bdrutu): Read files directly instead of reading from properties.
80 if (rootProject.hasProperty("errorProneWarnings")) {
81 it.options.compilerArgs += rootProject.properties["errorProneWarnings"].split(',').collect {
82 it as String
83 }
84 }
85 if (rootProject.hasProperty("errorProneExperimentalErrors")) {
86 it.options.compilerArgs += rootProject.properties["errorProneExperimentalErrors"].split(',').collect {
87 it as String
88 }
89 }
90 if (rootProject.hasProperty("errorProneExperimentalWarnings")) {
91 it.options.compilerArgs += rootProject.properties["errorProneExperimentalWarnings"].split(',').collect {
92 it as String
93 }
94 }
95 if (rootProject.hasProperty("errorProneExperimentalSuggestions")) {
96 it.options.compilerArgs += rootProject.properties["errorProneExperimentalSuggestions"].split(',').collect {
97 it as String
98 }
Bogdan Drutu14920b42017-03-23 17:13:53 -070099 }
100 }
Kristen Kozaka5f4a102017-12-19 20:02:00 -0800101 }
102 if (useCheckerFramework) {
103 it.options.compilerArgs += [
Kristen Kozak3c526062017-12-28 12:27:22 -0800104 '-processor',
105 'com.google.auto.value.processor.AutoValueProcessor,org.checkerframework.checker.nullness.NullnessChecker',
106 "-Astubs=$rootDir/checker-framework/stubs"
Kristen Kozaka5f4a102017-12-19 20:02:00 -0800107 ]
Bogdan Drutu14920b42017-03-23 17:13:53 -0700108 }
Bogdan Drutu00202c02017-03-21 10:52:28 -0700109 it.options.encoding = "UTF-8"
Bogdan Drutu709d97a2018-05-30 16:32:34 -0700110 // Protobuf-generated code produces some warnings.
111 // https://github.com/google/protobuf/issues/2718
112 it.options.compilerArgs += ["-Xlint:-cast"]
Kristen Kozak3b577172018-02-26 16:15:04 -0800113 if (!JavaVersion.current().isJava9()) {
114 // TODO(sebright): Enable -Werror for Java 9 once we upgrade AutoValue (issue #1017).
Bogdan Drutub0e60502017-03-22 19:23:35 -0700115 it.options.compilerArgs += ["-Werror"]
116 }
Kristen Kozak3b577172018-02-26 16:15:04 -0800117 if (JavaVersion.current().isJava7()) {
118 // Suppress all deprecation warnings with Java 7, since there are some bugs in its handling of
119 // @SuppressWarnings. See
120 // https://stackoverflow.com/questions/26921774/how-to-avoid-deprecation-warnings-when-suppresswarningsdeprecation-doesnt
121 it.options.compilerArgs += ["-Xlint:-deprecation"]
122
123 // TODO(bdrutu): Enable for Java 7 when fix the issue with configuring bootstrap class.
124 // [options] bootstrap class path not set in conjunction with -source 1.6
125 it.options.compilerArgs += ["-Xlint:-options"]
126 }
127 if (JavaVersion.current().isJava9()) {
128 // TODO(sebright): Currently, building with Java 9 produces the following "options" warnings:
129 //
130 // :opencensus-api:compileJavawarning: [options] bootstrap class path not set in conjunction with -source 1.6
131 // warning: [options] source value 1.6 is obsolete and will be removed in a future release
132 // warning: [options] target value 1.6 is obsolete and will be removed in a future release
133 it.options.compilerArgs += ["-Xlint:-options"]
134 }
Bogdan Drutu00202c02017-03-21 10:52:28 -0700135 }
136
137 compileTestJava {
138 // serialVersionUID is basically guaranteed to be useless in tests
139 options.compilerArgs += ["-Xlint:-serial"]
140 // It undeprecates DoubleSubject.isEqualTo(Double).
141 options.compilerArgs += ["-Xlint:-deprecation"]
Bogdan Drutu00202c02017-03-21 10:52:28 -0700142 }
143
144 jar.manifest {
145 attributes('Implementation-Title': name,
146 'Implementation-Version': version,
147 'Built-By': System.getProperty('user.name'),
148 'Built-JDK': System.getProperty('java.version'),
149 'Source-Compatibility': sourceCompatibility,
150 'Target-Compatibility': targetCompatibility)
151 }
152
153 javadoc.options {
154 encoding = 'UTF-8'
155 links 'https://docs.oracle.com/javase/8/docs/api/'
156 }
157
158 ext {
Bogdan Drutu709d97a2018-05-30 16:32:34 -0700159 appengineVersion = '1.9.63'
Kristen Kozak9cb23842017-03-21 17:51:20 -0700160 autoValueVersion = '1.4'
Stefan Schmidt82f859b2017-07-14 21:50:37 +0200161 findBugsVersion = '3.0.1'
Bogdan Drutu26232c42018-01-17 10:03:55 -0800162 errorProneVersion = '2.2.0'
Bogdan Drutu1c416c02018-05-31 06:28:54 -0700163 grpcVersion = '1.12.0'
Yang Song422d78f2018-03-26 12:07:30 -0700164 guavaVersion = '20.0'
Yang Song36c018e2018-05-09 10:19:09 -0700165 googleAuthVersion = '0.9.1'
Bogdan Drutu1c416c02018-05-31 06:28:54 -0700166 googleCloudVersion = '0.49.0-beta'
Maxime Petazzoni64d05832018-01-17 09:09:13 -0800167 signalfxVersion = '0.0.39'
Yang Songf30f8082018-05-30 10:35:04 -0700168 prometheusVersion = '0.4.0'
Bogdan Drutu709d97a2018-05-30 16:32:34 -0700169 protobufVersion = '3.5.1'
Bogdan Drutu490dfe82018-02-15 20:15:39 -0800170 zipkinReporterVersion = '2.3.2'
Bogdan Drutu1c416c02018-05-31 06:28:54 -0700171 jaegerReporterVersion = '0.27.0'
Bogdan Drutu00202c02017-03-21 10:52:28 -0700172
173 libraries = [
Bogdan Drutu709d97a2018-05-30 16:32:34 -0700174 appengine_api: "com.google.appengine:appengine-api-1.0-sdk:${appengineVersion}",
Bogdan Drutu31b3fdd2017-08-16 18:57:26 -0700175 auto_value: "com.google.auto.value:auto-value:${autoValueVersion}",
176 auto_service: 'com.google.auto.service:auto-service:1.0-rc3',
Stefan Schmidtee1fd022018-03-05 20:39:48 +0100177 byte_buddy: 'net.bytebuddy:byte-buddy:1.7.11',
Stefan Schmidtcdd4ce22017-11-20 20:59:30 +0100178 config: 'com.typesafe:config:1.2.1',
Yang Song37fe5d32018-03-21 14:52:11 -0700179 disruptor: 'com.lmax:disruptor:3.4.1',
Kristen Kozakba783792017-11-10 18:28:44 -0800180 errorprone: "com.google.errorprone:error_prone_annotations:${errorProneVersion}",
Bogdan Drutu31b3fdd2017-08-16 18:57:26 -0700181 findbugs_annotations: "com.google.code.findbugs:annotations:${findBugsVersion}",
Bogdan Drutu61178e92017-09-20 09:41:37 -0700182 google_auth: "com.google.auth:google-auth-library-credentials:${googleAuthVersion}",
183 google_cloud_trace: "com.google.cloud:google-cloud-trace:${googleCloudVersion}",
Adrian Coled05056c2017-09-24 10:46:17 +0800184 zipkin_reporter: "io.zipkin.reporter2:zipkin-reporter:${zipkinReporterVersion}",
185 zipkin_urlconnection: "io.zipkin.reporter2:zipkin-sender-urlconnection:${zipkinReporterVersion}",
Marc Carré81908052018-03-16 01:03:49 +0000186 jaeger_reporter: "com.uber.jaeger:jaeger-core:${jaegerReporterVersion}",
Yang Song6fe9afd2017-11-08 18:17:08 -0800187 google_cloud_monitoring: "com.google.cloud:google-cloud-monitoring:${googleCloudVersion}",
Bogdan Drutu8781dbb2017-09-05 10:40:42 -0700188 grpc_context: "io.grpc:grpc-context:${grpcVersion}",
189 grpc_core: "io.grpc:grpc-core:${grpcVersion}",
Bogdan Drutu31b3fdd2017-08-16 18:57:26 -0700190 guava: "com.google.guava:guava:${guavaVersion}",
191 jsr305: "com.google.code.findbugs:jsr305:${findBugsVersion}",
Maxime Petazzoni64d05832018-01-17 09:09:13 -0800192 signalfx_java: "com.signalfx.public:signalfx-java:${signalfxVersion}",
Yang Songb0d39672018-02-13 12:47:32 -0800193 prometheus_simpleclient: "io.prometheus:simpleclient:${prometheusVersion}",
Bogdan Drutu709d97a2018-05-30 16:32:34 -0700194 protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}",
Bogdan Drutu00202c02017-03-21 10:52:28 -0700195
196 // Test dependencies.
Bogdan Drutu31b3fdd2017-08-16 18:57:26 -0700197 guava_testlib: "com.google.guava:guava-testlib:${guavaVersion}",
Bogdan Drutubbe1d0f2017-10-26 14:05:26 -0700198 junit: 'junit:junit:4.12',
Kristen Kozak23be8f02017-11-10 15:01:23 -0800199 mockito: 'org.mockito:mockito-core:1.9.5',
Bogdan Drutu31b3fdd2017-08-16 18:57:26 -0700200 truth: 'com.google.truth:truth:0.30',
Bogdan Drutu00202c02017-03-21 10:52:28 -0700201 ]
202 }
203
Bogdan Drutu0eaaccb2018-01-23 19:38:02 -0800204 configurations {
205 compile {
206 // Detect Maven Enforcer's dependencyConvergence failures. We only
207 // care for artifacts used as libraries by others.
Bogdan Drutu13cf2b82018-02-26 15:24:26 -0800208 if (!(project.name in ['benchmarks', 'opencensus-all',
209 'opencensus-exporter-stats-stackdriver',
Bogdan Drutu1c416c02018-05-31 06:28:54 -0700210 'opencensus-exporter-trace-stackdriver',
211 'opencensus-exporter-trace-jaeger'])) {
Bogdan Drutu0eaaccb2018-01-23 19:38:02 -0800212 resolutionStrategy.failOnVersionConflict()
213 }
214 }
215 }
216
Bogdan Drutu00202c02017-03-21 10:52:28 -0700217 dependencies {
Kristen Kozaka5f4a102017-12-19 20:02:00 -0800218 if (useCheckerFramework) {
Kristen Kozakc917cc22018-05-02 18:33:52 -0700219 ext.checkerFrameworkVersion = '2.5.1'
Kristen Kozak3d3a4462018-04-16 15:50:56 -0700220
221 // 2.4.0 is the last version of the Checker Framework compiler that supports annotations
222 // in comments, though it should continue to work with newer versions of the Checker Framework.
223 // See
224 // https://github.com/census-instrumentation/opencensus-java/pull/1112#issuecomment-381366366.
225 ext.checkerFrameworkCompilerVersion = '2.4.0'
226
Kristen Kozaka5f4a102017-12-19 20:02:00 -0800227 ext.jdkVersion = 'jdk8'
228 checkerFrameworkAnnotatedJDK "org.checkerframework:${jdkVersion}:${checkerFrameworkVersion}"
Kristen Kozak3d3a4462018-04-16 15:50:56 -0700229 checkerFrameworkJavac "org.checkerframework:compiler:${checkerFrameworkCompilerVersion}"
Kristen Kozaka5f4a102017-12-19 20:02:00 -0800230 compileOnly "org.checkerframework:checker:${checkerFrameworkVersion}"
231 compile "org.checkerframework:checker-qual:${checkerFrameworkVersion}"
232 compileOnly libraries.auto_value
233 }
234
Kristen Kozak1bb75e52018-03-26 16:49:03 -0700235 compileOnly libraries.errorprone,
236 libraries.jsr305
Bogdan Drutu07f0dd22017-03-22 08:54:53 -0700237
Bogdan Drutu00202c02017-03-21 10:52:28 -0700238 testCompile libraries.guava_testlib,
239 libraries.junit,
240 libraries.mockito,
241 libraries.truth
242
Kristen Kozaka5f4a102017-12-19 20:02:00 -0800243 if (useErrorProne && JavaVersion.current().isJava8Compatible()) {
Bogdan Drutub0e60502017-03-22 19:23:35 -0700244 // The ErrorProne plugin defaults to the latest, which would break our
245 // build if error prone releases a new version with a new check
Kristen Kozakba783792017-11-10 18:28:44 -0800246 errorprone "com.google.errorprone:error_prone_core:${errorProneVersion}"
Bogdan Drutub0e60502017-03-22 19:23:35 -0700247 }
Bogdan Drutu00202c02017-03-21 10:52:28 -0700248 }
249
Bogdan Drutu07f0dd22017-03-22 08:54:53 -0700250 findbugs {
Stefan Schmidt82f859b2017-07-14 21:50:37 +0200251 toolVersion = findBugsVersion
Bogdan Drutueba004c2017-04-13 13:52:39 -0700252 ignoreFailures = false // bug free or it doesn't ship!
Bogdan Drutu07f0dd22017-03-22 08:54:53 -0700253 effort = 'max'
Bogdan Drutueba004c2017-04-13 13:52:39 -0700254 reportLevel = 'low' // low = sensitive to even minor mistakes
255 omitVisitors = [] // bugs that we want to ignore
Kristen Kozakb27b1c72017-04-12 16:38:04 -0700256 excludeFilter = file("$rootDir/findbugs-exclude.xml")
Bogdan Drutu07f0dd22017-03-22 08:54:53 -0700257 }
Bogdan Drutucca79a32017-03-27 14:17:16 -0700258 // Generate html report for findbugs.
259 findbugsMain {
260 reports {
261 xml.enabled = false
262 html.enabled = true
263 }
264 }
Bogdan Drutu07f0dd22017-03-22 08:54:53 -0700265
Bogdan Drutu00202c02017-03-21 10:52:28 -0700266 checkstyle {
Bogdan Drutub216db32017-08-24 22:09:37 -0700267 configFile = file("$rootDir/buildscripts/checkstyle.xml")
Bogdan Drutu8d4372e2017-09-02 13:21:17 -0700268 toolVersion = "8.0"
Bogdan Drutu00202c02017-03-21 10:52:28 -0700269 ignoreFailures = false
270 if (rootProject.hasProperty("checkstyle.ignoreFailures")) {
271 ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean()
272 }
273 configProperties["rootDir"] = rootDir
274 }
275
Bogdan Drutub0e60502017-03-22 19:23:35 -0700276 // Disable checkstyle if no java8.
277 checkstyleMain.enabled = JavaVersion.current().isJava8Compatible()
278 checkstyleTest.enabled = JavaVersion.current().isJava8Compatible()
279
Bogdan Drutu6cb4dd22017-11-03 09:25:12 +1100280 // Google formatter works only on java8.
281 if (JavaVersion.current().isJava8Compatible()) {
282 googleJavaFormat {
283 toolVersion '1.5'
284 }
285
Stefan Schmidtfe8b9902017-11-03 17:26:09 +0100286 afterEvaluate { // Allow subproject to add more source sets.
287 tasks.googleJavaFormat {
288 source = sourceSets*.allJava
289 include '**/*.java'
290 }
Bogdan Drutu6cb4dd22017-11-03 09:25:12 +1100291
Stefan Schmidtfe8b9902017-11-03 17:26:09 +0100292 tasks.verifyGoogleJavaFormat {
293 source = sourceSets*.allJava
294 include '**/*.java'
295 }
Bogdan Drutu6cb4dd22017-11-03 09:25:12 +1100296 }
297 }
298
Bogdan Drutueba004c2017-04-13 13:52:39 -0700299 signing {
300 required false
301 sign configurations.archives
302 }
303
304 task javadocJar(type: Jar) {
305 classifier = 'javadoc'
306 from javadoc
307 }
308
309 task sourcesJar(type: Jar) {
310 classifier = 'sources'
311 from sourceSets.main.allSource
312 }
313
314 artifacts {
315 archives javadocJar, sourcesJar
316 }
317
318 uploadArchives {
319 repositories {
320 mavenDeployer {
321 beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
322
323 def configureAuth = {
324 if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) {
325 authentication(userName:rootProject.ossrhUsername, password: rootProject.ossrhPassword)
326 }
327 }
328
329 repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/", configureAuth)
330
331 snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/", configureAuth)
332
333 pom.project {
Bogdan Drutu1d2eda62017-06-19 23:54:11 -0700334 name "OpenCensus"
Bogdan Drutueba004c2017-04-13 13:52:39 -0700335 packaging 'jar'
Bogdan Drutueba004c2017-04-13 13:52:39 -0700336 description project.description
Bogdan Drutu95c9b202017-06-21 23:56:49 -0700337 url 'https://github.com/census-instrumentation/opencensus-java'
Bogdan Drutueba004c2017-04-13 13:52:39 -0700338
339 scm {
Bogdan Drutu95c9b202017-06-21 23:56:49 -0700340 connection 'scm:svn:https://github.com/census-instrumentation/opencensus-java'
341 developerConnection 'scm:git:git@github.com/census-instrumentation/opencensus-java'
342 url 'https://github.com/census-instrumentation/opencensus-java'
Bogdan Drutueba004c2017-04-13 13:52:39 -0700343 }
344
345 licenses {
346 license {
347 name 'The Apache License, Version 2.0'
348 url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
349 }
350 }
351
352 developers {
353 developer {
Bogdan Drutu1d2eda62017-06-19 23:54:11 -0700354 id 'io.opencensus'
355 name 'OpenCensus Contributors'
Bogdan Drutudca6c292017-10-27 14:09:23 -0700356 email 'census-developers@googlegroups.com'
Bogdan Drutu1d2eda62017-06-19 23:54:11 -0700357 url 'opencensus.io'
Bogdan Drutueba004c2017-04-13 13:52:39 -0700358 // https://issues.gradle.org/browse/GRADLE-2719
Bogdan Drutu6c2b6752018-02-15 17:10:23 -0800359 organization = 'OpenCensus Authors'
360 organizationUrl 'https://www.opencensus.io'
Bogdan Drutueba004c2017-04-13 13:52:39 -0700361 }
362 }
363 }
364 }
365 }
366 }
Bogdan Drutu6cb4dd22017-11-03 09:25:12 +1100367
Stefan Schmidt973ee9b2017-08-24 22:34:33 +0200368 // Upload the following artifacts only:
369 uploadArchives.onlyIf {
370 name in ['opencensus-api',
371 'opencensus-contrib-agent',
Bogdan Drutu709d97a2018-05-30 16:32:34 -0700372 'opencensus-contrib-appengine-standard-util',
sebright5298e6c2017-10-27 10:43:00 -0700373 'opencensus-contrib-grpc-metrics',
Bogdan Drutu8781dbb2017-09-05 10:40:42 -0700374 'opencensus-contrib-grpc-util',
Bogdan Drutuc90bec72018-01-25 15:13:17 -0800375 'opencensus-contrib-http-util',
Yang Song86dadee2018-04-26 09:53:32 -0700376 'opencensus-contrib-monitored-resource-util',
Bogdan Drutua8516962017-08-28 13:10:25 -0700377 'opencensus-contrib-zpages',
Yang Songb0d39672018-02-13 12:47:32 -0800378 'opencensus-exporter-stats-prometheus',
Maxime Petazzoni64d05832018-01-17 09:09:13 -0800379 'opencensus-exporter-stats-signalfx',
Yang Songb55bb812017-11-16 17:57:32 -0800380 'opencensus-exporter-stats-stackdriver',
Fabian Lange17a1a1a2018-02-09 14:33:30 -0500381 'opencensus-exporter-trace-instana',
Bogdan Drutua8516962017-08-28 13:10:25 -0700382 'opencensus-exporter-trace-logging',
383 'opencensus-exporter-trace-stackdriver',
Bogdan Drutu0b4f14a2017-10-27 11:04:41 -0700384 'opencensus-exporter-trace-zipkin',
Marc Carré81908052018-03-16 01:03:49 +0000385 'opencensus-exporter-trace-jaeger',
Stefan Schmidt973ee9b2017-08-24 22:34:33 +0200386 'opencensus-impl-core',
387 'opencensus-impl-lite',
388 'opencensus-impl',
389 'opencensus-testing']
390 }
Bogdan Drutueba004c2017-04-13 13:52:39 -0700391
Bogdan Drutu00202c02017-03-21 10:52:28 -0700392 // At a test failure, log the stack trace to the console so that we don't
393 // have to open the HTML in a browser.
394 test {
395 testLogging {
396 exceptionFormat = 'full'
397 showExceptions true
398 showCauses true
399 showStackTraces true
400 }
401 maxHeapSize = '1500m'
402 }
Kristen Kozaka5f4a102017-12-19 20:02:00 -0800403
404 if (useCheckerFramework) {
405 allprojects {
406 tasks.withType(JavaCompile).all { JavaCompile compile ->
407 compile.doFirst {
408 compile.options.compilerArgs += [
Kristen Kozak192d43a2018-03-27 12:28:55 -0700409 '-Xmaxerrs', '10000',
410 "-Xbootclasspath/p:${configurations.checkerFrameworkAnnotatedJDK.asPath}",
Bogdan Drutu709d97a2018-05-30 16:32:34 -0700411 "-AskipDefs=[\\.AutoValue_|\\.TraceIdProto]",
Kristen Kozakd45a9612018-04-04 13:50:40 -0700412 "-AinvariantArrays"
Kristen Kozaka5f4a102017-12-19 20:02:00 -0800413 ]
414 options.fork = true
415 options.forkOptions.jvmArgs += ["-Xbootclasspath/p:${configurations.checkerFrameworkJavac.asPath}"]
416 }
417 }
418 }
419 }
Stefan Schmidt7d681cc2018-03-09 21:41:09 +0100420
421 // For projects that depend on gRPC during test execution, make sure to
422 // also configure ALPN if running on a platform (e.g. FreeBSD) that is not
423 // supported by io.netty:netty-tcnative-boringssl-static:jar. Also see:
424 // https://github.com/grpc/grpc-java/blob/master/SECURITY.md#tls-with-jdk-jetty-alpnnpn
425 if (project.name in ['opencensus-exporter-stats-stackdriver',
426 'opencensus-exporter-trace-stackdriver']) {
427 def os = org.gradle.internal.os.OperatingSystem.current()
428 if (!os.isLinux() && !os.isWindows() && !os.isMacOsX()) {
429 configurations {
430 alpn
431 }
432 dependencies {
433 alpn 'org.mortbay.jetty.alpn:jetty-alpn-agent:2.0.7'
434 }
435 test {
436 jvmArgs "-javaagent:${configurations.alpn.asPath}"
437 }
438 }
439 }
Bogdan Drutu00202c02017-03-21 10:52:28 -0700440}