2015-04-18 01:49:11 +08:00
|
|
|
buildscript {
|
2018-06-12 09:35:18 +08:00
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
maven { url "https://plugins.gradle.org/m2/" }
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.13.0"
|
|
|
|
classpath 'com.google.gradle:osdetector-gradle-plugin:1.4.0'
|
2018-07-27 01:35:20 +08:00
|
|
|
classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.4.5'
|
2018-06-12 09:35:18 +08:00
|
|
|
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.13'
|
|
|
|
classpath 'net.ltgt.gradle:gradle-apt-plugin:0.13'
|
|
|
|
classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.5"
|
|
|
|
classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.2.5'
|
2017-02-25 06:53:23 +08:00
|
|
|
}
|
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"
|
2018-07-20 04:35:27 +08:00
|
|
|
// jdk10 not supported by errorprone: https://github.com/google/error-prone/issues/860
|
|
|
|
if (!JavaVersion.current().isJava10Compatible() &&
|
|
|
|
rootProject.properties.get('errorProne', true)) {
|
2018-06-12 09:35:18 +08:00
|
|
|
apply plugin: "net.ltgt.errorprone"
|
|
|
|
apply plugin: "net.ltgt.apt"
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
// 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:2.2.0'
|
|
|
|
apt 'com.google.guava:guava-beta-checker:1.0'
|
|
|
|
}
|
2017-04-27 04:33:27 +08:00
|
|
|
} else {
|
2018-06-12 09:35:18 +08:00
|
|
|
// Remove per-project error-prone checker config
|
|
|
|
allprojects {
|
|
|
|
afterEvaluate { project ->
|
|
|
|
project.tasks.withType(JavaCompile) {
|
|
|
|
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-07-19 01:48:04 +08:00
|
|
|
version = "1.15.0-SNAPSHOT" // CURRENT_GRPC_VERSION
|
2014-12-16 01:58:05 +08:00
|
|
|
|
|
|
|
sourceCompatibility = 1.6
|
|
|
|
targetCompatibility = 1.6
|
|
|
|
|
|
|
|
repositories {
|
2018-06-12 09:35:18 +08:00
|
|
|
maven { // The google mirror is less flaky than mavenCentral()
|
|
|
|
url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
|
2018-03-02 11:11:24 +08:00
|
|
|
mavenLocal()
|
2014-12-16 01:58:05 +08:00
|
|
|
}
|
|
|
|
|
2018-06-12 09:35:18 +08:00
|
|
|
[
|
|
|
|
compileJava,
|
|
|
|
compileTestJava,
|
|
|
|
compileJmhJava
|
|
|
|
].each() {
|
|
|
|
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 {
|
2018-06-12 09:35:18 +08:00
|
|
|
// serialVersionUID is basically guaranteed to be useless in our tests
|
|
|
|
// 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,
|
2018-06-12 09:35:18 +08:00
|
|
|
'Implementation-Version': version,
|
|
|
|
'Built-By': System.getProperty('user.name'),
|
|
|
|
'Built-JDK': System.getProperty('java.version'),
|
|
|
|
'Source-Compatibility': sourceCompatibility,
|
|
|
|
'Target-Compatibility': targetCompatibility)
|
2015-06-01 23:31:00 +08:00
|
|
|
}
|
|
|
|
|
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-07-21 07:36:00 +08:00
|
|
|
nettyVersion = '4.1.27.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 = {
|
2018-06-12 09:35:18 +08:00
|
|
|
String generatedSourcePath = "${projectDir}/src/generated"
|
|
|
|
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'
|
|
|
|
project.protobuf {
|
|
|
|
protoc {
|
|
|
|
if (project.hasProperty('protoc')) {
|
|
|
|
path = project.protoc
|
|
|
|
} else {
|
|
|
|
artifact = "com.google.protobuf:protoc:${protocVersion}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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.
|
|
|
|
task.dependsOn 'deleteGeneratedSource' + task.sourceSet.name
|
|
|
|
// 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 { grpc { option 'noversion' } }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
generatedFilesBaseDir = generatedSourcePath
|
2015-06-23 07:29:30 +08:00
|
|
|
}
|
2018-06-12 09:35:18 +08:00
|
|
|
|
|
|
|
sourceSets.each { sourceSet ->
|
|
|
|
task "deleteGeneratedSource${sourceSet.name}" {
|
|
|
|
doLast {
|
|
|
|
project.delete project.fileTree(dir: generatedSourcePath + '/' + sourceSet.name)
|
|
|
|
}
|
|
|
|
}
|
2015-06-23 07:29:30 +08:00
|
|
|
}
|
2018-06-12 09:35:18 +08:00
|
|
|
} else {
|
|
|
|
// Otherwise, we just use the checked-in generated code.
|
|
|
|
project.sourceSets {
|
|
|
|
main {
|
|
|
|
java {
|
|
|
|
srcDir "${generatedSourcePath}/main/java"
|
|
|
|
srcDir "${generatedSourcePath}/main/javanano"
|
|
|
|
srcDir "${generatedSourcePath}/main/grpc"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
test {
|
|
|
|
java {
|
|
|
|
srcDir "${generatedSourcePath}/test/java"
|
|
|
|
srcDir "${generatedSourcePath}/test/javanano"
|
|
|
|
srcDir "${generatedSourcePath}/test/grpc"
|
|
|
|
}
|
2016-07-22 07:35:18 +08:00
|
|
|
}
|
2015-05-08 08:32:31 +08:00
|
|
|
}
|
2015-06-23 07:29:30 +08:00
|
|
|
}
|
|
|
|
|
2018-06-12 09:35:18 +08:00
|
|
|
[
|
|
|
|
compileJava,
|
|
|
|
compileTestJava,
|
|
|
|
compileJmhJava
|
|
|
|
].each() {
|
|
|
|
// Protobuf-generated code produces some warnings.
|
|
|
|
// https://github.com/google/protobuf/issues/2718
|
|
|
|
it.options.compilerArgs += [
|
|
|
|
"-Xlint:-cast",
|
|
|
|
"-XepExcludedPaths:.*/src/generated/[^/]+/java/.*",
|
|
|
|
]
|
2015-05-12 07:58:28 +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 = [
|
2018-08-10 00:09:21 +08:00
|
|
|
animalsniffer_annotations: "org.codehaus.mojo:animal-sniffer-annotations:1.17",
|
2018-07-20 04:40:41 +08:00
|
|
|
errorprone: "com.google.errorprone:error_prone_annotations:2.2.0",
|
2018-06-12 09:35:18 +08:00
|
|
|
gson: "com.google.code.gson:gson:2.7",
|
|
|
|
guava: "com.google.guava:guava:${guavaVersion}",
|
|
|
|
hpack: 'com.twitter:hpack:0.10.1',
|
|
|
|
javax_annotation: 'javax.annotation:javax.annotation-api:1.2',
|
|
|
|
jsr305: 'com.google.code.findbugs:jsr305:3.0.0',
|
|
|
|
oauth_client: 'com.google.auth:google-auth-library-oauth2-http:0.9.0',
|
|
|
|
google_api_protos: 'com.google.api.grpc:proto-google-common-protos:1.0.0',
|
|
|
|
google_auth_credentials: 'com.google.auth:google-auth-library-credentials:0.9.0',
|
|
|
|
okhttp: 'com.squareup.okhttp:okhttp:2.5.0',
|
|
|
|
okio: 'com.squareup.okio:okio:1.13.0',
|
|
|
|
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}",
|
|
|
|
instrumentation_api: 'com.google.instrumentation:instrumentation-api:0.4.3',
|
|
|
|
protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}",
|
|
|
|
protobuf_lite: "com.google.protobuf:protobuf-lite:3.0.1",
|
|
|
|
protoc_lite: "com.google.protobuf:protoc-gen-javalite:3.0.0",
|
|
|
|
protobuf_nano: "com.google.protobuf.nano:protobuf-javanano:${protobufNanoVersion}",
|
|
|
|
protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.8.5',
|
|
|
|
protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}",
|
|
|
|
lang: "org.apache.commons:commons-lang3:3.5",
|
|
|
|
|
|
|
|
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-07-21 07:36:00 +08:00
|
|
|
netty_tcnative: 'io.netty:netty-tcnative-boringssl-static:2.0.12.Final',
|
2018-06-12 09:35:18 +08:00
|
|
|
|
|
|
|
conscrypt: 'org.conscrypt:conscrypt-openjdk-uber:1.0.1',
|
|
|
|
re2j: 'com.google.re2j:re2j:1.2',
|
|
|
|
|
|
|
|
// Test dependencies.
|
|
|
|
junit: 'junit:junit:4.12',
|
|
|
|
mockito: 'org.mockito:mockito-core:1.9.5',
|
2018-07-24 05:42:39 +08:00
|
|
|
truth: 'com.google.truth:truth:0.42',
|
2018-06-12 09:35:18 +08:00
|
|
|
guava_testlib: 'com.google.guava:guava-testlib:20.0',
|
|
|
|
|
|
|
|
// Benchmark dependencies
|
|
|
|
hdrhistogram: 'org.hdrhistogram:HdrHistogram:2.1.10',
|
|
|
|
math: 'org.apache.commons:commons-math3:3.6',
|
|
|
|
|
|
|
|
// Jetty ALPN dependencies
|
|
|
|
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.
|
2018-06-12 09:35:18 +08:00
|
|
|
if (!(project.name in [
|
|
|
|
'grpc-benchmarks',
|
2018-07-21 08:59:19 +08:00
|
|
|
'grpc-interop-testing',
|
|
|
|
'grpc-gae-interop-testing-jdk7',
|
|
|
|
'grpc-gae-interop-testing-jdk8',
|
2018-06-12 09:35:18 +08:00
|
|
|
])) {
|
2017-09-19 07:20:18 +08:00
|
|
|
resolutionStrategy.failOnVersionConflict()
|
|
|
|
}
|
|
|
|
}
|
2015-05-23 03:25:10 +08:00
|
|
|
}
|
|
|
|
|
2014-12-16 01:58:05 +08:00
|
|
|
dependencies {
|
|
|
|
testCompile libraries.junit,
|
2018-06-12 09:35: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',
|
2018-06-12 09:35:18 +08:00
|
|
|
'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()) {
|
2018-06-12 09:35:18 +08:00
|
|
|
allprojects {
|
|
|
|
tasks.withType(Javadoc) {
|
|
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
|
|
}
|
2015-03-03 23:59:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-20 04:35:27 +08:00
|
|
|
// For jdk10 we must explicitly choose between html4 and html5, otherwise we get a warning
|
|
|
|
if (JavaVersion.current().isJava10Compatible()) {
|
|
|
|
allprojects {
|
|
|
|
tasks.withType(Javadoc) {
|
|
|
|
options.addBooleanOption('html4', true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-31 06:58:07 +08:00
|
|
|
checkstyle {
|
2017-07-13 01:53:50 +08:00
|
|
|
configDir = file("$rootDir/buildscripts")
|
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-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')) {
|
2018-06-12 09:35:18 +08:00
|
|
|
include = [
|
|
|
|
project.property('jmhIncludeSingleClass')
|
|
|
|
]
|
2018-03-14 08:46:03 +08:00
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
2018-06-12 09:35:18 +08:00
|
|
|
artifacts { archives javadocJar, sourcesJar }
|
2015-03-03 05:31:14 +08:00
|
|
|
|
|
|
|
uploadArchives.repositories.mavenDeployer {
|
|
|
|
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
2017-12-15 08:51:14 +08:00
|
|
|
if (rootProject.hasProperty('repositoryDir')) {
|
2018-06-12 09:35:18 +08:00
|
|
|
repository(url: new File(rootProject.repositoryDir).toURI())
|
2017-12-15 08:51:14 +08:00
|
|
|
} else {
|
2018-06-12 09:35:18 +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)
|
|
|
|
}
|
2018-02-14 03:17:53 +08:00
|
|
|
}
|
2018-06-12 09:35:18 +08:00
|
|
|
repository(url: stagingUrl, configureAuth)
|
|
|
|
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/', configureAuth)
|
2017-12-15 08:51:14 +08:00
|
|
|
}
|
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
|
|
|
|
|
|
|
[
|
2018-06-12 09:35:18 +08:00
|
|
|
install.repositories.mavenInstaller,
|
|
|
|
uploadArchives.repositories.mavenDeployer,
|
2015-03-03 05:31:14 +08:00
|
|
|
]*.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
|
2018-06-12 09:35:18 +08:00
|
|
|
[
|
|
|
|
"grpc-stub",
|
|
|
|
"grpc-protobuf",
|
|
|
|
"grpc-protobuf-lite",
|
|
|
|
"grpc-protobuf-nano"
|
|
|
|
])) {
|
|
|
|
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 + "]"
|
|
|
|
}
|
2016-04-09 04:47:30 +08:00
|
|
|
}
|
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-06-12 09:35:18 +08:00
|
|
|
// TODO: uncomment after grpc-alts artifact is published.
|
|
|
|
// ':grpc-alts',
|
|
|
|
':grpc-auth',
|
|
|
|
':grpc-context',
|
|
|
|
':grpc-core',
|
|
|
|
':grpc-grpclb',
|
|
|
|
':grpc-netty',
|
|
|
|
':grpc-okhttp',
|
|
|
|
':grpc-protobuf',
|
|
|
|
':grpc-protobuf-lite',
|
|
|
|
':grpc-protobuf-nano',
|
|
|
|
':grpc-stub',
|
|
|
|
':grpc-testing',
|
2017-09-27 23:31:43 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
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)
|
2018-06-12 09:35:18 +08:00
|
|
|
)
|
2017-09-27 23:31:43 +08:00
|
|
|
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']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-12 09:35:18 +08:00
|
|
|
|
|
|
|
// format checkers
|
|
|
|
apply plugin: "com.diffplug.gradle.spotless"
|
|
|
|
apply plugin: 'groovy'
|
|
|
|
spotless {
|
|
|
|
groovyGradle {
|
|
|
|
target '**/*.gradle'
|
|
|
|
greclipse()
|
|
|
|
indentWithSpaces()
|
|
|
|
paddedCell()
|
|
|
|
}
|
|
|
|
}
|