From 35f77ee84bf806d1bbea34af9f0c2256ad652c43 Mon Sep 17 00:00:00 2001 From: Kun Zhang Date: Mon, 22 Jun 2015 16:29:30 -0700 Subject: [PATCH] Upgrade to protobuf-gradle-plugin 0.5.0 --- .../io/grpc/testing/TestServiceGrpc.java | 0 .../io/grpc/testing/WorkerGrpc.java | 0 .../io/grpc/testing/ClientArgs.java | 0 .../io/grpc/testing/ClientArgsOrBuilder.java | 0 .../io/grpc/testing/ClientConfig.java | 0 .../grpc/testing/ClientConfigOrBuilder.java | 0 .../io/grpc/testing/ClientStats.java | 0 .../io/grpc/testing/ClientStatsOrBuilder.java | 0 .../io/grpc/testing/ClientStatus.java | 0 .../grpc/testing/ClientStatusOrBuilder.java | 0 .../io/grpc/testing/ClientType.java | 0 .../io/grpc/testing/HistogramData.java | 0 .../grpc/testing/HistogramDataOrBuilder.java | 0 .../main/{ => java}/io/grpc/testing/Mark.java | 0 .../io/grpc/testing/MarkOrBuilder.java | 0 .../{ => java}/io/grpc/testing/Payload.java | 0 .../io/grpc/testing/PayloadOrBuilder.java | 0 .../io/grpc/testing/PayloadType.java | 0 .../io/grpc/testing/QpsTestProto.java | 0 .../{ => java}/io/grpc/testing/RpcType.java | 0 .../io/grpc/testing/ServerArgs.java | 0 .../io/grpc/testing/ServerArgsOrBuilder.java | 0 .../io/grpc/testing/ServerConfig.java | 0 .../grpc/testing/ServerConfigOrBuilder.java | 0 .../io/grpc/testing/ServerStats.java | 0 .../io/grpc/testing/ServerStatsOrBuilder.java | 0 .../io/grpc/testing/ServerStatus.java | 0 .../grpc/testing/ServerStatusOrBuilder.java | 0 .../io/grpc/testing/ServerType.java | 0 .../io/grpc/testing/SimpleRequest.java | 0 .../grpc/testing/SimpleRequestOrBuilder.java | 0 .../io/grpc/testing/SimpleResponse.java | 0 .../grpc/testing/SimpleResponseOrBuilder.java | 0 .../io/grpc/testing/StatsRequest.java | 0 .../grpc/testing/StatsRequestOrBuilder.java | 0 build.gradle | 63 ++++++++++--------- compiler/build.gradle | 47 +++++++------- .../grpc/examples/helloworld/GreeterGrpc.java | 0 .../examples/routeguide/RouteGuideGrpc.java | 0 .../examples/helloworld/HelloRequest.java | 0 .../helloworld/HelloRequestOrBuilder.java | 0 .../examples/helloworld/HelloResponse.java | 0 .../helloworld/HelloResponseOrBuilder.java | 0 .../examples/helloworld/HelloWorldProto.java | 0 .../io/grpc/examples/routeguide/Feature.java | 0 .../examples/routeguide/FeatureOrBuilder.java | 0 .../io/grpc/examples/routeguide/Point.java | 0 .../examples/routeguide/PointOrBuilder.java | 0 .../grpc/examples/routeguide/Rectangle.java | 0 .../routeguide/RectangleOrBuilder.java | 0 .../examples/routeguide/RouteGuideProto.java | 0 .../grpc/examples/routeguide/RouteNote.java | 0 .../routeguide/RouteNoteOrBuilder.java | 0 .../examples/routeguide/RouteSummary.java | 0 .../routeguide/RouteSummaryOrBuilder.java | 0 .../testing/integration/TestServiceGrpc.java | 0 .../com/google/protobuf/EmptyProtos.java | 0 .../io/grpc/testing/integration/Messages.java | 0 .../io/grpc/testing/integration/Test.java | 0 59 files changed, 60 insertions(+), 50 deletions(-) rename benchmarks/src/generated/main/{ => grpc}/io/grpc/testing/TestServiceGrpc.java (100%) rename benchmarks/src/generated/main/{ => grpc}/io/grpc/testing/WorkerGrpc.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ClientArgs.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ClientArgsOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ClientConfig.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ClientConfigOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ClientStats.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ClientStatsOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ClientStatus.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ClientStatusOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ClientType.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/HistogramData.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/HistogramDataOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/Mark.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/MarkOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/Payload.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/PayloadOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/PayloadType.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/QpsTestProto.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/RpcType.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ServerArgs.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ServerArgsOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ServerConfig.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ServerConfigOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ServerStats.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ServerStatsOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ServerStatus.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ServerStatusOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/ServerType.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/SimpleRequest.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/SimpleRequestOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/SimpleResponse.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/SimpleResponseOrBuilder.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/StatsRequest.java (100%) rename benchmarks/src/generated/main/{ => java}/io/grpc/testing/StatsRequestOrBuilder.java (100%) rename examples/src/generated/main/{ => grpc}/io/grpc/examples/helloworld/GreeterGrpc.java (100%) rename examples/src/generated/main/{ => grpc}/io/grpc/examples/routeguide/RouteGuideGrpc.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/helloworld/HelloRequest.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/helloworld/HelloRequestOrBuilder.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/helloworld/HelloResponse.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/helloworld/HelloResponseOrBuilder.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/helloworld/HelloWorldProto.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/Feature.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/FeatureOrBuilder.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/Point.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/PointOrBuilder.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/Rectangle.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/RectangleOrBuilder.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/RouteGuideProto.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/RouteNote.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/RouteNoteOrBuilder.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/RouteSummary.java (100%) rename examples/src/generated/main/{ => java}/io/grpc/examples/routeguide/RouteSummaryOrBuilder.java (100%) rename interop-testing/src/generated/main/{ => grpc}/io/grpc/testing/integration/TestServiceGrpc.java (100%) rename interop-testing/src/generated/main/{ => java}/com/google/protobuf/EmptyProtos.java (100%) rename interop-testing/src/generated/main/{ => java}/io/grpc/testing/integration/Messages.java (100%) rename interop-testing/src/generated/main/{ => java}/io/grpc/testing/integration/Test.java (100%) diff --git a/benchmarks/src/generated/main/io/grpc/testing/TestServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/testing/TestServiceGrpc.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/TestServiceGrpc.java rename to benchmarks/src/generated/main/grpc/io/grpc/testing/TestServiceGrpc.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/WorkerGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/testing/WorkerGrpc.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/WorkerGrpc.java rename to benchmarks/src/generated/main/grpc/io/grpc/testing/WorkerGrpc.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ClientArgs.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientArgs.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ClientArgs.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ClientArgs.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ClientArgsOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientArgsOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ClientArgsOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ClientArgsOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ClientConfig.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientConfig.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ClientConfig.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ClientConfig.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ClientConfigOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientConfigOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ClientConfigOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ClientConfigOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ClientStats.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientStats.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ClientStats.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ClientStats.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ClientStatsOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientStatsOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ClientStatsOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ClientStatsOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ClientStatus.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientStatus.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ClientStatus.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ClientStatus.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ClientStatusOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientStatusOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ClientStatusOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ClientStatusOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ClientType.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientType.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ClientType.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ClientType.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/HistogramData.java b/benchmarks/src/generated/main/java/io/grpc/testing/HistogramData.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/HistogramData.java rename to benchmarks/src/generated/main/java/io/grpc/testing/HistogramData.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/HistogramDataOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/HistogramDataOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/HistogramDataOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/HistogramDataOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/Mark.java b/benchmarks/src/generated/main/java/io/grpc/testing/Mark.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/Mark.java rename to benchmarks/src/generated/main/java/io/grpc/testing/Mark.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/MarkOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/MarkOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/MarkOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/MarkOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/Payload.java b/benchmarks/src/generated/main/java/io/grpc/testing/Payload.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/Payload.java rename to benchmarks/src/generated/main/java/io/grpc/testing/Payload.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/PayloadOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/PayloadOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/PayloadOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/PayloadOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/PayloadType.java b/benchmarks/src/generated/main/java/io/grpc/testing/PayloadType.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/PayloadType.java rename to benchmarks/src/generated/main/java/io/grpc/testing/PayloadType.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/QpsTestProto.java b/benchmarks/src/generated/main/java/io/grpc/testing/QpsTestProto.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/QpsTestProto.java rename to benchmarks/src/generated/main/java/io/grpc/testing/QpsTestProto.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/RpcType.java b/benchmarks/src/generated/main/java/io/grpc/testing/RpcType.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/RpcType.java rename to benchmarks/src/generated/main/java/io/grpc/testing/RpcType.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ServerArgs.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerArgs.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ServerArgs.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ServerArgs.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ServerArgsOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerArgsOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ServerArgsOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ServerArgsOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ServerConfig.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerConfig.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ServerConfig.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ServerConfig.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ServerConfigOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerConfigOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ServerConfigOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ServerConfigOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ServerStats.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerStats.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ServerStats.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ServerStats.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ServerStatsOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerStatsOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ServerStatsOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ServerStatsOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ServerStatus.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerStatus.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ServerStatus.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ServerStatus.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ServerStatusOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerStatusOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ServerStatusOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ServerStatusOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/ServerType.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerType.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/ServerType.java rename to benchmarks/src/generated/main/java/io/grpc/testing/ServerType.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/SimpleRequest.java b/benchmarks/src/generated/main/java/io/grpc/testing/SimpleRequest.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/SimpleRequest.java rename to benchmarks/src/generated/main/java/io/grpc/testing/SimpleRequest.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/SimpleRequestOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/SimpleRequestOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/SimpleRequestOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/SimpleRequestOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/SimpleResponse.java b/benchmarks/src/generated/main/java/io/grpc/testing/SimpleResponse.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/SimpleResponse.java rename to benchmarks/src/generated/main/java/io/grpc/testing/SimpleResponse.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/SimpleResponseOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/SimpleResponseOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/SimpleResponseOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/SimpleResponseOrBuilder.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/StatsRequest.java b/benchmarks/src/generated/main/java/io/grpc/testing/StatsRequest.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/StatsRequest.java rename to benchmarks/src/generated/main/java/io/grpc/testing/StatsRequest.java diff --git a/benchmarks/src/generated/main/io/grpc/testing/StatsRequestOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/StatsRequestOrBuilder.java similarity index 100% rename from benchmarks/src/generated/main/io/grpc/testing/StatsRequestOrBuilder.java rename to benchmarks/src/generated/main/java/io/grpc/testing/StatsRequestOrBuilder.java diff --git a/build.gradle b/build.gradle index 1861a770c6..33735b2054 100644 --- a/build.gradle +++ b/build.gradle @@ -56,47 +56,52 @@ subprojects { protobufVersion = '3.0.0-alpha-3.1' configureProtoCompilation = { - String generatedSourcePath = 'src/generated' + 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.protobufCodeGenPlugins = ["grpc:$javaPluginPath"] - if (project.hasProperty('protoc')) { - project.protocPath = project.protoc - } else { - project.protocDep = "com.google.protobuf:protoc:${protobufVersion}" - } - project.generatedFileDir = "${projectDir}/src/generated" - task deleteGeneratedSource << { - project.delete project.fileTree(dir: generatedSourcePath) - } - project.afterEvaluate { - generateProto.dependsOn ':grpc-compiler:java_pluginExecutable' - // Delete the generated sources first, so that we can be alerted if they are not re-compiled. - generateProto.dependsOn deleteGeneratedSource - // Recompile protos when the codegen has been changed - generateProto.inputs.file javaPluginPath - // Recompile protos when build.gradle has been changed, because - // it's possible the version of protoc has been changed. - generateProto.inputs.file "${rootProject.projectDir}/build.gradle" - } - - project.sourceSets { - main { - proto { - plugins { - grpc { } + project.protobuf { + protoc { + if (project.hasProperty('protoc')) { + path = project.protoc + } else { + artifact = "com.google.protobuf:protoc:${protobufVersion}" + } + } + 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 + // 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 {} } } } + generatedFilesBaseDir = generatedSourcePath + } + + task deleteGeneratedSource << { + project.delete project.fileTree(dir: generatedSourcePath) } } else { // Otherwise, we just use the checked-in generated code. project.sourceSets { main { java { - srcDir "${generatedSourcePath}/main" + srcDir "${generatedSourcePath}/main/java" + srcDir "${generatedSourcePath}/main/grpc" } } } @@ -125,7 +130,7 @@ subprojects { okhttp: 'com.squareup.okhttp:okhttp:2.4.0', protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}", protobuf_nano: "com.google.protobuf.nano:protobuf-javanano:${protobufVersion}", - protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.4.1', + protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.5.0', netty: 'io.netty:netty-codec-http2:4.1.0.Beta5', netty_tcnative: 'io.netty:netty-tcnative:1.1.33.Fork2' + tcnative_suffix, diff --git a/compiler/build.gradle b/compiler/build.gradle index 9e762228d2..5660ea5709 100644 --- a/compiler/build.gradle +++ b/compiler/build.gradle @@ -85,23 +85,39 @@ dependencies { } sourceSets { - test { - proto { - plugins { - grpc { } - } - } - } testNano { proto { setSrcDirs(['src/test/proto']) - builtins { + } + } +} + +protobuf { + protoc { + if (project.hasProperty('protoc')) { + path = project.protoc + } else { + artifact = "com.google.protobuf:protoc:${protobufVersion}" + } + } + plugins { + grpc { + path = javaPluginPath + } + } + generateProtoTasks { + all()*.dependsOn 'java_pluginExecutable' + ofSourceSet('test')*.plugins { + grpc {} + } + ofSourceSet('testNano').each { task -> + task.builtins { remove java javanano { option 'ignore_services=true' } } - plugins { + task.plugins { grpc { option 'nano=true' } @@ -187,17 +203,6 @@ artifacts { } } -if (project.hasProperty('protoc')) { - project.protocPath = project.protoc -} else { - project.protocDep = "com.google.protobuf:protoc:${protobufVersion}" -} -protobufCodeGenPlugins = ["grpc:$javaPluginPath"] - -project.afterEvaluate { - [generateTestProto, generateTestNanoProto]*.dependsOn 'java_pluginExecutable' -} - test.dependsOn('testGolden', 'testNanoGolden') def configureTestTask(Task task, String suffix) { @@ -209,7 +214,7 @@ def configureTestTask(Task task, String suffix) { } // File isn't found on Windows if last slash is forward-slash def slash = System.getProperty("file.separator") - task.args "$buildDir/generated-sources/test${suffix}/io/grpc/testing/integration" + slash + "TestServiceGrpc.java", + task.args "$buildDir/generated/source/proto/test${suffix}/grpc/io/grpc/testing/integration${slash}TestServiceGrpc.java", "$projectDir/src/test/golden/TestService${suffix}.java.txt" } diff --git a/examples/src/generated/main/io/grpc/examples/helloworld/GreeterGrpc.java b/examples/src/generated/main/grpc/io/grpc/examples/helloworld/GreeterGrpc.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/helloworld/GreeterGrpc.java rename to examples/src/generated/main/grpc/io/grpc/examples/helloworld/GreeterGrpc.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/RouteGuideGrpc.java b/examples/src/generated/main/grpc/io/grpc/examples/routeguide/RouteGuideGrpc.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/RouteGuideGrpc.java rename to examples/src/generated/main/grpc/io/grpc/examples/routeguide/RouteGuideGrpc.java diff --git a/examples/src/generated/main/io/grpc/examples/helloworld/HelloRequest.java b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequest.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/helloworld/HelloRequest.java rename to examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequest.java diff --git a/examples/src/generated/main/io/grpc/examples/helloworld/HelloRequestOrBuilder.java b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequestOrBuilder.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/helloworld/HelloRequestOrBuilder.java rename to examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequestOrBuilder.java diff --git a/examples/src/generated/main/io/grpc/examples/helloworld/HelloResponse.java b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloResponse.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/helloworld/HelloResponse.java rename to examples/src/generated/main/java/io/grpc/examples/helloworld/HelloResponse.java diff --git a/examples/src/generated/main/io/grpc/examples/helloworld/HelloResponseOrBuilder.java b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloResponseOrBuilder.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/helloworld/HelloResponseOrBuilder.java rename to examples/src/generated/main/java/io/grpc/examples/helloworld/HelloResponseOrBuilder.java diff --git a/examples/src/generated/main/io/grpc/examples/helloworld/HelloWorldProto.java b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloWorldProto.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/helloworld/HelloWorldProto.java rename to examples/src/generated/main/java/io/grpc/examples/helloworld/HelloWorldProto.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/Feature.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/Feature.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/Feature.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/Feature.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/FeatureOrBuilder.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/FeatureOrBuilder.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/FeatureOrBuilder.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/FeatureOrBuilder.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/Point.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/Point.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/Point.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/Point.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/PointOrBuilder.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/PointOrBuilder.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/PointOrBuilder.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/PointOrBuilder.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/Rectangle.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/Rectangle.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/Rectangle.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/Rectangle.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/RectangleOrBuilder.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/RectangleOrBuilder.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/RectangleOrBuilder.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/RectangleOrBuilder.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/RouteGuideProto.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteGuideProto.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/RouteGuideProto.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/RouteGuideProto.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/RouteNote.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteNote.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/RouteNote.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/RouteNote.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/RouteNoteOrBuilder.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteNoteOrBuilder.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/RouteNoteOrBuilder.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/RouteNoteOrBuilder.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/RouteSummary.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteSummary.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/RouteSummary.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/RouteSummary.java diff --git a/examples/src/generated/main/io/grpc/examples/routeguide/RouteSummaryOrBuilder.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteSummaryOrBuilder.java similarity index 100% rename from examples/src/generated/main/io/grpc/examples/routeguide/RouteSummaryOrBuilder.java rename to examples/src/generated/main/java/io/grpc/examples/routeguide/RouteSummaryOrBuilder.java diff --git a/interop-testing/src/generated/main/io/grpc/testing/integration/TestServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java similarity index 100% rename from interop-testing/src/generated/main/io/grpc/testing/integration/TestServiceGrpc.java rename to interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java diff --git a/interop-testing/src/generated/main/com/google/protobuf/EmptyProtos.java b/interop-testing/src/generated/main/java/com/google/protobuf/EmptyProtos.java similarity index 100% rename from interop-testing/src/generated/main/com/google/protobuf/EmptyProtos.java rename to interop-testing/src/generated/main/java/com/google/protobuf/EmptyProtos.java diff --git a/interop-testing/src/generated/main/io/grpc/testing/integration/Messages.java b/interop-testing/src/generated/main/java/io/grpc/testing/integration/Messages.java similarity index 100% rename from interop-testing/src/generated/main/io/grpc/testing/integration/Messages.java rename to interop-testing/src/generated/main/java/io/grpc/testing/integration/Messages.java diff --git a/interop-testing/src/generated/main/io/grpc/testing/integration/Test.java b/interop-testing/src/generated/main/java/io/grpc/testing/integration/Test.java similarity index 100% rename from interop-testing/src/generated/main/io/grpc/testing/integration/Test.java rename to interop-testing/src/generated/main/java/io/grpc/testing/integration/Test.java