all: add gradle format checker

This PR adds an automatic gradle format checker and reformats all the *.gradle files. After this, new changes to *.gradle files will fail to build if not in good format, just like checkStyle failure.
This commit is contained in:
ZHANG Dapeng 2018-06-11 18:35:18 -07:00 committed by GitHub
parent 9d26c5c405
commit 5ce10f0146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 930 additions and 1051 deletions

View File

@ -4,14 +4,10 @@ description = "gRPC: All"
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
}
dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
} }
dependencies { classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1' }
} }
def subprojects = [ def subprojects = [
@ -72,7 +68,9 @@ jacocoTestReport {
classDirectories = files(subprojects.sourceSets.main.output) classDirectories = files(subprojects.sourceSets.main.output)
classDirectories = files(classDirectories.files.collect { classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, fileTree(dir: it,
exclude: ['**/io/grpc/okhttp/internal/**']) exclude: [
'**/io/grpc/okhttp/internal/**'
])
}) })
} }
@ -80,6 +78,4 @@ coveralls {
sourceDirs = subprojects.sourceSets.main.allSource.srcDirs.flatten() sourceDirs = subprojects.sourceSets.main.allSource.srcDirs.flatten()
} }
tasks.coveralls { tasks.coveralls { dependsOn(jacocoTestReport) }
dependsOn(jacocoTestReport)
}

View File

@ -5,14 +5,10 @@ targetCompatibility = 1.7
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
}
dependencies {
classpath libraries.protobuf_plugin
} }
dependencies { classpath libraries.protobuf_plugin }
} }
dependencies { dependencies {
@ -36,9 +32,10 @@ configureProtoCompilation()
[compileJava, compileTestJava].each() { [compileJava, compileTestJava].each() {
// ALTS retuns a lot of futures that we mostly don't care about. // ALTS retuns a lot of futures that we mostly don't care about.
// protobuf calls valueof. Will be fixed in next release (google/protobuf#4046) // protobuf calls valueof. Will be fixed in next release (google/protobuf#4046)
it.options.compilerArgs += ["-Xlint:-deprecation", "-Xep:FutureReturnValueIgnored:OFF"] it.options.compilerArgs += [
"-Xlint:-deprecation",
"-Xep:FutureReturnValueIgnored:OFF"
]
} }
javadoc { javadoc { exclude 'io/grpc/alts/internal/**' }
exclude 'io/grpc/alts/internal/**'
}

View File

@ -14,26 +14,19 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
debug { debug { minifyEnabled false }
minifyEnabled false
}
release { release {
minifyEnabled true minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
lintOptions { lintOptions { disable 'InvalidPackage', 'HardcodedText' }
disable 'InvalidPackage', 'HardcodedText'
}
} }
protobuf { protobuf {
protoc { protoc { artifact = 'com.google.protobuf:protoc:3.5.1-1' }
artifact = 'com.google.protobuf:protoc:3.5.1-1'
}
plugins { plugins {
grpc { grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
} }
} }
generateProtoTasks { generateProtoTasks {
@ -47,10 +40,8 @@ protobuf {
} }
task.plugins { task.plugins {
grpc { grpc { // Options added to --grpc_out
// Options added to --grpc_out option 'nano' }
option 'nano'
}
} }
} }
} }
@ -73,7 +64,5 @@ dependencies {
} }
gradle.projectsEvaluated { gradle.projectsEvaluated {
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:deprecation" }
options.compilerArgs << "-Xlint:deprecation"
}
} }

View File

@ -9,9 +9,7 @@ buildscript {
google() google()
jcenter() jcenter()
mavenCentral() mavenCentral()
maven { maven { url "https://plugins.gradle.org/m2/" }
url "https://plugins.gradle.org/m2/"
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.android.tools.build:gradle:3.0.1'
@ -33,9 +31,7 @@ android {
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
lintOptions { lintOptions { abortOnError false }
abortOnError false
}
} }
repositories { repositories {

View File

@ -1,13 +1,9 @@
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
}
dependencies {
classpath libraries.protobuf_plugin
} }
dependencies { classpath libraries.protobuf_plugin }
} }
apply plugin: 'application' apply plugin: 'application'
@ -57,7 +53,9 @@ def vmArgs = [
task qps_client(type: CreateStartScripts) { task qps_client(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.qps.AsyncClient" mainClassName = "io.grpc.benchmarks.qps.AsyncClient"
applicationName = "qps_client" applicationName = "qps_client"
defaultJvmOpts = ["-javaagent:" + configurations.alpnagent.asPath] + vmArgs defaultJvmOpts = [
"-javaagent:" + configurations.alpnagent.asPath
].plus(vmArgs)
outputDir = new File(project.buildDir, 'tmp') outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime classpath = jar.outputs.files + project.configurations.runtime
} }
@ -65,7 +63,9 @@ task qps_client(type: CreateStartScripts) {
task openloop_client(type: CreateStartScripts) { task openloop_client(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.qps.OpenLoopClient" mainClassName = "io.grpc.benchmarks.qps.OpenLoopClient"
applicationName = "openloop_client" applicationName = "openloop_client"
defaultJvmOpts = ["-javaagent:" + configurations.alpnagent.asPath] + vmArgs defaultJvmOpts = [
"-javaagent:" + configurations.alpnagent.asPath
].plus(vmArgs)
outputDir = new File(project.buildDir, 'tmp') outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime classpath = jar.outputs.files + project.configurations.runtime
} }
@ -80,7 +80,9 @@ task qps_server(type: CreateStartScripts) {
task benchmark_worker(type: CreateStartScripts) { task benchmark_worker(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.driver.LoadWorker" mainClassName = "io.grpc.benchmarks.driver.LoadWorker"
applicationName = "benchmark_worker" applicationName = "benchmark_worker"
defaultJvmOpts = ["-javaagent:" + configurations.alpnagent.asPath] + vmArgs defaultJvmOpts = [
"-javaagent:" + configurations.alpnagent.asPath
].plus(vmArgs)
outputDir = new File(project.buildDir, 'tmp') outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime classpath = jar.outputs.files + project.configurations.runtime
} }

View File

@ -1,11 +1,10 @@
buildscript { buildscript {
repositories { repositories {
mavenLocal() mavenLocal()
maven { maven { url "https://plugins.gradle.org/m2/" }
url "https://plugins.gradle.org/m2/"
}
} }
dependencies { dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.13.0"
classpath 'com.google.gradle:osdetector-gradle-plugin:1.4.0' classpath 'com.google.gradle:osdetector-gradle-plugin:1.4.0'
classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.4.0' classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.4.0'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.13' classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.13'
@ -58,15 +57,21 @@ subprojects {
targetCompatibility = 1.6 targetCompatibility = 1.6
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
mavenLocal() mavenLocal()
} }
[compileJava, compileTestJava, compileJmhJava].each() { [
it.options.compilerArgs += ["-Xlint:all", "-Xlint:-options", "-Xlint:-path"] compileJava,
compileTestJava,
compileJmhJava
].each() {
it.options.compilerArgs += [
"-Xlint:all",
"-Xlint:-options",
"-Xlint:-path"
]
it.options.encoding = "UTF-8" it.options.encoding = "UTF-8"
if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) { if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
it.options.compilerArgs += ["-Werror"] it.options.compilerArgs += ["-Werror"]
@ -76,7 +81,10 @@ subprojects {
compileTestJava { compileTestJava {
// serialVersionUID is basically guaranteed to be useless in our tests // serialVersionUID is basically guaranteed to be useless in our tests
// LinkedList doesn't hurt much in tests and has lots of usages // LinkedList doesn't hurt much in tests and has lots of usages
options.compilerArgs += ["-Xlint:-serial", "-Xep:JdkObsolete:OFF"] options.compilerArgs += [
"-Xlint:-serial",
"-Xep:JdkObsolete:OFF"
]
} }
jar.manifest { jar.manifest {
@ -120,11 +128,7 @@ subprojects {
artifact = "com.google.protobuf:protoc:${protocVersion}" artifact = "com.google.protobuf:protoc:${protocVersion}"
} }
} }
plugins { plugins { grpc { path = javaPluginPath } }
grpc {
path = javaPluginPath
}
}
generateProtoTasks { generateProtoTasks {
all().each { task -> all().each { task ->
task.dependsOn ':grpc-compiler:java_pluginExecutable' task.dependsOn ':grpc-compiler:java_pluginExecutable'
@ -135,11 +139,7 @@ subprojects {
// Recompile protos when build.gradle has been changed, because // Recompile protos when build.gradle has been changed, because
// it's possible the version of protoc has been changed. // it's possible the version of protoc has been changed.
task.inputs.file "${rootProject.projectDir}/build.gradle" task.inputs.file "${rootProject.projectDir}/build.gradle"
task.plugins { task.plugins { grpc { option 'noversion' } }
grpc {
option 'noversion'
}
}
} }
} }
generatedFilesBaseDir = generatedSourcePath generatedFilesBaseDir = generatedSourcePath
@ -172,7 +172,11 @@ subprojects {
} }
} }
[compileJava, compileTestJava, compileJmhJava].each() { [
compileJava,
compileTestJava,
compileJmhJava
].each() {
// Protobuf-generated code produces some warnings. // Protobuf-generated code produces some warnings.
// https://github.com/google/protobuf/issues/2718 // https://github.com/google/protobuf/issues/2718
it.options.compilerArgs += [ it.options.compilerArgs += [
@ -242,7 +246,10 @@ subprojects {
compile { compile {
// Detect Maven Enforcer's dependencyConvergence failures. We only // Detect Maven Enforcer's dependencyConvergence failures. We only
// care for artifacts used as libraries by others. // care for artifacts used as libraries by others.
if (!(project.name in ['grpc-benchmarks', 'grpc-interop-testing'])) { if (!(project.name in [
'grpc-benchmarks',
'grpc-interop-testing'
])) {
resolutionStrategy.failOnVersionConflict() resolutionStrategy.failOnVersionConflict()
} }
} }
@ -303,7 +310,9 @@ subprojects {
// depends on core; core's testCompile depends on testing) // depends on core; core's testCompile depends on testing)
includeTests = false includeTests = false
if (project.hasProperty('jmhIncludeSingleClass')) { if (project.hasProperty('jmhIncludeSingleClass')) {
include = [project.property('jmhIncludeSingleClass')] include = [
project.property('jmhIncludeSingleClass')
]
} }
} }
@ -317,9 +326,7 @@ subprojects {
from sourceSets.main.allSource from sourceSets.main.allSource
} }
artifacts { artifacts { archives javadocJar, sourcesJar }
archives javadocJar, sourcesJar
}
uploadArchives.repositories.mavenDeployer { uploadArchives.repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
@ -379,7 +386,12 @@ subprojects {
} }
} }
if (!(project.name in if (!(project.name in
["grpc-stub", "grpc-protobuf", "grpc-protobuf-lite", "grpc-protobuf-nano"])) { [
"grpc-stub",
"grpc-protobuf",
"grpc-protobuf-lite",
"grpc-protobuf-nano"
])) {
def core = pom.dependencies.find {dep -> dep.artifactId == 'grpc-core'} def core = pom.dependencies.find {dep -> dep.artifactId == 'grpc-core'}
if (core != null) { if (core != null) {
// Depend on specific version of grpc-core because internal package is unstable // Depend on specific version of grpc-core because internal package is unstable
@ -468,3 +480,15 @@ publicApiSubprojects.each { name ->
} }
} }
} }
// format checkers
apply plugin: "com.diffplug.gradle.spotless"
apply plugin: 'groovy'
spotless {
groovyGradle {
target '**/*.gradle'
greclipse()
indentWithSpaces()
paddedCell()
}
}

View File

@ -5,15 +5,11 @@ description = 'The protoc plugin for gRPC Java'
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
mavenLocal() mavenLocal()
} }
dependencies { dependencies { classpath libraries.protobuf_plugin }
classpath libraries.protobuf_plugin
}
} }
def artifactStagingPath = "$buildDir/artifacts" as File def artifactStagingPath = "$buildDir/artifacts" as File
@ -66,23 +62,20 @@ model {
} }
platforms { platforms {
x86_32 { x86_32 { architecture "x86" }
architecture "x86" x86_64 { architecture "x86_64" }
} ppcle_64 { architecture "ppcle_64" }
x86_64 { aarch_64 { architecture "aarch_64" }
architecture "x86_64"
}
ppcle_64 {
architecture "ppcle_64"
}
aarch_64 {
architecture "aarch_64"
}
} }
components { components {
java_plugin(NativeExecutableSpec) { java_plugin(NativeExecutableSpec) {
if (arch in ['x86_32', 'x86_64', 'ppcle_64', 'aarch_64']) { if (arch in [
'x86_32',
'x86_64',
'ppcle_64',
'aarch_64'
]) {
// If arch is not within the defined platforms, we do not specify the // If arch is not within the defined platforms, we do not specify the
// targetPlatform so that Gradle will choose what is appropriate. // targetPlatform so that Gradle will choose what is appropriate.
targetPlatform arch targetPlatform arch
@ -146,14 +139,10 @@ dependencies {
sourceSets { sourceSets {
testLite { testLite {
proto { proto { setSrcDirs(['src/test/proto']) }
setSrcDirs(['src/test/proto'])
}
} }
testNano { testNano {
proto { proto { setSrcDirs(['src/test/proto']) }
setSrcDirs(['src/test/proto'])
}
} }
} }
@ -167,7 +156,11 @@ compileTestJava {
compileTestLiteJava { compileTestLiteJava {
options.compilerArgs = compileTestJava.options.compilerArgs options.compilerArgs = compileTestJava.options.compilerArgs
// Protobuf-generated Lite produces quite a few warnings. // Protobuf-generated Lite produces quite a few warnings.
options.compilerArgs += ["-Xlint:-rawtypes", "-Xlint:-unchecked", "-Xlint:-fallthrough"] options.compilerArgs += [
"-Xlint:-rawtypes",
"-Xlint:-unchecked",
"-Xlint:-fallthrough"
]
} }
compileTestNanoJava { compileTestNanoJava {
@ -190,41 +183,27 @@ protobuf {
artifact = libraries.protoc_lite artifact = libraries.protoc_lite
} }
} }
grpc { grpc { path = javaPluginPath }
path = javaPluginPath
}
} }
generateProtoTasks { generateProtoTasks {
all().each { task -> all().each { task ->
task.dependsOn 'java_pluginExecutable' task.dependsOn 'java_pluginExecutable'
task.inputs.file javaPluginPath task.inputs.file javaPluginPath
} }
ofSourceSet('test')*.plugins { ofSourceSet('test')*.plugins { grpc {} }
grpc {}
}
ofSourceSet('testLite')*.each { task -> ofSourceSet('testLite')*.each { task ->
task.builtins { task.builtins { remove java }
remove java
}
task.plugins { task.plugins {
javalite {} javalite {}
grpc { grpc { option 'lite' }
option 'lite'
}
} }
} }
ofSourceSet('testNano').each { task -> ofSourceSet('testNano').each { task ->
task.builtins { task.builtins {
remove java remove java
javanano { javanano { option 'ignore_services=true' }
option 'ignore_services=true'
}
}
task.plugins {
grpc {
option 'nano'
}
} }
task.plugins { grpc { option 'nano' } }
} }
} }
} }

View File

@ -41,5 +41,8 @@ javadoc {
animalsniffer { animalsniffer {
// Don't check sourceSets.jmh // Don't check sourceSets.jmh
sourceSets = [sourceSets.main, sourceSets.test] sourceSets = [
sourceSets.main,
sourceSets.test
]
} }

View File

@ -7,9 +7,7 @@ buildscript {
google() google()
jcenter() jcenter()
} }
dependencies { dependencies { classpath 'com.android.tools.build:gradle:3.0.1' }
classpath 'com.android.tools.build:gradle:3.0.1'
}
} }
allprojects { allprojects {
@ -30,22 +28,14 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
debug { debug { minifyEnabled false }
minifyEnabled false
}
release { release {
minifyEnabled true minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
testOptions { testOptions { unitTests { includeAndroidResources = true } }
unitTests { lintOptions { disable 'InvalidPackage' }
includeAndroidResources = true
}
}
lintOptions {
disable 'InvalidPackage'
}
} }
dependencies { dependencies {

View File

@ -14,9 +14,7 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
debug { debug { minifyEnabled false }
minifyEnabled false
}
release { release {
minifyEnabled true minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
@ -30,25 +28,18 @@ android {
} }
protobuf { protobuf {
protoc { protoc { artifact = 'com.google.protobuf:protoc:3.4.0' }
artifact = 'com.google.protobuf:protoc:3.4.0'
}
plugins { plugins {
javalite { javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
} }
} }
generateProtoTasks { generateProtoTasks {
all().each { task -> all().each { task ->
task.plugins { task.plugins {
javalite {} javalite {}
grpc { grpc { // Options added to --grpc_out
// Options added to --grpc_out option 'lite' }
option 'lite'
}
} }
} }
} }

View File

@ -13,9 +13,7 @@ android {
versionName "1.0" versionName "1.0"
} }
buildTypes { buildTypes {
debug { debug { minifyEnabled false }
minifyEnabled false
}
release { release {
minifyEnabled true minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
@ -29,25 +27,18 @@ android {
} }
protobuf { protobuf {
protoc { protoc { artifact = 'com.google.protobuf:protoc:3.5.1-1' }
artifact = 'com.google.protobuf:protoc:3.5.1-1'
}
plugins { plugins {
javalite { javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
} }
} }
generateProtoTasks { generateProtoTasks {
all().each { task -> all().each { task ->
task.plugins { task.plugins {
javalite {} javalite {}
grpc { grpc { // Options added to --grpc_out
// Options added to --grpc_out option 'lite' }
option 'lite'
}
} }
} }
} }

View File

@ -12,9 +12,7 @@ android {
versionName "1.0" versionName "1.0"
} }
buildTypes { buildTypes {
debug { debug { minifyEnabled false }
minifyEnabled false
}
release { release {
minifyEnabled true minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
@ -28,25 +26,18 @@ android {
} }
protobuf { protobuf {
protoc { protoc { artifact = 'com.google.protobuf:protoc:3.5.1-1' }
artifact = 'com.google.protobuf:protoc:3.5.1-1'
}
plugins { plugins {
javalite { javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
} }
} }
generateProtoTasks { generateProtoTasks {
all().each { task -> all().each { task ->
task.plugins { task.plugins {
javalite {} javalite {}
grpc { grpc { // Options added to --grpc_out
// Options added to --grpc_out option 'lite' }
option 'lite'
}
} }
} }
} }

View File

@ -22,6 +22,4 @@ allprojects {
} }
} }
task clean(type: Delete) { task clean(type: Delete) { delete rootProject.buildDir }
delete rootProject.buildDir
}

View File

@ -3,23 +3,17 @@ apply plugin: 'com.google.protobuf'
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
} }
} dependencies { // ASSUMES GRADLE 2.12 OR HIGHER. Use plugin version 0.7.5 with earlier
dependencies {
// ASSUMES GRADLE 2.12 OR HIGHER. Use plugin version 0.7.5 with earlier
// gradle versions // gradle versions
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3' }
}
} }
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
mavenLocal() mavenLocal()
} }
@ -52,18 +46,12 @@ dependencies {
} }
protobuf { protobuf {
protoc { protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
artifact = "com.google.protobuf:protoc:${protocVersion}"
}
plugins { plugins {
grpc { grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
} }
generateProtoTasks { generateProtoTasks {
all()*.plugins { all()*.plugins { grpc {} }
grpc {}
}
} }
} }

View File

@ -15,9 +15,7 @@ android {
versionName "1.0" versionName "1.0"
} }
buildTypes { buildTypes {
debug { debug { minifyEnabled false }
minifyEnabled false
}
release { release {
minifyEnabled true minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
@ -51,25 +49,18 @@ android {
} }
protobuf { protobuf {
protoc { protoc { artifact = 'com.google.protobuf:protoc:3.5.1-1' }
artifact = 'com.google.protobuf:protoc:3.5.1-1'
}
plugins { plugins {
javalite { javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
} }
} }
generateProtoTasks { generateProtoTasks {
all().each { task -> all().each { task ->
task.plugins { task.plugins {
javalite {} javalite {}
grpc { grpc { // Options added to --grpc_out
// Options added to --grpc_out option 'lite' }
option 'lite'
}
} }
} }
} }
@ -86,6 +77,4 @@ dependencies {
compile 'io.grpc:grpc-stub:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION compile 'io.grpc:grpc-stub:1.14.0-SNAPSHOT' // CURRENT_GRPC_VERSION
} }
repositories { repositories { mavenCentral() }
mavenCentral()
}

View File

@ -50,18 +50,12 @@ dependencies {
} }
protobuf { protobuf {
protoc { protoc { artifact = 'com.google.protobuf:protoc:3.5.1-1' }
artifact = 'com.google.protobuf:protoc:3.5.1-1'
}
plugins { plugins {
grpc { grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
} }
generateProtoTasks { generateProtoTasks {
all()*.plugins { all()*.plugins { grpc {} }
grpc {}
}
} }
} }

View File

@ -13,13 +13,12 @@
// limitations under the License. // limitations under the License.
description = 'gRPC: gae interop testing (jdk7)' description = 'gRPC: gae interop testing (jdk7)'
buildscript { // Configuration for building buildscript {
// Configuration for building
repositories { repositories {
jcenter() // Bintray's repository - a fast Maven Central mirror & more jcenter() // Bintray's repository - a fast Maven Central mirror & more
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
} }
dependencies { dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.5' classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.5'
@ -27,12 +26,11 @@ buildscript { // Configuration for building
} }
} }
repositories { // repositories for Jar's you access in your code repositories {
// repositories for Jar's you access in your code
mavenLocal() mavenLocal()
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
jcenter() jcenter()
} }
@ -56,12 +54,14 @@ dependencies {
} }
// [START model] // [START model]
appengine { // App Engine tasks configuration appengine {
// App Engine tasks configuration
run { // local (dev_appserver) configuration (standard environments only) run { // local (dev_appserver) configuration (standard environments only)
port = 8080 // default port = 8080 // default
} }
deploy { // deploy configuration deploy {
// deploy configuration
// default - stop the current version // default - stop the current version
stopPreviousVersion = System.getProperty('gaeStopPreviousVersion') ?: true stopPreviousVersion = System.getProperty('gaeStopPreviousVersion') ?: true
// default - make this the current version // default - make this the current version
@ -83,7 +83,11 @@ String getGaeProject() {
def stream = new ByteArrayOutputStream() def stream = new ByteArrayOutputStream()
exec { exec {
executable 'gcloud' executable 'gcloud'
args = ['config', 'get-value', 'project'] args = [
'config',
'get-value',
'project'
]
standardOutput = stream standardOutput = stream
} }
return stream.toString().trim() return stream.toString().trim()

View File

@ -13,13 +13,12 @@
// limitations under the License. // limitations under the License.
description = 'gRPC: gae interop testing (jdk8)' description = 'gRPC: gae interop testing (jdk8)'
buildscript { // Configuration for building buildscript {
// Configuration for building
repositories { repositories {
jcenter() // Bintray's repository - a fast Maven Central mirror & more jcenter() // Bintray's repository - a fast Maven Central mirror & more
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
} }
dependencies { dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.5' classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.5'
@ -27,12 +26,11 @@ buildscript { // Configuration for building
} }
} }
repositories { // repositories for Jar's you access in your code repositories {
// repositories for Jar's you access in your code
mavenLocal() mavenLocal()
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
jcenter() jcenter()
} }
@ -53,12 +51,14 @@ dependencies {
} }
// [START model] // [START model]
appengine { // App Engine tasks configuration appengine {
// App Engine tasks configuration
run { // local (dev_appserver) configuration (standard environments only) run { // local (dev_appserver) configuration (standard environments only)
port = 8080 // default port = 8080 // default
} }
deploy { // deploy configuration deploy {
// deploy configuration
// default - stop the current version // default - stop the current version
stopPreviousVersion = System.getProperty('gaeStopPreviousVersion') ?: true stopPreviousVersion = System.getProperty('gaeStopPreviousVersion') ?: true
// default - make this the current version // default - make this the current version
@ -80,7 +80,11 @@ String getGaeProject() {
def stream = new ByteArrayOutputStream() def stream = new ByteArrayOutputStream()
exec { exec {
executable 'gcloud' executable 'gcloud'
args = ['config', 'get-value', 'project'] args = [
'config',
'get-value',
'project'
]
standardOutput = stream standardOutput = stream
} }
return stream.toString().trim() return stream.toString().trim()

View File

@ -2,14 +2,10 @@ description = "gRPC: GRPCLB LoadBalancer plugin"
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
}
dependencies {
classpath libraries.protobuf_plugin
} }
dependencies { classpath libraries.protobuf_plugin }
} }
dependencies { dependencies {

View File

@ -6,14 +6,10 @@ startScripts.enabled = false
// Add dependency on the protobuf plugin // Add dependency on the protobuf plugin
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
}
dependencies {
classpath libraries.protobuf_plugin
} }
dependencies { classpath libraries.protobuf_plugin }
} }
dependencies { dependencies {
@ -53,12 +49,12 @@ test {
task test_client(type: CreateStartScripts) { task test_client(type: CreateStartScripts) {
mainClassName = "io.grpc.testing.integration.TestServiceClient" mainClassName = "io.grpc.testing.integration.TestServiceClient"
applicationName = "test-client" applicationName = "test-client"
defaultJvmOpts = ["-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name] defaultJvmOpts = [
"-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name
]
outputDir = new File(project.buildDir, 'tmp') outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + configurations.runtime classpath = jar.outputs.files + configurations.runtime
dependencies { dependencies { runtime configurations.alpnagent }
runtime configurations.alpnagent
}
doLast { doLast {
unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\$APP_HOME/lib/') unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\$APP_HOME/lib/')
windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\') windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\')
@ -84,7 +80,10 @@ task stresstest_client(type: CreateStartScripts) {
applicationName = "stresstest-client" applicationName = "stresstest-client"
outputDir = new File(project.buildDir, 'tmp') outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + configurations.runtime classpath = jar.outputs.files + configurations.runtime
defaultJvmOpts = ["-verbose:gc", "-XX:+PrintFlagsFinal"] defaultJvmOpts = [
"-verbose:gc",
"-XX:+PrintFlagsFinal"
]
} }
task http2_client(type: CreateStartScripts) { task http2_client(type: CreateStartScripts) {

View File

@ -15,7 +15,9 @@ dependencies {
[compileJava, compileTestJava].each() { [compileJava, compileTestJava].each() {
// Netty retuns a lot of futures that we mostly don't care about. // Netty retuns a lot of futures that we mostly don't care about.
it.options.compilerArgs += ["-Xep:FutureReturnValueIgnored:OFF"] it.options.compilerArgs += [
"-Xep:FutureReturnValueIgnored:OFF"
]
} }
javadoc { javadoc {
@ -24,11 +26,7 @@ javadoc {
} }
project.sourceSets { project.sourceSets {
main { main { java { srcDir "${projectDir}/third_party/netty/java" } }
java {
srcDir "${projectDir}/third_party/netty/java"
}
}
} }
test { test {

View File

@ -1,19 +1,13 @@
buildscript { buildscript {
repositories { repositories { jcenter() }
jcenter() dependencies { classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2' }
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
}
} }
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.github.johnrengelman.shadow'
description = "gRPC: Netty Shaded" description = "gRPC: Netty Shaded"
sourceSets { sourceSets { testShadow {} }
testShadow {}
}
dependencies { dependencies {
compile project(':grpc-netty') compile project(':grpc-netty')
@ -26,11 +20,9 @@ dependencies {
shadow project(':grpc-core') shadow project(':grpc-core')
} }
artifacts { artifacts { // We want uploadArchives to handle the shadowJar; we don't care about
// We want uploadArchives to handle the shadowJar; we don't care about
// uploadShadow // uploadShadow
archives shadowJar archives shadowJar }
}
shadowJar { shadowJar {
classifier = null classifier = null

View File

@ -12,16 +12,8 @@ dependencies {
} }
project.sourceSets { project.sourceSets {
main { main { java { srcDir "${projectDir}/third_party/okhttp/main/java" } }
java { test { java { srcDir "${projectDir}/third_party/okhttp/test/java" } }
srcDir "${projectDir}/third_party/okhttp/main/java"
}
}
test {
java {
srcDir "${projectDir}/third_party/okhttp/test/java"
}
}
} }
checkstyleMain.exclude '**/io/grpc/okhttp/internal/**' checkstyleMain.exclude '**/io/grpc/okhttp/internal/**'

View File

@ -1,14 +1,10 @@
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
mavenLocal() mavenLocal()
} }
dependencies { dependencies { classpath libraries.protobuf_plugin }
classpath libraries.protobuf_plugin
}
} }
apply plugin: 'com.google.protobuf' apply plugin: 'com.google.protobuf'
@ -27,8 +23,12 @@ dependencies {
compileTestJava { compileTestJava {
// Protobuf-generated Lite produces quite a few warnings. // Protobuf-generated Lite produces quite a few warnings.
options.compilerArgs += ["-Xlint:-rawtypes", "-Xlint:-unchecked", "-Xlint:-fallthrough", options.compilerArgs += [
"-XepExcludedPaths:.*/build/generated/source/proto/.*"] "-Xlint:-rawtypes",
"-Xlint:-unchecked",
"-Xlint:-fallthrough",
"-XepExcludedPaths:.*/build/generated/source/proto/.*"
]
} }
protobuf { protobuf {
@ -50,12 +50,8 @@ protobuf {
} }
generateProtoTasks { generateProtoTasks {
ofSourceSet('test')*.each { task -> ofSourceSet('test')*.each { task ->
task.builtins { task.builtins { remove java }
remove java task.plugins { javalite {} }
}
task.plugins {
javalite {}
}
} }
} }
} }

View File

@ -1,14 +1,10 @@
// Add dependency on the protobuf plugin // Add dependency on the protobuf plugin
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
}
dependencies {
classpath libraries.protobuf_plugin
} }
dependencies { classpath libraries.protobuf_plugin }
} }
description = 'gRPC: Protobuf Nano' description = 'gRPC: Protobuf Nano'
@ -28,9 +24,7 @@ if (project.hasProperty('protobuf')) {
all().each { task -> all().each { task ->
task.builtins { task.builtins {
remove java remove java
javanano { javanano { option 'ignore_services=true' }
option 'ignore_services=true'
}
} }
} }
} }

View File

@ -2,14 +2,10 @@ description = 'gRPC: Protobuf'
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
}
dependencies {
classpath libraries.protobuf_plugin
} }
dependencies { classpath libraries.protobuf_plugin }
} }
dependencies { dependencies {

View File

@ -1,14 +1,10 @@
// Add dependency on the protobuf plugin // Add dependency on the protobuf plugin
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
}
dependencies {
classpath libraries.protobuf_plugin
} }
dependencies { classpath libraries.protobuf_plugin }
} }
description = "gRPC: Services" description = "gRPC: Services"

View File

@ -3,14 +3,10 @@ description = "gRPC: Testing Protos"
// Add dependency on the protobuf plugin // Add dependency on the protobuf plugin
buildscript { buildscript {
repositories { repositories {
maven { maven { // The google mirror is less flaky than mavenCentral()
// The google mirror is less flaky than mavenCentral() url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
}
dependencies {
classpath libraries.protobuf_plugin
} }
dependencies { classpath libraries.protobuf_plugin }
} }
dependencies { dependencies {

View File

@ -20,6 +20,4 @@ dependencies {
project(':grpc-core').sourceSets.test.output project(':grpc-core').sourceSets.test.output
} }
javadoc { javadoc { exclude 'io/grpc/internal/**' }
exclude 'io/grpc/internal/**'
}