2015-04-18 01:49:11 +08:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
2017-02-25 06:53:23 +08:00
|
|
|
maven {
|
|
|
|
url "https://plugins.gradle.org/m2/"
|
|
|
|
}
|
2015-04-18 01:49:11 +08:00
|
|
|
}
|
|
|
|
dependencies {
|
2015-09-17 06:15:10 +08:00
|
|
|
classpath 'com.google.gradle:osdetector-gradle-plugin:1.4.0'
|
2017-07-19 04:53:45 +08:00
|
|
|
classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.4.0'
|
2018-01-09 06:05:16 +08:00
|
|
|
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.13'
|
|
|
|
classpath 'net.ltgt.gradle:gradle-apt-plugin:0.13'
|
2018-05-17 06:37:24 +08:00
|
|
|
classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.5"
|
2017-09-27 23:31:43 +08:00
|
|
|
classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.2.5'
|
2015-04-18 01:49:11 +08:00
|
|
|
}
|
|
|
|
}
|
2015-03-01 01:59:25 +08:00
|
|
|
|
2015-09-05 04:26:24 +08:00
|
|
|
subprojects {
|
2015-01-31 06:58:07 +08:00
|
|
|
apply plugin: "checkstyle"
|
2014-12-16 01:58:05 +08:00
|
|
|
apply plugin: "java"
|
|
|
|
apply plugin: "maven"
|
2015-01-22 06:30:14 +08:00
|
|
|
apply plugin: "idea"
|
2015-03-03 05:31:14 +08:00
|
|
|
apply plugin: "signing"
|
2015-05-06 03:29:26 +08:00
|
|
|
apply plugin: "jacoco"
|
2014-12-16 01:58:05 +08:00
|
|
|
|
2017-08-27 08:10:18 +08:00
|
|
|
apply plugin: "me.champeau.gradle.jmh"
|
2015-09-17 06:15:10 +08:00
|
|
|
apply plugin: "com.google.osdetector"
|
2017-02-03 05:48:12 +08:00
|
|
|
// The plugin only has an effect if a signature is specified
|
|
|
|
apply plugin: "ru.vyarus.animalsniffer"
|
2017-02-25 06:53:23 +08:00
|
|
|
if (!rootProject.hasProperty('errorProne') || rootProject.errorProne.toBoolean()) {
|
|
|
|
apply plugin: "net.ltgt.errorprone"
|
2018-01-09 06:05:16 +08:00
|
|
|
apply plugin: "net.ltgt.apt"
|
2017-04-27 04:33:27 +08:00
|
|
|
|
|
|
|
dependencies {
|
|
|
|
// The ErrorProne plugin defaults to the latest, which would break our
|
|
|
|
// build if error prone releases a new version with a new check
|
2018-01-11 01:30:38 +08:00
|
|
|
errorprone 'com.google.errorprone:error_prone_core:2.2.0'
|
2018-01-09 06:05:16 +08:00
|
|
|
apt 'com.google.guava:guava-beta-checker:1.0'
|
2017-04-27 04:33:27 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Remove per-project error-prone checker config
|
|
|
|
allprojects {
|
|
|
|
afterEvaluate { project ->
|
|
|
|
project.tasks.withType(JavaCompile) {
|
2018-03-13 09:37:14 +08:00
|
|
|
options.compilerArgs.removeAll { it.startsWith("-Xep") }
|
2017-04-27 04:33:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-02-25 06:53:23 +08:00
|
|
|
}
|
2017-07-16 03:41:20 +08:00
|
|
|
// TODO(zpencer): remove when intellij 2017.2 is released
|
|
|
|
// https://github.com/gradle/gradle/issues/2315
|
|
|
|
idea.module.inheritOutputDirs = true
|
2015-09-17 06:15:10 +08:00
|
|
|
|
2015-01-28 02:25:39 +08:00
|
|
|
group = "io.grpc"
|
2018-06-05 07:08:31 +08:00
|
|
|
version = "1.14.0-SNAPSHOT" // CURRENT_GRPC_VERSION
|
2014-12-16 01:58:05 +08:00
|
|
|
|
|
|
|
sourceCompatibility = 1.6
|
|
|
|
targetCompatibility = 1.6
|
|
|
|
|
|
|
|
repositories {
|
2017-09-26 06:38:48 +08:00
|
|
|
maven {
|
2018-03-02 11:11:24 +08:00
|
|
|
// The google mirror is less flaky than mavenCentral()
|
|
|
|
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
|
2017-09-26 06:38:48 +08:00
|
|
|
}
|
2018-03-02 11:11:24 +08:00
|
|
|
mavenLocal()
|
2014-12-16 01:58:05 +08:00
|
|
|
}
|
|
|
|
|
2017-08-27 08:10:18 +08:00
|
|
|
[compileJava, compileTestJava, compileJmhJava].each() {
|
2017-02-25 06:53:23 +08:00
|
|
|
it.options.compilerArgs += ["-Xlint:all", "-Xlint:-options", "-Xlint:-path"]
|
2015-03-13 06:25:11 +08:00
|
|
|
it.options.encoding = "UTF-8"
|
2016-07-11 02:40:12 +08:00
|
|
|
if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
|
|
|
|
it.options.compilerArgs += ["-Werror"]
|
|
|
|
}
|
2015-01-27 06:03:11 +08:00
|
|
|
}
|
|
|
|
|
2016-05-25 05:29:52 +08:00
|
|
|
compileTestJava {
|
|
|
|
// serialVersionUID is basically guaranteed to be useless in our tests
|
2018-01-09 07:08:56 +08:00
|
|
|
// LinkedList doesn't hurt much in tests and has lots of usages
|
|
|
|
options.compilerArgs += ["-Xlint:-serial", "-Xep:JdkObsolete:OFF"]
|
2016-05-25 05:29:52 +08:00
|
|
|
}
|
|
|
|
|
2015-06-01 23:31:00 +08:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2015-05-06 01:28:38 +08:00
|
|
|
javadoc.options {
|
|
|
|
encoding = 'UTF-8'
|
2017-05-17 23:52:07 +08:00
|
|
|
use = true
|
2015-05-06 01:28:38 +08:00
|
|
|
links 'https://docs.oracle.com/javase/8/docs/api/'
|
|
|
|
}
|
2015-03-12 07:44:38 +08:00
|
|
|
|
2015-02-14 08:21:53 +08:00
|
|
|
ext {
|
2015-05-08 06:20:44 +08:00
|
|
|
def exeSuffix = osdetector.os == 'windows' ? ".exe" : ""
|
|
|
|
protocPluginBaseName = 'protoc-gen-grpc-java'
|
2016-01-27 04:13:06 +08:00
|
|
|
javaPluginPath = "$rootDir/compiler/build/exe/java_plugin/$protocPluginBaseName$exeSuffix"
|
2015-05-08 06:20:44 +08:00
|
|
|
|
2018-05-24 08:16:45 +08:00
|
|
|
nettyVersion = '4.1.25.Final'
|
2018-03-24 06:45:05 +08:00
|
|
|
guavaVersion = '20.0'
|
2018-01-06 08:40:20 +08:00
|
|
|
protobufVersion = '3.5.1'
|
|
|
|
protocVersion = '3.5.1-1'
|
2016-01-28 00:26:19 +08:00
|
|
|
protobufNanoVersion = '3.0.0-alpha-5'
|
2018-06-05 06:27:27 +08:00
|
|
|
opencensusVersion = '0.12.3'
|
2015-05-08 06:20:44 +08:00
|
|
|
|
2015-05-06 07:11:27 +08:00
|
|
|
configureProtoCompilation = {
|
2015-06-23 07:29:30 +08:00
|
|
|
String generatedSourcePath = "${projectDir}/src/generated"
|
2015-05-06 07:11:27 +08:00
|
|
|
if (rootProject.childProjects.containsKey('grpc-compiler')) {
|
|
|
|
// Only when the codegen is built along with the project, will we be able to recompile
|
|
|
|
// the proto files.
|
|
|
|
project.apply plugin: 'com.google.protobuf'
|
2015-06-23 07:29:30 +08:00
|
|
|
project.protobuf {
|
|
|
|
protoc {
|
|
|
|
if (project.hasProperty('protoc')) {
|
|
|
|
path = project.protoc
|
|
|
|
} else {
|
2017-05-24 08:04:51 +08:00
|
|
|
artifact = "com.google.protobuf:protoc:${protocVersion}"
|
2015-06-23 07:29:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
plugins {
|
|
|
|
grpc {
|
|
|
|
path = javaPluginPath
|
|
|
|
}
|
|
|
|
}
|
|
|
|
generateProtoTasks {
|
|
|
|
all().each { task ->
|
|
|
|
task.dependsOn ':grpc-compiler:java_pluginExecutable'
|
|
|
|
// Delete the generated sources first, so that we can be alerted if they are not re-compiled.
|
2016-04-20 02:54:04 +08:00
|
|
|
task.dependsOn 'deleteGeneratedSource' + task.sourceSet.name
|
2015-06-23 07:29:30 +08:00
|
|
|
// Recompile protos when the codegen has been changed
|
|
|
|
task.inputs.file javaPluginPath
|
|
|
|
// Recompile protos when build.gradle has been changed, because
|
|
|
|
// it's possible the version of protoc has been changed.
|
|
|
|
task.inputs.file "${rootProject.projectDir}/build.gradle"
|
|
|
|
task.plugins {
|
2016-07-22 07:35:18 +08:00
|
|
|
grpc {
|
2016-06-17 04:54:12 +08:00
|
|
|
option 'noversion'
|
2016-07-22 07:35:18 +08:00
|
|
|
}
|
2015-05-08 08:32:31 +08:00
|
|
|
}
|
|
|
|
}
|
2015-05-06 07:11:27 +08:00
|
|
|
}
|
2015-06-23 07:29:30 +08:00
|
|
|
generatedFilesBaseDir = generatedSourcePath
|
|
|
|
}
|
|
|
|
|
2016-04-20 02:54:04 +08:00
|
|
|
sourceSets.each { sourceSet ->
|
2017-03-24 09:02:35 +08:00
|
|
|
task "deleteGeneratedSource${sourceSet.name}" {
|
|
|
|
doLast {
|
|
|
|
project.delete project.fileTree(dir: generatedSourcePath + '/' + sourceSet.name)
|
|
|
|
}
|
2016-04-20 02:54:04 +08:00
|
|
|
}
|
2015-05-06 07:11:27 +08:00
|
|
|
}
|
2015-05-12 07:58:28 +08:00
|
|
|
} else {
|
|
|
|
// Otherwise, we just use the checked-in generated code.
|
|
|
|
project.sourceSets {
|
|
|
|
main {
|
|
|
|
java {
|
2015-06-23 07:29:30 +08:00
|
|
|
srcDir "${generatedSourcePath}/main/java"
|
2015-10-28 10:53:18 +08:00
|
|
|
srcDir "${generatedSourcePath}/main/javanano"
|
2015-06-23 07:29:30 +08:00
|
|
|
srcDir "${generatedSourcePath}/main/grpc"
|
2015-05-12 07:58:28 +08:00
|
|
|
}
|
|
|
|
}
|
2015-10-28 10:53:18 +08:00
|
|
|
test {
|
|
|
|
java {
|
|
|
|
srcDir "${generatedSourcePath}/test/java"
|
|
|
|
srcDir "${generatedSourcePath}/test/javanano"
|
|
|
|
srcDir "${generatedSourcePath}/test/grpc"
|
|
|
|
}
|
|
|
|
}
|
2015-05-12 07:58:28 +08:00
|
|
|
}
|
2015-05-06 07:11:27 +08:00
|
|
|
}
|
2016-05-24 03:05:41 +08:00
|
|
|
|
2017-08-27 08:10:18 +08:00
|
|
|
[compileJava, compileTestJava, compileJmhJava].each() {
|
2016-05-24 03:05:41 +08:00
|
|
|
// Protobuf-generated code produces some warnings.
|
2017-02-25 06:53:23 +08:00
|
|
|
// https://github.com/google/protobuf/issues/2718
|
2018-03-09 08:55:16 +08:00
|
|
|
it.options.compilerArgs += [
|
|
|
|
"-Xlint:-cast",
|
|
|
|
"-XepExcludedPaths:.*/src/generated/[^/]+/java/.*",
|
|
|
|
]
|
2016-05-24 03:05:41 +08:00
|
|
|
}
|
2015-05-06 07:11:27 +08:00
|
|
|
}
|
|
|
|
|
2015-05-22 02:54:04 +08:00
|
|
|
def epoll_suffix = "";
|
|
|
|
if (osdetector.classifier in ["linux-x86_64"]) {
|
|
|
|
// The native code is only pre-compiled on certain platforms.
|
|
|
|
epoll_suffix = ":" + osdetector.classifier
|
|
|
|
}
|
2015-02-14 08:21:53 +08:00
|
|
|
libraries = [
|
2017-12-09 03:30:52 +08:00
|
|
|
errorprone: "com.google.errorprone:error_prone_annotations:2.1.2",
|
2017-12-20 04:33:27 +08:00
|
|
|
gson: "com.google.code.gson:gson:2.7",
|
2016-05-17 01:23:53 +08:00
|
|
|
guava: "com.google.guava:guava:${guavaVersion}",
|
2015-02-26 02:17:23 +08:00
|
|
|
hpack: 'com.twitter:hpack:0.10.1',
|
2018-03-29 08:13:39 +08:00
|
|
|
javax_annotation: 'javax.annotation:javax.annotation-api:1.2',
|
2015-02-14 08:21:53 +08:00
|
|
|
jsr305: 'com.google.code.findbugs:jsr305:3.0.0',
|
2017-11-18 03:33:15 +08:00
|
|
|
oauth_client: 'com.google.auth:google-auth-library-oauth2-http:0.9.0',
|
2017-11-18 05:15:31 +08:00
|
|
|
google_api_protos: 'com.google.api.grpc:proto-google-common-protos:1.0.0',
|
2017-11-18 03:33:15 +08:00
|
|
|
google_auth_credentials: 'com.google.auth:google-auth-library-credentials:0.9.0',
|
2015-09-22 01:39:00 +08:00
|
|
|
okhttp: 'com.squareup.okhttp:okhttp:2.5.0',
|
2017-11-29 07:05:10 +08:00
|
|
|
okio: 'com.squareup.okio:okio:1.13.0',
|
2018-01-24 01:12:33 +08:00
|
|
|
opencensus_api: "io.opencensus:opencensus-api:${opencensusVersion}",
|
|
|
|
opencensus_contrib_grpc_metrics: "io.opencensus:opencensus-contrib-grpc-metrics:${opencensusVersion}",
|
|
|
|
opencensus_impl: "io.opencensus:opencensus-impl:${opencensusVersion}",
|
|
|
|
opencensus_impl_lite: "io.opencensus:opencensus-impl-lite:${opencensusVersion}",
|
2017-06-07 09:16:55 +08:00
|
|
|
instrumentation_api: 'com.google.instrumentation:instrumentation-api:0.4.3',
|
2015-05-07 07:44:55 +08:00
|
|
|
protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}",
|
2016-07-30 02:57:41 +08:00
|
|
|
protobuf_lite: "com.google.protobuf:protobuf-lite:3.0.1",
|
2016-09-28 08:15:12 +08:00
|
|
|
protoc_lite: "com.google.protobuf:protoc-gen-javalite:3.0.0",
|
2015-08-29 09:47:06 +08:00
|
|
|
protobuf_nano: "com.google.protobuf.nano:protobuf-javanano:${protobufNanoVersion}",
|
2018-03-27 08:29:55 +08:00
|
|
|
protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.8.5',
|
2016-03-03 01:30:35 +08:00
|
|
|
protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}",
|
2018-02-16 01:28:00 +08:00
|
|
|
lang: "org.apache.commons:commons-lang3:3.5",
|
2015-02-14 08:21:53 +08:00
|
|
|
|
2017-05-16 01:57:43 +08:00
|
|
|
netty: "io.netty:netty-codec-http2:[${nettyVersion}]",
|
|
|
|
netty_epoll: "io.netty:netty-transport-native-epoll:${nettyVersion}" + epoll_suffix,
|
|
|
|
netty_proxy_handler: "io.netty:netty-handler-proxy:${nettyVersion}",
|
2018-05-01 07:55:52 +08:00
|
|
|
netty_tcnative: 'io.netty:netty-tcnative-boringssl-static:2.0.8.Final',
|
2015-02-14 08:21:53 +08:00
|
|
|
|
2018-02-16 09:14:10 +08:00
|
|
|
conscrypt: 'org.conscrypt:conscrypt-openjdk-uber:1.0.1',
|
2018-05-31 03:26:02 +08:00
|
|
|
re2j: 'com.google.re2j:re2j:1.2',
|
2018-02-16 09:14:10 +08:00
|
|
|
|
2015-02-14 08:21:53 +08:00
|
|
|
// Test dependencies.
|
2017-10-06 02:24:15 +08:00
|
|
|
junit: 'junit:junit:4.12',
|
2016-04-02 06:18:23 +08:00
|
|
|
mockito: 'org.mockito:mockito-core:1.9.5',
|
2017-10-31 01:58:37 +08:00
|
|
|
truth: 'com.google.truth:truth:0.36',
|
2018-03-24 06:45:05 +08:00
|
|
|
guava_testlib: 'com.google.guava:guava-testlib:20.0',
|
2016-03-24 04:18:04 +08:00
|
|
|
|
|
|
|
// Benchmark dependencies
|
2017-10-18 08:03:12 +08:00
|
|
|
hdrhistogram: 'org.hdrhistogram:HdrHistogram:2.1.10',
|
2016-03-24 04:18:04 +08:00
|
|
|
math: 'org.apache.commons:commons-math3:3.6',
|
2015-02-14 08:21:53 +08:00
|
|
|
|
2016-05-03 05:01:36 +08:00
|
|
|
// Jetty ALPN dependencies
|
2018-02-23 05:32:05 +08:00
|
|
|
jetty_alpn_agent: 'org.mortbay.jetty.alpn:jetty-alpn-agent:2.0.7'
|
2016-05-03 05:01:36 +08:00
|
|
|
]
|
2015-02-14 08:21:53 +08:00
|
|
|
}
|
2014-12-16 01:58:05 +08:00
|
|
|
|
2016-05-03 05:01:36 +08:00
|
|
|
// Define a separate configuration for managing the dependency on Jetty ALPN agent.
|
2015-05-23 03:25:10 +08:00
|
|
|
configurations {
|
2016-05-03 05:01:36 +08:00
|
|
|
alpnagent
|
2017-09-19 07:20:18 +08:00
|
|
|
|
|
|
|
compile {
|
|
|
|
// Detect Maven Enforcer's dependencyConvergence failures. We only
|
|
|
|
// care for artifacts used as libraries by others.
|
|
|
|
if (!(project.name in ['grpc-benchmarks', 'grpc-interop-testing'])) {
|
|
|
|
resolutionStrategy.failOnVersionConflict()
|
|
|
|
}
|
|
|
|
}
|
2015-05-23 03:25:10 +08:00
|
|
|
}
|
|
|
|
|
2014-12-16 01:58:05 +08:00
|
|
|
dependencies {
|
|
|
|
testCompile libraries.junit,
|
2017-09-19 07:20:18 +08:00
|
|
|
libraries.mockito,
|
|
|
|
libraries.truth
|
2015-05-23 03:25:10 +08:00
|
|
|
|
2016-05-03 05:01:36 +08:00
|
|
|
// Configuration for modules that use Jetty ALPN agent
|
|
|
|
alpnagent libraries.jetty_alpn_agent
|
2017-08-27 08:10:18 +08:00
|
|
|
|
|
|
|
jmh 'org.openjdk.jmh:jmh-core:1.19',
|
|
|
|
'org.openjdk.jmh:jmh-generator-bytecode:1.19'
|
2014-12-16 01:58:05 +08:00
|
|
|
}
|
2015-03-03 05:31:14 +08:00
|
|
|
|
|
|
|
signing {
|
|
|
|
required false
|
|
|
|
sign configurations.archives
|
|
|
|
}
|
|
|
|
|
2015-03-03 23:59:13 +08:00
|
|
|
// Disable JavaDoc doclint on Java 8. It's annoying.
|
|
|
|
if (JavaVersion.current().isJava8Compatible()) {
|
|
|
|
allprojects {
|
|
|
|
tasks.withType(Javadoc) {
|
|
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-31 06:58:07 +08:00
|
|
|
checkstyle {
|
2017-07-08 01:57:03 +08:00
|
|
|
configFile = file("$rootDir/buildscripts/checkstyle.xml")
|
2016-04-19 00:15:25 +08:00
|
|
|
toolVersion = "6.17"
|
2015-05-05 23:54:51 +08:00
|
|
|
ignoreFailures = false
|
2015-03-22 01:59:17 +08:00
|
|
|
if (rootProject.hasProperty("checkstyle.ignoreFailures")) {
|
|
|
|
ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean()
|
|
|
|
}
|
2015-09-16 01:34:14 +08:00
|
|
|
configProperties["rootDir"] = rootDir
|
2015-01-31 06:58:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
checkstyleMain {
|
2015-05-07 02:35:08 +08:00
|
|
|
source = fileTree(dir: "src/main", include: "**/*.java")
|
2015-01-31 06:58:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
checkstyleTest {
|
2015-05-07 02:35:08 +08:00
|
|
|
source = fileTree(dir: "src/test", include: "**/*.java")
|
2015-01-31 06:58:07 +08:00
|
|
|
}
|
|
|
|
|
2018-03-14 08:46:03 +08:00
|
|
|
// invoke jmh on a single benchmark class like so:
|
|
|
|
// ./gradlew -PjmhIncludeSingleClass=StatsTraceContextBenchmark clean :grpc-core:jmh
|
2017-08-27 08:10:18 +08:00
|
|
|
jmh {
|
|
|
|
warmupIterations = 10
|
|
|
|
iterations = 10
|
|
|
|
fork = 1
|
|
|
|
// None of our benchmarks need the tests, and we have pseudo-circular
|
|
|
|
// dependencies that break when including them. (context's testCompile
|
|
|
|
// depends on core; core's testCompile depends on testing)
|
|
|
|
includeTests = false
|
2018-03-14 08:46:03 +08:00
|
|
|
if (project.hasProperty('jmhIncludeSingleClass')) {
|
|
|
|
include = [project.property('jmhIncludeSingleClass')]
|
|
|
|
}
|
2017-08-27 08:10:18 +08:00
|
|
|
}
|
|
|
|
|
2015-03-03 05:31:14 +08:00
|
|
|
task javadocJar(type: Jar) {
|
|
|
|
classifier = 'javadoc'
|
|
|
|
from javadoc
|
|
|
|
}
|
|
|
|
|
|
|
|
task sourcesJar(type: Jar) {
|
|
|
|
classifier = 'sources'
|
|
|
|
from sourceSets.main.allSource
|
|
|
|
}
|
|
|
|
|
|
|
|
artifacts {
|
|
|
|
archives javadocJar, sourcesJar
|
|
|
|
}
|
|
|
|
|
|
|
|
uploadArchives.repositories.mavenDeployer {
|
|
|
|
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
2017-12-15 08:51:14 +08:00
|
|
|
if (rootProject.hasProperty('repositoryDir')) {
|
|
|
|
repository(url: new File(rootProject.repositoryDir).toURI())
|
|
|
|
} else {
|
2018-02-14 03:17:53 +08:00
|
|
|
String stagingUrl
|
|
|
|
if (rootProject.hasProperty('repositoryId')) {
|
|
|
|
stagingUrl = 'https://oss.sonatype.org/service/local/staging/deployByRepositoryId/' +
|
|
|
|
rootProject.repositoryId
|
|
|
|
} else {
|
|
|
|
stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
|
|
|
|
}
|
|
|
|
def configureAuth = {
|
|
|
|
if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) {
|
|
|
|
authentication(userName: rootProject.ossrhUsername, password: rootProject.ossrhPassword)
|
|
|
|
}
|
|
|
|
}
|
2017-12-15 08:51:14 +08:00
|
|
|
repository(url: stagingUrl, configureAuth)
|
|
|
|
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/', configureAuth)
|
|
|
|
}
|
2015-03-03 05:31:14 +08:00
|
|
|
}
|
2017-10-07 01:44:58 +08:00
|
|
|
uploadArchives.onlyIf { !name.contains("grpc-gae-interop-testing") }
|
2015-03-03 05:31:14 +08:00
|
|
|
|
|
|
|
[
|
|
|
|
install.repositories.mavenInstaller,
|
|
|
|
uploadArchives.repositories.mavenDeployer,
|
|
|
|
]*.pom*.whenConfigured { pom ->
|
|
|
|
pom.project {
|
2015-03-13 08:03:01 +08:00
|
|
|
name "$project.group:$project.name"
|
2015-03-03 05:31:14 +08:00
|
|
|
description project.description
|
|
|
|
url 'https://github.com/grpc/grpc-java'
|
|
|
|
|
|
|
|
scm {
|
2016-04-08 23:37:07 +08:00
|
|
|
connection 'scm:git:https://github.com/grpc/grpc-java.git'
|
|
|
|
developerConnection 'scm:git:git@github.com:grpc/grpc-java.git'
|
2015-03-03 05:31:14 +08:00
|
|
|
url 'https://github.com/grpc/grpc-java'
|
|
|
|
}
|
|
|
|
|
|
|
|
licenses {
|
|
|
|
license {
|
2017-06-01 05:37:42 +08:00
|
|
|
name 'Apache 2.0'
|
|
|
|
url 'https://opensource.org/licenses/Apache-2.0'
|
2015-03-03 05:31:14 +08:00
|
|
|
}
|
|
|
|
}
|
2015-03-13 08:03:01 +08:00
|
|
|
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id "grpc.io"
|
|
|
|
name "gRPC Contributors"
|
|
|
|
email "grpc-io@googlegroups.com"
|
2017-07-11 06:48:17 +08:00
|
|
|
url "https://grpc.io/"
|
2015-03-13 08:03:01 +08:00
|
|
|
// https://issues.gradle.org/browse/GRADLE-2719
|
2017-06-01 04:29:01 +08:00
|
|
|
organization = "gRPC Authors"
|
2015-03-13 08:03:01 +08:00
|
|
|
organizationUrl "https://www.google.com"
|
|
|
|
}
|
|
|
|
}
|
2015-03-03 05:31:14 +08:00
|
|
|
}
|
2016-04-09 04:47:30 +08:00
|
|
|
if (!(project.name in
|
2017-09-29 00:31:32 +08:00
|
|
|
["grpc-stub", "grpc-protobuf", "grpc-protobuf-lite", "grpc-protobuf-nano"])) {
|
2016-04-09 04:47:30 +08:00
|
|
|
def core = pom.dependencies.find {dep -> dep.artifactId == 'grpc-core'}
|
|
|
|
if (core != null) {
|
|
|
|
// Depend on specific version of grpc-core because internal package is unstable
|
|
|
|
core.version = "[" + core.version + "]"
|
|
|
|
}
|
|
|
|
}
|
2015-03-03 05:31:14 +08:00
|
|
|
}
|
2015-04-23 01:02:19 +08:00
|
|
|
// 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'
|
2015-06-02 07:20:08 +08:00
|
|
|
showExceptions true
|
|
|
|
showCauses true
|
|
|
|
showStackTraces true
|
2015-04-23 01:02:19 +08:00
|
|
|
}
|
2016-02-13 00:48:41 +08:00
|
|
|
maxHeapSize = '1500m'
|
2015-04-23 01:02:19 +08:00
|
|
|
}
|
2014-12-16 01:58:05 +08:00
|
|
|
}
|
2017-09-27 23:31:43 +08:00
|
|
|
|
|
|
|
// Run with: ./gradlew japicmp --continue
|
|
|
|
def baselineGrpcVersion = '1.6.1'
|
|
|
|
def publicApiSubprojects = [
|
2018-02-16 01:28:00 +08:00
|
|
|
// TODO: uncomment after grpc-alts artifact is published.
|
|
|
|
// ':grpc-alts',
|
2017-09-27 23:31:43 +08:00
|
|
|
':grpc-auth',
|
|
|
|
':grpc-context',
|
|
|
|
':grpc-core',
|
|
|
|
':grpc-grpclb',
|
|
|
|
':grpc-netty',
|
|
|
|
':grpc-okhttp',
|
|
|
|
':grpc-protobuf',
|
|
|
|
':grpc-protobuf-lite',
|
|
|
|
':grpc-protobuf-nano',
|
|
|
|
':grpc-stub',
|
|
|
|
':grpc-testing',
|
|
|
|
]
|
|
|
|
|
|
|
|
publicApiSubprojects.each { name ->
|
|
|
|
project(":$name") {
|
|
|
|
apply plugin: 'me.champeau.gradle.japicmp'
|
|
|
|
|
|
|
|
// Get the baseline version's jar for this subproject
|
|
|
|
File baselineArtifact = null
|
|
|
|
// Use a detached configuration, otherwise the current version's jar will take precedence
|
|
|
|
// over the baseline jar.
|
|
|
|
// A necessary hack, the intuitive thing does NOT work:
|
|
|
|
// https://discuss.gradle.org/t/is-the-default-configuration-leaking-into-independent-configurations/2088/6
|
|
|
|
def oldGroup = project.group
|
|
|
|
try {
|
|
|
|
project.group = 'virtual_group_for_japicmp'
|
|
|
|
String depModule = "io.grpc:${project.name}:${baselineGrpcVersion}@jar"
|
|
|
|
String depJar = "${project.name}-${baselineGrpcVersion}.jar"
|
|
|
|
Configuration configuration = configurations.detachedConfiguration(
|
|
|
|
dependencies.create(depModule)
|
|
|
|
)
|
|
|
|
baselineArtifact = files(configuration.files).filter {
|
|
|
|
it.name.equals(depJar)
|
|
|
|
}.singleFile
|
|
|
|
} finally {
|
|
|
|
project.group = oldGroup
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add a japicmp task that compares the current .jar with baseline .jar
|
|
|
|
task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: jar) {
|
|
|
|
oldClasspath = files(baselineArtifact)
|
|
|
|
newClasspath = files(jar.archivePath)
|
|
|
|
onlyBinaryIncompatibleModified = false
|
|
|
|
// Be quiet about things that did not change
|
|
|
|
onlyModified = true
|
|
|
|
// This task should fail if there are incompatible changes
|
|
|
|
failOnModification = true
|
|
|
|
ignoreMissingClasses = true
|
|
|
|
htmlOutputFile = file("$buildDir/reports/japi.html")
|
|
|
|
|
|
|
|
packageExcludes = ['io.grpc.internal']
|
|
|
|
|
|
|
|
// Also break on source incompatible changes, not just binary.
|
|
|
|
// Eg adding abstract method to public class.
|
|
|
|
// TODO(zpencer): enable after japicmp-gradle-plugin/pull/14
|
|
|
|
// breakOnSourceIncompatibility = true
|
|
|
|
|
|
|
|
// Ignore any classes or methods marked @ExperimentalApi
|
|
|
|
// TODO(zpencer): enable after japicmp-gradle-plugin/pull/15
|
|
|
|
// annotationExcludes = ['@io.grpc.ExperimentalApi']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|