mirror of https://github.com/grpc/grpc-java.git
Delete the generated files only before generateProto.
Previously generated files were deleted at configuration time. Running non-build tasks such as ``clean`` or ``tasks`` would delete the generated files and tracked by git, which is annoying. Now we delete them only before the ``generateProto`` task, which solves the problem. After this change, the case that ``generateProto`` is not executed at all, is no longer covered. However, it is much less likely than the still-covered case that ``generateProto`` is not re-generating all files due to misconfiguration.
This commit is contained in:
parent
2a58bf8c34
commit
568d25dae9
|
|
@ -58,16 +58,19 @@ subprojects {
|
|||
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"
|
||||
}
|
||||
// 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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue