Kun Zhang | 4bc2d6d | 2015-04-17 10:49:11 -0700 | [diff] [blame] | 1 | buildscript { |
| 2 | repositories { |
| 3 | mavenCentral() |
| 4 | mavenLocal() |
Eric Anderson | 675080b | 2017-02-24 14:53:23 -0800 | [diff] [blame] | 5 | maven { |
| 6 | url "https://plugins.gradle.org/m2/" |
| 7 | } |
Kun Zhang | 4bc2d6d | 2015-04-17 10:49:11 -0700 | [diff] [blame] | 8 | } |
| 9 | dependencies { |
nmittler | c4bcf14 | 2015-09-16 15:15:10 -0700 | [diff] [blame] | 10 | classpath 'com.google.gradle:osdetector-gradle-plugin:1.4.0' |
Eric Anderson | 675080b | 2017-02-24 14:53:23 -0800 | [diff] [blame] | 11 | classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0' |
Carl Mastrangelo | 1da1dba | 2017-06-07 17:18:44 -0700 | [diff] [blame] | 12 | classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.10' |
Kun Zhang | 4bc2d6d | 2015-04-17 10:49:11 -0700 | [diff] [blame] | 13 | } |
| 14 | } |
Eric Anderson | b938ba5 | 2015-02-28 09:59:25 -0800 | [diff] [blame] | 15 | |
Louis Ryan | 540b4d3 | 2015-09-04 13:26:24 -0700 | [diff] [blame] | 16 | subprojects { |
Eric Anderson | c3e8dae | 2015-01-30 14:58:07 -0800 | [diff] [blame] | 17 | apply plugin: "checkstyle" |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 18 | apply plugin: "java" |
| 19 | apply plugin: "maven" |
nmittler | 52f4220 | 2015-01-21 14:30:14 -0800 | [diff] [blame] | 20 | apply plugin: "idea" |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 21 | apply plugin: "signing" |
Eric Anderson | 041cdb1 | 2015-05-05 12:29:26 -0700 | [diff] [blame] | 22 | apply plugin: "jacoco" |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 23 | |
nmittler | c4bcf14 | 2015-09-16 15:15:10 -0700 | [diff] [blame] | 24 | apply plugin: "com.google.osdetector" |
Eric Anderson | 42aa64c | 2017-02-02 13:48:12 -0800 | [diff] [blame] | 25 | // The plugin only has an effect if a signature is specified |
| 26 | apply plugin: "ru.vyarus.animalsniffer" |
Eric Anderson | 675080b | 2017-02-24 14:53:23 -0800 | [diff] [blame] | 27 | if (!rootProject.hasProperty('errorProne') || rootProject.errorProne.toBoolean()) { |
| 28 | apply plugin: "net.ltgt.errorprone" |
Eric Anderson | 982541b | 2017-04-26 13:33:27 -0700 | [diff] [blame] | 29 | |
| 30 | dependencies { |
| 31 | // The ErrorProne plugin defaults to the latest, which would break our |
| 32 | // build if error prone releases a new version with a new check |
| 33 | errorprone 'com.google.errorprone:error_prone_core:2.0.19' |
| 34 | } |
| 35 | } else { |
| 36 | // Remove per-project error-prone checker config |
| 37 | allprojects { |
| 38 | afterEvaluate { project -> |
| 39 | project.tasks.withType(JavaCompile) { |
| 40 | options.compilerArgs.removeAll { it.startsWith("-Xep:") } |
| 41 | } |
| 42 | } |
| 43 | } |
Eric Anderson | 675080b | 2017-02-24 14:53:23 -0800 | [diff] [blame] | 44 | } |
nmittler | c4bcf14 | 2015-09-16 15:15:10 -0700 | [diff] [blame] | 45 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 46 | group = "io.grpc" |
Carl Mastrangelo | 4ce52d1 | 2017-05-23 17:57:25 -0700 | [diff] [blame] | 47 | version = "1.5.0-SNAPSHOT" // CURRENT_GRPC_VERSION |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 48 | |
| 49 | sourceCompatibility = 1.6 |
| 50 | targetCompatibility = 1.6 |
| 51 | |
| 52 | repositories { |
| 53 | mavenCentral() |
| 54 | mavenLocal() |
| 55 | } |
| 56 | |
Eric Anderson | 76d0955 | 2015-03-12 15:25:11 -0700 | [diff] [blame] | 57 | [compileJava, compileTestJava].each() { |
Eric Anderson | 675080b | 2017-02-24 14:53:23 -0800 | [diff] [blame] | 58 | it.options.compilerArgs += ["-Xlint:all", "-Xlint:-options", "-Xlint:-path"] |
Eric Anderson | 76d0955 | 2015-03-12 15:25:11 -0700 | [diff] [blame] | 59 | it.options.encoding = "UTF-8" |
Eric Anderson | 3c03eb7 | 2016-07-10 11:40:12 -0700 | [diff] [blame] | 60 | if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) { |
| 61 | it.options.compilerArgs += ["-Werror"] |
| 62 | } |
nmittler | 02c953e | 2015-01-26 14:03:11 -0800 | [diff] [blame] | 63 | } |
| 64 | |
Eric Anderson | 641cb35 | 2016-05-24 14:29:52 -0700 | [diff] [blame] | 65 | compileTestJava { |
| 66 | // serialVersionUID is basically guaranteed to be useless in our tests |
| 67 | options.compilerArgs += ["-Xlint:-serial"] |
| 68 | } |
| 69 | |
nmittler | 8c1d38a | 2015-06-01 08:31:00 -0700 | [diff] [blame] | 70 | jar.manifest { |
| 71 | attributes('Implementation-Title': name, |
| 72 | 'Implementation-Version': version, |
| 73 | 'Built-By': System.getProperty('user.name'), |
| 74 | 'Built-JDK': System.getProperty('java.version'), |
| 75 | 'Source-Compatibility': sourceCompatibility, |
| 76 | 'Target-Compatibility': targetCompatibility) |
| 77 | } |
| 78 | |
Eric Anderson | 10fb206 | 2015-05-05 10:28:38 -0700 | [diff] [blame] | 79 | javadoc.options { |
| 80 | encoding = 'UTF-8' |
ZHANG Dapeng | 66ebcb1 | 2017-05-17 08:52:07 -0700 | [diff] [blame] | 81 | use = true |
Eric Anderson | 10fb206 | 2015-05-05 10:28:38 -0700 | [diff] [blame] | 82 | links 'https://docs.oracle.com/javase/8/docs/api/' |
| 83 | } |
Eric Anderson | 14444a9 | 2015-03-11 16:44:38 -0700 | [diff] [blame] | 84 | |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 85 | ext { |
Kun Zhang | 6b1e7d6 | 2015-05-07 15:20:44 -0700 | [diff] [blame] | 86 | def exeSuffix = osdetector.os == 'windows' ? ".exe" : "" |
| 87 | protocPluginBaseName = 'protoc-gen-grpc-java' |
Eric Anderson | 46ce409 | 2016-01-26 12:13:06 -0800 | [diff] [blame] | 88 | javaPluginPath = "$rootDir/compiler/build/exe/java_plugin/$protocPluginBaseName$exeSuffix" |
Kun Zhang | 6b1e7d6 | 2015-05-07 15:20:44 -0700 | [diff] [blame] | 89 | |
Łukasz Strzałkowski | 67eefa6 | 2017-05-15 10:57:43 -0700 | [diff] [blame] | 90 | nettyVersion = '4.1.11.Final' |
Eric Anderson | 2eeb5e3 | 2017-02-23 17:02:31 -0800 | [diff] [blame] | 91 | guavaVersion = '19.0' |
Carl Mastrangelo | 0fe2c5c | 2017-05-23 17:04:51 -0700 | [diff] [blame] | 92 | protobufVersion = '3.3.1' |
| 93 | protocVersion = '3.3.0' // TODO(carl-mastrangelo): set this from protobufVersion when versions align again |
Kun Zhang | e2ed2e8 | 2016-01-27 08:26:19 -0800 | [diff] [blame] | 94 | protobufNanoVersion = '3.0.0-alpha-5' |
Kun Zhang | 6b1e7d6 | 2015-05-07 15:20:44 -0700 | [diff] [blame] | 95 | |
Kun Zhang | 111f6dd | 2015-05-05 16:11:27 -0700 | [diff] [blame] | 96 | configureProtoCompilation = { |
Kun Zhang | 35f77ee | 2015-06-22 16:29:30 -0700 | [diff] [blame] | 97 | String generatedSourcePath = "${projectDir}/src/generated" |
Kun Zhang | 111f6dd | 2015-05-05 16:11:27 -0700 | [diff] [blame] | 98 | if (rootProject.childProjects.containsKey('grpc-compiler')) { |
| 99 | // Only when the codegen is built along with the project, will we be able to recompile |
| 100 | // the proto files. |
| 101 | project.apply plugin: 'com.google.protobuf' |
Kun Zhang | 35f77ee | 2015-06-22 16:29:30 -0700 | [diff] [blame] | 102 | project.protobuf { |
| 103 | protoc { |
| 104 | if (project.hasProperty('protoc')) { |
| 105 | path = project.protoc |
| 106 | } else { |
Carl Mastrangelo | 0fe2c5c | 2017-05-23 17:04:51 -0700 | [diff] [blame] | 107 | artifact = "com.google.protobuf:protoc:${protocVersion}" |
Kun Zhang | 35f77ee | 2015-06-22 16:29:30 -0700 | [diff] [blame] | 108 | } |
| 109 | } |
| 110 | plugins { |
| 111 | grpc { |
| 112 | path = javaPluginPath |
| 113 | } |
| 114 | } |
| 115 | generateProtoTasks { |
| 116 | all().each { task -> |
| 117 | task.dependsOn ':grpc-compiler:java_pluginExecutable' |
| 118 | // Delete the generated sources first, so that we can be alerted if they are not re-compiled. |
Eric Anderson | e9b4d15 | 2016-04-19 11:54:04 -0700 | [diff] [blame] | 119 | task.dependsOn 'deleteGeneratedSource' + task.sourceSet.name |
Kun Zhang | 35f77ee | 2015-06-22 16:29:30 -0700 | [diff] [blame] | 120 | // Recompile protos when the codegen has been changed |
| 121 | task.inputs.file javaPluginPath |
| 122 | // Recompile protos when build.gradle has been changed, because |
| 123 | // it's possible the version of protoc has been changed. |
| 124 | task.inputs.file "${rootProject.projectDir}/build.gradle" |
| 125 | task.plugins { |
ZHANG Dapeng | e109125 | 2016-07-21 16:35:18 -0700 | [diff] [blame] | 126 | grpc { |
| 127 | // To generate deprecated interfaces and static bindService method, |
| 128 | // turn the enable_deprecated option to true below: |
| 129 | option 'enable_deprecated=false' |
| 130 | } |
Kun Zhang | 2cdc5e3 | 2015-05-11 16:58:28 -0700 | [diff] [blame] | 131 | } |
| 132 | } |
| 133 | } |
Kun Zhang | 35f77ee | 2015-06-22 16:29:30 -0700 | [diff] [blame] | 134 | generatedFilesBaseDir = generatedSourcePath |
| 135 | } |
| 136 | |
Eric Anderson | e9b4d15 | 2016-04-19 11:54:04 -0700 | [diff] [blame] | 137 | sourceSets.each { sourceSet -> |
Carl Mastrangelo | aaf9067 | 2017-03-23 18:02:35 -0700 | [diff] [blame] | 138 | task "deleteGeneratedSource${sourceSet.name}" { |
| 139 | doLast { |
| 140 | project.delete project.fileTree(dir: generatedSourcePath + '/' + sourceSet.name) |
| 141 | } |
Eric Anderson | e9b4d15 | 2016-04-19 11:54:04 -0700 | [diff] [blame] | 142 | } |
Kun Zhang | 2cdc5e3 | 2015-05-11 16:58:28 -0700 | [diff] [blame] | 143 | } |
Kun Zhang | 111f6dd | 2015-05-05 16:11:27 -0700 | [diff] [blame] | 144 | } else { |
| 145 | // Otherwise, we just use the checked-in generated code. |
| 146 | project.sourceSets { |
| 147 | main { |
| 148 | java { |
Kun Zhang | 35f77ee | 2015-06-22 16:29:30 -0700 | [diff] [blame] | 149 | srcDir "${generatedSourcePath}/main/java" |
Eric Anderson | cea8e8e | 2015-10-27 19:53:18 -0700 | [diff] [blame] | 150 | srcDir "${generatedSourcePath}/main/javanano" |
Kun Zhang | 35f77ee | 2015-06-22 16:29:30 -0700 | [diff] [blame] | 151 | srcDir "${generatedSourcePath}/main/grpc" |
Kun Zhang | 287a27a | 2015-05-07 17:32:31 -0700 | [diff] [blame] | 152 | } |
Kun Zhang | 111f6dd | 2015-05-05 16:11:27 -0700 | [diff] [blame] | 153 | } |
Eric Anderson | cea8e8e | 2015-10-27 19:53:18 -0700 | [diff] [blame] | 154 | test { |
| 155 | java { |
| 156 | srcDir "${generatedSourcePath}/test/java" |
| 157 | srcDir "${generatedSourcePath}/test/javanano" |
| 158 | srcDir "${generatedSourcePath}/test/grpc" |
| 159 | } |
| 160 | } |
Kun Zhang | 111f6dd | 2015-05-05 16:11:27 -0700 | [diff] [blame] | 161 | } |
| 162 | } |
Eric Anderson | dbef1af | 2016-05-23 12:05:41 -0700 | [diff] [blame] | 163 | |
Eric Gribkoff | c8c9fff | 2016-11-28 13:20:55 -0800 | [diff] [blame] | 164 | [compileJava, compileTestJava].each() { |
Eric Anderson | dbef1af | 2016-05-23 12:05:41 -0700 | [diff] [blame] | 165 | // Protobuf-generated code produces some warnings. |
Eric Anderson | 675080b | 2017-02-24 14:53:23 -0800 | [diff] [blame] | 166 | // https://github.com/google/protobuf/issues/2718 |
| 167 | it.options.compilerArgs += ["-Xlint:-cast", "-Xep:MissingOverride:OFF", |
| 168 | "-Xep:ReferenceEquality:OFF", "-Xep:FunctionalInterfaceClash:OFF"] |
Eric Anderson | dbef1af | 2016-05-23 12:05:41 -0700 | [diff] [blame] | 169 | } |
Kun Zhang | 111f6dd | 2015-05-05 16:11:27 -0700 | [diff] [blame] | 170 | } |
| 171 | |
Eric Anderson | 65d73c0 | 2015-05-21 11:54:04 -0700 | [diff] [blame] | 172 | def epoll_suffix = ""; |
| 173 | if (osdetector.classifier in ["linux-x86_64"]) { |
| 174 | // The native code is only pre-compiled on certain platforms. |
| 175 | epoll_suffix = ":" + osdetector.classifier |
| 176 | } |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 177 | libraries = [ |
Carl Mastrangelo | ee12cc2 | 2017-03-22 22:09:04 -0700 | [diff] [blame] | 178 | errorprone: "com.google.errorprone:error_prone_annotations:2.0.19", |
Carl Mastrangelo | 2825361 | 2016-05-16 10:23:53 -0700 | [diff] [blame] | 179 | guava: "com.google.guava:guava:${guavaVersion}", |
Jeff Pinner | b1cc7cc | 2015-02-25 10:17:23 -0800 | [diff] [blame] | 180 | hpack: 'com.twitter:hpack:0.10.1', |
nmittler | b897a89 | 2015-02-23 12:03:59 -0800 | [diff] [blame] | 181 | jsr305: 'com.google.code.findbugs:jsr305:3.0.0', |
Kun Zhang | def237d | 2016-06-14 13:51:24 -0700 | [diff] [blame] | 182 | oauth_client: 'com.google.auth:google-auth-library-oauth2-http:0.4.0', |
Eric Gribkoff | df69485 | 2017-05-01 14:43:53 -0700 | [diff] [blame] | 183 | google_api_protos: 'com.google.api.grpc:proto-google-common-protos:0.1.9', |
Kun Zhang | def237d | 2016-06-14 13:51:24 -0700 | [diff] [blame] | 184 | google_auth_credentials: 'com.google.auth:google-auth-library-credentials:0.4.0', |
Xudong Ma | 6d296e8 | 2015-09-21 10:39:00 -0700 | [diff] [blame] | 185 | okhttp: 'com.squareup.okhttp:okhttp:2.5.0', |
Xudong Ma | b121c46 | 2015-09-21 12:54:06 -0700 | [diff] [blame] | 186 | okio: 'com.squareup.okio:okio:1.6.0', |
Yang Song | 4a0cf0b | 2017-06-06 18:16:55 -0700 | [diff] [blame] | 187 | instrumentation_api: 'com.google.instrumentation:instrumentation-api:0.4.3', |
Kun Zhang | c5b94c7 | 2015-05-06 16:44:55 -0700 | [diff] [blame] | 188 | protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}", |
Eric Anderson | a8700a7 | 2016-07-29 11:57:41 -0700 | [diff] [blame] | 189 | protobuf_lite: "com.google.protobuf:protobuf-lite:3.0.1", |
Eric Anderson | b1d72e5 | 2016-09-27 17:15:12 -0700 | [diff] [blame] | 190 | protoc_lite: "com.google.protobuf:protoc-gen-javalite:3.0.0", |
Kun Zhang | bd23a8d | 2015-08-28 18:47:06 -0700 | [diff] [blame] | 191 | protobuf_nano: "com.google.protobuf.nano:protobuf-javanano:${protobufNanoVersion}", |
Kun Zhang | 9d747bb | 2016-08-18 13:06:18 -0700 | [diff] [blame] | 192 | protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.8.0', |
Carl Mastrangelo | 8e1fba7 | 2016-03-02 09:30:35 -0800 | [diff] [blame] | 193 | protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}", |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 194 | |
Łukasz Strzałkowski | 67eefa6 | 2017-05-15 10:57:43 -0700 | [diff] [blame] | 195 | netty: "io.netty:netty-codec-http2:[${nettyVersion}]", |
| 196 | netty_epoll: "io.netty:netty-transport-native-epoll:${nettyVersion}" + epoll_suffix, |
| 197 | netty_proxy_handler: "io.netty:netty-handler-proxy:${nettyVersion}", |
Carl Mastrangelo | 8d304b6 | 2017-06-09 10:42:00 -0700 | [diff] [blame^] | 198 | netty_tcnative: 'io.netty:netty-tcnative-boringssl-static:2.0.3.Final', |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 199 | |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 200 | // Test dependencies. |
| 201 | junit: 'junit:junit:4.11', |
Carl Mastrangelo | b3bc7fc | 2016-04-01 15:18:23 -0700 | [diff] [blame] | 202 | mockito: 'org.mockito:mockito-core:1.9.5', |
Louis Ryan | a7049bc | 2016-03-23 13:18:04 -0700 | [diff] [blame] | 203 | truth: 'com.google.truth:truth:0.28', |
| 204 | |
| 205 | // Benchmark dependencies |
| 206 | hdrhistogram: 'org.hdrhistogram:HdrHistogram:2.1.8', |
| 207 | math: 'org.apache.commons:commons-math3:3.6', |
ZHANG Dapeng | aed886d | 2016-05-02 14:01:36 -0700 | [diff] [blame] | 208 | |
| 209 | // Jetty ALPN dependencies |
Eric Anderson | 308b6ea | 2017-03-13 10:13:42 -0700 | [diff] [blame] | 210 | jetty_alpn_agent: 'org.mortbay.jetty.alpn:jetty-alpn-agent:2.0.6' |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 211 | ] |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 212 | } |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 213 | |
ZHANG Dapeng | aed886d | 2016-05-02 14:01:36 -0700 | [diff] [blame] | 214 | // Define a separate configuration for managing the dependency on Jetty ALPN agent. |
nmittler | 74cfe6c | 2015-05-22 12:25:10 -0700 | [diff] [blame] | 215 | configurations { |
ZHANG Dapeng | aed886d | 2016-05-02 14:01:36 -0700 | [diff] [blame] | 216 | alpnagent |
nmittler | 74cfe6c | 2015-05-22 12:25:10 -0700 | [diff] [blame] | 217 | } |
| 218 | |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 219 | dependencies { |
| 220 | testCompile libraries.junit, |
| 221 | libraries.mockito |
nmittler | 74cfe6c | 2015-05-22 12:25:10 -0700 | [diff] [blame] | 222 | |
ZHANG Dapeng | aed886d | 2016-05-02 14:01:36 -0700 | [diff] [blame] | 223 | // Configuration for modules that use Jetty ALPN agent |
| 224 | alpnagent libraries.jetty_alpn_agent |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 225 | } |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 226 | |
| 227 | signing { |
| 228 | required false |
| 229 | sign configurations.archives |
| 230 | } |
| 231 | |
nmittler | 732cfc0 | 2015-03-03 07:59:13 -0800 | [diff] [blame] | 232 | // Disable JavaDoc doclint on Java 8. It's annoying. |
| 233 | if (JavaVersion.current().isJava8Compatible()) { |
| 234 | allprojects { |
| 235 | tasks.withType(Javadoc) { |
| 236 | options.addStringOption('Xdoclint:none', '-quiet') |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | |
Eric Anderson | c3e8dae | 2015-01-30 14:58:07 -0800 | [diff] [blame] | 241 | checkstyle { |
| 242 | configFile = file("$rootDir/checkstyle.xml") |
Eric Anderson | 6ab27ab | 2016-04-18 09:15:25 -0700 | [diff] [blame] | 243 | toolVersion = "6.17" |
Eric Anderson | ad44f0a | 2015-05-05 08:54:51 -0700 | [diff] [blame] | 244 | ignoreFailures = false |
Eric Anderson | 26141b4 | 2015-03-21 10:59:17 -0700 | [diff] [blame] | 245 | if (rootProject.hasProperty("checkstyle.ignoreFailures")) { |
| 246 | ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean() |
| 247 | } |
Eric Anderson | efa774b | 2015-09-15 10:34:14 -0700 | [diff] [blame] | 248 | configProperties["rootDir"] = rootDir |
Eric Anderson | c3e8dae | 2015-01-30 14:58:07 -0800 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | checkstyleMain { |
Kun Zhang | 693a7d2 | 2015-05-06 11:35:08 -0700 | [diff] [blame] | 252 | source = fileTree(dir: "src/main", include: "**/*.java") |
Eric Anderson | c3e8dae | 2015-01-30 14:58:07 -0800 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | checkstyleTest { |
Kun Zhang | 693a7d2 | 2015-05-06 11:35:08 -0700 | [diff] [blame] | 256 | source = fileTree(dir: "src/test", include: "**/*.java") |
Eric Anderson | c3e8dae | 2015-01-30 14:58:07 -0800 | [diff] [blame] | 257 | } |
| 258 | |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 259 | task javadocJar(type: Jar) { |
| 260 | classifier = 'javadoc' |
| 261 | from javadoc |
| 262 | } |
| 263 | |
| 264 | task sourcesJar(type: Jar) { |
| 265 | classifier = 'sources' |
| 266 | from sourceSets.main.allSource |
| 267 | } |
| 268 | |
| 269 | artifacts { |
| 270 | archives javadocJar, sourcesJar |
| 271 | } |
| 272 | |
| 273 | uploadArchives.repositories.mavenDeployer { |
| 274 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } |
zhangkun83 | da3c3f8 | 2015-03-11 18:03:31 -0700 | [diff] [blame] | 275 | String stagingUrl |
Kun Zhang | 2f74971 | 2015-05-06 13:10:28 -0700 | [diff] [blame] | 276 | if (rootProject.hasProperty('repositoryId')) { |
| 277 | stagingUrl = 'https://oss.sonatype.org/service/local/staging/deployByRepositoryId/' + |
| 278 | rootProject.repositoryId |
zhangkun83 | da3c3f8 | 2015-03-11 18:03:31 -0700 | [diff] [blame] | 279 | } else { |
| 280 | stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' |
| 281 | } |
Kun Zhang | 2f74971 | 2015-05-06 13:10:28 -0700 | [diff] [blame] | 282 | def configureAuth = { |
| 283 | if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) { |
| 284 | authentication(userName: rootProject.ossrhUsername, password: rootProject.ossrhPassword) |
| 285 | } |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 286 | } |
Kun Zhang | 2f74971 | 2015-05-06 13:10:28 -0700 | [diff] [blame] | 287 | repository(url: stagingUrl, configureAuth) |
| 288 | snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/', configureAuth) |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 289 | } |
Carl Mastrangelo | 4988d8b | 2017-01-19 12:48:55 -0800 | [diff] [blame] | 290 | uploadArchives.onlyIf { !name.contains("thrift") } |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 291 | |
| 292 | [ |
| 293 | install.repositories.mavenInstaller, |
| 294 | uploadArchives.repositories.mavenDeployer, |
| 295 | ]*.pom*.whenConfigured { pom -> |
| 296 | pom.project { |
Eric Anderson | 7e8a02c | 2015-03-12 17:03:01 -0700 | [diff] [blame] | 297 | name "$project.group:$project.name" |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 298 | description project.description |
| 299 | url 'https://github.com/grpc/grpc-java' |
| 300 | |
| 301 | scm { |
Eric Anderson | b735495 | 2016-04-08 08:37:07 -0700 | [diff] [blame] | 302 | connection 'scm:git:https://github.com/grpc/grpc-java.git' |
| 303 | developerConnection 'scm:git:git@github.com:grpc/grpc-java.git' |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 304 | url 'https://github.com/grpc/grpc-java' |
| 305 | } |
| 306 | |
| 307 | licenses { |
| 308 | license { |
Carl Mastrangelo | 7b97df0 | 2017-05-31 14:37:42 -0700 | [diff] [blame] | 309 | name 'Apache 2.0' |
| 310 | url 'https://opensource.org/licenses/Apache-2.0' |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 311 | } |
| 312 | } |
Eric Anderson | 7e8a02c | 2015-03-12 17:03:01 -0700 | [diff] [blame] | 313 | |
| 314 | developers { |
| 315 | developer { |
| 316 | id "grpc.io" |
| 317 | name "gRPC Contributors" |
| 318 | email "grpc-io@googlegroups.com" |
| 319 | url "http://grpc.io/" |
| 320 | // https://issues.gradle.org/browse/GRADLE-2719 |
Carl Mastrangelo | 3bfd630 | 2017-05-31 13:29:01 -0700 | [diff] [blame] | 321 | organization = "gRPC Authors" |
Eric Anderson | 7e8a02c | 2015-03-12 17:03:01 -0700 | [diff] [blame] | 322 | organizationUrl "https://www.google.com" |
| 323 | } |
| 324 | } |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 325 | } |
Eric Anderson | 90db93b | 2016-04-08 13:47:30 -0700 | [diff] [blame] | 326 | if (!(project.name in |
Naveen Reddy Chedeti | 2860959 | 2016-07-28 08:48:27 -0700 | [diff] [blame] | 327 | ["grpc-stub", "grpc-protobuf", "grpc-protobuf-lite", "grpc-protobuf-nano", "grpc-thrift"])) { |
Eric Anderson | 90db93b | 2016-04-08 13:47:30 -0700 | [diff] [blame] | 328 | def core = pom.dependencies.find {dep -> dep.artifactId == 'grpc-core'} |
| 329 | if (core != null) { |
| 330 | // Depend on specific version of grpc-core because internal package is unstable |
| 331 | core.version = "[" + core.version + "]" |
| 332 | } |
| 333 | } |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 334 | } |
Kun Zhang | 3ddd1d5 | 2015-04-22 10:02:19 -0700 | [diff] [blame] | 335 | // At a test failure, log the stack trace to the console so that we don't |
| 336 | // have to open the HTML in a browser. |
| 337 | test { |
| 338 | testLogging { |
| 339 | exceptionFormat = 'full' |
nmittler | 4ee2a65 | 2015-06-01 16:20:08 -0700 | [diff] [blame] | 340 | showExceptions true |
| 341 | showCauses true |
| 342 | showStackTraces true |
Kun Zhang | 3ddd1d5 | 2015-04-22 10:02:19 -0700 | [diff] [blame] | 343 | } |
Eric Anderson | 56dca03 | 2016-02-12 08:48:41 -0800 | [diff] [blame] | 344 | maxHeapSize = '1500m' |
Kun Zhang | 3ddd1d5 | 2015-04-22 10:02:19 -0700 | [diff] [blame] | 345 | } |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 346 | } |