mirror of https://github.com/grpc/grpc-java.git
examples: prefer implementation to compile in build.gradle
This commit is contained in:
parent
3f4c3f0406
commit
8ecdec73fd
|
@ -46,15 +46,15 @@ protobuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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.
|
// You need to build grpc-java to obtain these libraries below.
|
||||||
compile 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
implementation 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||||
compile 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
implementation '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-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||||
compile 'javax.annotation:javax.annotation-api:1.2'
|
implementation 'javax.annotation:javax.annotation-api:1.2'
|
||||||
|
|
||||||
testCompile 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testCompile 'com.google.truth:truth:0.36'
|
testImplementation 'com.google.truth:truth:0.36'
|
||||||
testCompile 'io.grpc:grpc-testing:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
testImplementation 'io.grpc:grpc-testing:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,11 @@ protobuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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.
|
// You need to build grpc-java to obtain these libraries below.
|
||||||
compile 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
implementation 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||||
compile 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
implementation '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-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||||
compile 'javax.annotation:javax.annotation-api:1.2'
|
implementation 'javax.annotation:javax.annotation-api:1.2'
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,11 +44,11 @@ protobuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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.
|
// You need to build grpc-java to obtain these libraries below.
|
||||||
compile 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
implementation 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||||
compile 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
implementation '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-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||||
compile 'javax.annotation:javax.annotation-api:1.2'
|
implementation 'javax.annotation:javax.annotation-api:1.2'
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
apply plugin: 'java'
|
plugins {
|
||||||
apply plugin: 'com.google.protobuf'
|
// Provide convenience executables for trying out the examples.
|
||||||
|
id 'application'
|
||||||
buildscript {
|
// ASSUMES GRADLE 2.12 OR HIGHER. Use plugin version 0.7.5 with earlier gradle versions
|
||||||
repositories {
|
id 'com.google.protobuf' version '0.8.5'
|
||||||
maven { // The google mirror is less flaky than mavenCentral()
|
// Generate IntelliJ IDEA's .idea & .iml project files
|
||||||
url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
|
id 'idea'
|
||||||
}
|
|
||||||
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' }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { // The google mirror is less flaky than mavenCentral()
|
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()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,22 +28,22 @@ def protobufVersion = '3.5.1'
|
||||||
def protocVersion = '3.5.1-1'
|
def protocVersion = '3.5.1-1'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "com.google.api.grpc:proto-google-common-protos:1.0.0"
|
implementation "com.google.api.grpc:proto-google-common-protos:1.0.0"
|
||||||
compile "io.grpc:grpc-alts:${grpcVersion}"
|
implementation "io.grpc:grpc-alts:${grpcVersion}"
|
||||||
compile "io.grpc:grpc-netty-shaded:${grpcVersion}"
|
implementation "io.grpc:grpc-netty-shaded:${grpcVersion}"
|
||||||
compile "io.grpc:grpc-protobuf:${grpcVersion}"
|
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
|
||||||
compile "io.grpc:grpc-stub:${grpcVersion}"
|
implementation "io.grpc:grpc-stub:${grpcVersion}"
|
||||||
compileOnly "javax.annotation:javax.annotation-api:1.2"
|
compileOnly "javax.annotation:javax.annotation-api:1.2"
|
||||||
|
|
||||||
// Used in HelloWorldServerTls
|
// Used in HelloWorldServerTls
|
||||||
compile "io.grpc:grpc-netty:${grpcVersion}"
|
implementation "io.grpc:grpc-netty:${grpcVersion}"
|
||||||
compile "io.netty:netty-tcnative-boringssl-static:${nettyTcNativeVersion}"
|
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}"
|
testImplementation "io.grpc:grpc-testing:${grpcVersion}"
|
||||||
testCompile "junit:junit:4.12"
|
testImplementation "junit:junit:4.12"
|
||||||
testCompile "org.mockito:mockito-core:1.9.5"
|
testImplementation "org.mockito:mockito-core:1.9.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
protobuf {
|
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
|
startScripts.enabled = false
|
||||||
|
|
||||||
task routeGuideServer(type: CreateStartScripts) {
|
task routeGuideServer(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.routeguide.RouteGuideServer'
|
mainClassName = 'io.grpc.examples.routeguide.RouteGuideServer'
|
||||||
applicationName = 'route-guide-server'
|
applicationName = 'route-guide-server'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
task routeGuideClient(type: CreateStartScripts) {
|
task routeGuideClient(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.routeguide.RouteGuideClient'
|
mainClassName = 'io.grpc.examples.routeguide.RouteGuideClient'
|
||||||
applicationName = 'route-guide-client'
|
applicationName = 'route-guide-client'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
task helloWorldServer(type: CreateStartScripts) {
|
task helloWorldServer(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.helloworld.HelloWorldServer'
|
mainClassName = 'io.grpc.examples.helloworld.HelloWorldServer'
|
||||||
applicationName = 'hello-world-server'
|
applicationName = 'hello-world-server'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
task helloWorldClient(type: CreateStartScripts) {
|
task helloWorldClient(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.helloworld.HelloWorldClient'
|
mainClassName = 'io.grpc.examples.helloworld.HelloWorldClient'
|
||||||
applicationName = 'hello-world-client'
|
applicationName = 'hello-world-client'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
task helloWorldAltsServer(type: CreateStartScripts) {
|
task helloWorldAltsServer(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.alts.HelloWorldAltsServer'
|
mainClassName = 'io.grpc.examples.alts.HelloWorldAltsServer'
|
||||||
applicationName = 'hello-world-alts-server'
|
applicationName = 'hello-world-alts-server'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
task helloWorldAltsClient(type: CreateStartScripts) {
|
task helloWorldAltsClient(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.alts.HelloWorldAltsClient'
|
mainClassName = 'io.grpc.examples.alts.HelloWorldAltsClient'
|
||||||
applicationName = 'hello-world-alts-client'
|
applicationName = 'hello-world-alts-client'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
task helloWorldTlsServer(type: CreateStartScripts) {
|
task helloWorldTlsServer(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.helloworldtls.HelloWorldServerTls'
|
mainClassName = 'io.grpc.examples.helloworldtls.HelloWorldServerTls'
|
||||||
applicationName = 'hello-world-tls-server'
|
applicationName = 'hello-world-tls-server'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
task helloWorldTlsClient(type: CreateStartScripts) {
|
task helloWorldTlsClient(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.helloworldtls.HelloWorldClientTls'
|
mainClassName = 'io.grpc.examples.helloworldtls.HelloWorldClientTls'
|
||||||
applicationName = 'hello-world-tls-client'
|
applicationName = 'hello-world-tls-client'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
task compressingHelloWorldClient(type: CreateStartScripts) {
|
task compressingHelloWorldClient(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.experimental.CompressingHelloWorldClient'
|
mainClassName = 'io.grpc.examples.experimental.CompressingHelloWorldClient'
|
||||||
applicationName = 'compressing-hello-world-client'
|
applicationName = 'compressing-hello-world-client'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
applicationDistribution.into('bin') {
|
applicationDistribution.into('bin') {
|
||||||
|
|
|
@ -67,14 +67,14 @@ protobuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.android.support:appcompat-v7:27.0.2'
|
implementation 'com.android.support:appcompat-v7:27.0.2'
|
||||||
compile 'javax.annotation:javax.annotation-api:1.2'
|
implementation 'javax.annotation:javax.annotation-api:1.2'
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
|
||||||
// You need to build grpc-java to obtain these libraries below.
|
// You need to build grpc-java to obtain these libraries below.
|
||||||
compile 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
implementation 'io.grpc:grpc-okhttp:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||||
compile 'io.grpc:grpc-protobuf-lite:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
implementation '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-stub:1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories { mavenCentral() }
|
repositories { mavenCentral() }
|
||||||
|
|
|
@ -1,28 +1,16 @@
|
||||||
apply plugin: 'kotlin'
|
plugins {
|
||||||
apply plugin: 'com.google.protobuf'
|
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
|
// 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
|
// 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 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.
|
// to jump to definitions from Java and Kotlin files.
|
||||||
// For best results, install the Protobuf and Kotlin plugins for IntelliJ.
|
// For best results, install the Protobuf and Kotlin plugins for IntelliJ.
|
||||||
apply plugin: 'idea'
|
id 'idea'
|
||||||
|
|
||||||
// Provide convenience executables for trying out the examples.
|
// Provide convenience executables for trying out the examples.
|
||||||
apply plugin: 'application'
|
id '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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -38,16 +26,17 @@ repositories {
|
||||||
def grpcVersion = '1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
def grpcVersion = '1.18.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
def kotlinVerion = plugins.findPlugin("org.jetbrains.kotlin.jvm").kotlinPluginVersion
|
||||||
compile "com.google.api.grpc:proto-google-common-protos:1.0.0"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVerion}"
|
||||||
compile "io.grpc:grpc-netty-shaded:${grpcVersion}"
|
implementation "com.google.api.grpc:proto-google-common-protos:1.0.0"
|
||||||
compile "io.grpc:grpc-protobuf:${grpcVersion}"
|
implementation "io.grpc:grpc-netty-shaded:${grpcVersion}"
|
||||||
compile "io.grpc:grpc-stub:${grpcVersion}"
|
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
|
||||||
|
implementation "io.grpc:grpc-stub:${grpcVersion}"
|
||||||
compileOnly "javax.annotation:javax.annotation-api:1.2"
|
compileOnly "javax.annotation:javax.annotation-api:1.2"
|
||||||
|
|
||||||
testCompile "io.grpc:grpc-testing:${grpcVersion}" // gRCP testing utilities
|
testImplementation "io.grpc:grpc-testing:${grpcVersion}" // gRCP testing utilities
|
||||||
testCompile "junit:junit:4.12"
|
testImplementation "junit:junit:4.12"
|
||||||
testCompile "org.mockito:mockito-core:1.9.5"
|
testImplementation "org.mockito:mockito-core:1.9.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
protobuf {
|
protobuf {
|
||||||
|
@ -66,14 +55,14 @@ task helloWorldServer(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.helloworld.HelloWorldServer'
|
mainClassName = 'io.grpc.examples.helloworld.HelloWorldServer'
|
||||||
applicationName = 'hello-world-server'
|
applicationName = 'hello-world-server'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
task helloWorldClient(type: CreateStartScripts) {
|
task helloWorldClient(type: CreateStartScripts) {
|
||||||
mainClassName = 'io.grpc.examples.helloworld.HelloWorldClient'
|
mainClassName = 'io.grpc.examples.helloworld.HelloWorldClient'
|
||||||
applicationName = 'hello-world-client'
|
applicationName = 'hello-world-client'
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = startScripts.classpath
|
||||||
}
|
}
|
||||||
|
|
||||||
applicationDistribution.into('bin') {
|
applicationDistribution.into('bin') {
|
||||||
|
|
|
@ -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'
|
rootProject.name = 'examples'
|
||||||
|
|
|
@ -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'
|
rootProject.name = 'examples'
|
||||||
|
|
Loading…
Reference in New Issue