mirror of https://github.com/grpc/grpc-java.git
Fix a bug that checked-in generated code are not re-compiled.
Since commit 287a27a the ``grpc`` codegen plugin must be explicitly
added to the ``plugins`` block of the source set, while it didn't.
Remove the generated code before recompiling it to prevent such issue
from being missed by tests.
This commit is contained in:
parent
518b7dbf7c
commit
2cdc5e3c47
20
build.gradle
20
build.gradle
|
|
@ -46,6 +46,7 @@ subprojects {
|
||||||
protobufVersion = '3.0.0-alpha-2'
|
protobufVersion = '3.0.0-alpha-2'
|
||||||
|
|
||||||
configureProtoCompilation = {
|
configureProtoCompilation = {
|
||||||
|
String generatedSourcePath = 'src/generated'
|
||||||
if (rootProject.childProjects.containsKey('grpc-compiler')) {
|
if (rootProject.childProjects.containsKey('grpc-compiler')) {
|
||||||
// Only when the codegen is built along with the project, will we be able to recompile
|
// Only when the codegen is built along with the project, will we be able to recompile
|
||||||
// the proto files.
|
// the proto files.
|
||||||
|
|
@ -61,17 +62,24 @@ subprojects {
|
||||||
// it's possible the version of protoc has been changed.
|
// it's possible the version of protoc has been changed.
|
||||||
generateProto.inputs.file "${rootProject.projectDir}/build.gradle"
|
generateProto.inputs.file "${rootProject.projectDir}/build.gradle"
|
||||||
}
|
}
|
||||||
|
// Delete the generated sources first, so that we can be alerted if they are not re-compiled.
|
||||||
|
project.delete project.fileTree(dir: generatedSourcePath)
|
||||||
|
|
||||||
|
project.sourceSets {
|
||||||
|
main {
|
||||||
|
proto {
|
||||||
|
plugins {
|
||||||
|
grpc { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we just use the checked-in generated code.
|
// Otherwise, we just use the checked-in generated code.
|
||||||
project.sourceSets {
|
project.sourceSets {
|
||||||
main {
|
main {
|
||||||
java {
|
java {
|
||||||
srcDir 'src/generated/main'
|
srcDir "${generatedSourcePath}/main"
|
||||||
}
|
|
||||||
proto {
|
|
||||||
plugins {
|
|
||||||
grpc { }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue