examples: prefer implementation to compile in build.gradle

This commit is contained in:
ZHANG Dapeng 2018-12-03 10:01:19 -08:00 committed by GitHub
parent 3f4c3f0406
commit 8ecdec73fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 93 additions and 95 deletions

View File

@ -46,15 +46,15 @@ protobuf {
}
dependencies {
compile 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
// You need to build grpc-java to obtain these libraries below.
compile 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'javax.annotation:javax.annotation-api:1.2'
implementation 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'javax.annotation:javax.annotation-api:1.2'
testCompile 'junit:junit:4.12'
testCompile 'com.google.truth:truth:0.36'
testCompile 'io.grpc:grpc-testing:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
testImplementation 'junit:junit:4.12'
testImplementation 'com.google.truth:truth:0.36'
testImplementation 'io.grpc:grpc-testing:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}

View File

@ -45,11 +45,11 @@ protobuf {
}
dependencies {
compile 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
// You need to build grpc-java to obtain these libraries below.
compile 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'javax.annotation:javax.annotation-api:1.2'
implementation 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'javax.annotation:javax.annotation-api:1.2'
}

View File

@ -44,11 +44,11 @@ protobuf {
}
dependencies {
compile 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
// You need to build grpc-java to obtain these libraries below.
compile 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'javax.annotation:javax.annotation-api:1.2'
implementation 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'javax.annotation:javax.annotation-api:1.2'
}

View File

@ -1,19 +1,16 @@
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
buildscript {
repositories {
maven { // The google mirror is less flaky than mavenCentral()
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
// gradle versions
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.5' }
plugins {
// Provide convenience executables for trying out the examples.
id 'application'
// ASSUMES GRADLE 2.12 OR HIGHER. Use plugin version 0.7.5 with earlier gradle versions
id 'com.google.protobuf' version '0.8.5'
// Generate IntelliJ IDEA's .idea & .iml project files
id 'idea'
}
repositories {
maven { // 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()
}
@ -31,22 +28,22 @@ def protobufVersion = '3.5.1'
def protocVersion = '3.5.1-1'
dependencies {
compile "com.google.api.grpc:proto-google-common-protos:1.0.0"
compile "io.grpc:grpc-alts:${grpcVersion}"
compile "io.grpc:grpc-netty-shaded:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}"
implementation "com.google.api.grpc:proto-google-common-protos:1.0.0"
implementation "io.grpc:grpc-alts:${grpcVersion}"
implementation "io.grpc:grpc-netty-shaded:${grpcVersion}"
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
compileOnly "javax.annotation:javax.annotation-api:1.2"
// Used in HelloWorldServerTls
compile "io.grpc:grpc-netty:${grpcVersion}"
compile "io.netty:netty-tcnative-boringssl-static:${nettyTcNativeVersion}"
implementation "io.grpc:grpc-netty:${grpcVersion}"
implementation "io.netty:netty-tcnative-boringssl-static:${nettyTcNativeVersion}"
compile "com.google.protobuf:protobuf-java-util:${protobufVersion}"
implementation "com.google.protobuf:protobuf-java-util:${protobufVersion}"
testCompile "io.grpc:grpc-testing:${grpcVersion}"
testCompile "junit:junit:4.12"
testCompile "org.mockito:mockito-core:1.9.5"
testImplementation "io.grpc:grpc-testing:${grpcVersion}"
testImplementation "junit:junit:4.12"
testImplementation "org.mockito:mockito-core:1.9.5"
}
protobuf {
@ -69,75 +66,69 @@ sourceSets {
}
}
// Generate IntelliJ IDEA's .idea & .iml project files
apply plugin: 'idea'
// Provide convenience executables for trying out the examples.
apply plugin: 'application'
startScripts.enabled = false
task routeGuideServer(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.routeguide.RouteGuideServer'
applicationName = 'route-guide-server'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
task routeGuideClient(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.routeguide.RouteGuideClient'
applicationName = 'route-guide-client'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
task helloWorldServer(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.helloworld.HelloWorldServer'
applicationName = 'hello-world-server'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
task helloWorldClient(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.helloworld.HelloWorldClient'
applicationName = 'hello-world-client'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
task helloWorldAltsServer(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.alts.HelloWorldAltsServer'
applicationName = 'hello-world-alts-server'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
task helloWorldAltsClient(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.alts.HelloWorldAltsClient'
applicationName = 'hello-world-alts-client'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
task helloWorldTlsServer(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.helloworldtls.HelloWorldServerTls'
applicationName = 'hello-world-tls-server'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
task helloWorldTlsClient(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.helloworldtls.HelloWorldClientTls'
applicationName = 'hello-world-tls-client'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
task compressingHelloWorldClient(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.experimental.CompressingHelloWorldClient'
applicationName = 'compressing-hello-world-client'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
applicationDistribution.into('bin') {

View File

@ -67,14 +67,14 @@ protobuf {
}
dependencies {
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'javax.annotation:javax.annotation-api:1.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'javax.annotation:javax.annotation-api:1.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// You need to build grpc-java to obtain these libraries below.
compile 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}
repositories { mavenCentral() }

View File

@ -1,28 +1,16 @@
apply plugin: 'kotlin'
apply plugin: 'com.google.protobuf'
plugins {
id 'org.jetbrains.kotlin.jvm' version'1.3.10'
id 'com.google.protobuf' version '0.8.5'
// Generate IntelliJ IDEA's .idea & .iml project files
// Starting with 0.8.4 of protobuf-gradle-plugin, *.proto and the gen output files are added
// to IntelliJ as sources. It is no longer necessary to add them manually to the idea {} block
// to jump to definitions from Java and Kotlin files.
// For best results, install the Protobuf and Kotlin plugins for IntelliJ.
apply plugin: 'idea'
// Generate IntelliJ IDEA's .idea & .iml project files
// Starting with 0.8.4 of protobuf-gradle-plugin, *.proto and the gen output files are added
// to IntelliJ as sources. It is no longer necessary to add them manually to the idea {} block
// to jump to definitions from Java and Kotlin files.
// For best results, install the Protobuf and Kotlin plugins for IntelliJ.
id 'idea'
// Provide convenience executables for trying out the examples.
apply plugin: 'application'
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
// Provide convenience executables for trying out the examples.
id 'application'
}
repositories {
@ -38,16 +26,17 @@ repositories {
def grpcVersion = '1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "com.google.api.grpc:proto-google-common-protos:1.0.0"
compile "io.grpc:grpc-netty-shaded:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}"
def kotlinVerion = plugins.findPlugin("org.jetbrains.kotlin.jvm").kotlinPluginVersion
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVerion}"
implementation "com.google.api.grpc:proto-google-common-protos:1.0.0"
implementation "io.grpc:grpc-netty-shaded:${grpcVersion}"
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
compileOnly "javax.annotation:javax.annotation-api:1.2"
testCompile "io.grpc:grpc-testing:${grpcVersion}" // gRCP testing utilities
testCompile "junit:junit:4.12"
testCompile "org.mockito:mockito-core:1.9.5"
testImplementation "io.grpc:grpc-testing:${grpcVersion}" // gRCP testing utilities
testImplementation "junit:junit:4.12"
testImplementation "org.mockito:mockito-core:1.9.5"
}
protobuf {
@ -66,14 +55,14 @@ task helloWorldServer(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.helloworld.HelloWorldServer'
applicationName = 'hello-world-server'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
task helloWorldClient(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.helloworld.HelloWorldClient'
applicationName = 'hello-world-client'
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
classpath = startScripts.classpath
}
applicationDistribution.into('bin') {

View File

@ -1 +1,10 @@
pluginManagement {
repositories {
maven { // The google mirror is less flaky than mavenCentral()
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
gradlePluginPortal()
}
}
rootProject.name = 'examples'

View File

@ -1 +1,10 @@
pluginManagement {
repositories {
maven { // The google mirror is less flaky than mavenCentral()
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
gradlePluginPortal()
}
}
rootProject.name = 'examples'