Skip to content

Commit ec1150f

Browse files
committed
Only delete the generated code being regenerated
This fixes the problem where protobuf-nano's test generated code was trashed any time a target that depended on protobuf-nano was compiled.
1 parent 2465275 commit ec1150f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

build.gradle

+5-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ subprojects {
8080
all().each { task ->
8181
task.dependsOn ':grpc-compiler:java_pluginExecutable'
8282
// Delete the generated sources first, so that we can be alerted if they are not re-compiled.
83-
task.dependsOn deleteGeneratedSource
83+
task.dependsOn 'deleteGeneratedSource' + task.sourceSet.name
8484
// Recompile protos when the codegen has been changed
8585
task.inputs.file javaPluginPath
8686
// Recompile protos when build.gradle has been changed, because
@@ -94,8 +94,10 @@ subprojects {
9494
generatedFilesBaseDir = generatedSourcePath
9595
}
9696

97-
task deleteGeneratedSource << {
98-
project.delete project.fileTree(dir: generatedSourcePath)
97+
sourceSets.each { sourceSet ->
98+
task "deleteGeneratedSource${sourceSet.name}" << {
99+
project.delete project.fileTree(dir: generatedSourcePath + '/' + sourceSet.name)
100+
}
99101
}
100102
} else {
101103
// Otherwise, we just use the checked-in generated code.

0 commit comments

Comments
 (0)