From 90c856f6ebedcad13a48980198debca65941b566 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Tue, 5 Sep 2023 08:10:29 -0700 Subject: [PATCH] Clean output directory before extracting protos If the dependencies change, the old dependency's proto files can be left around. That is broken and causes confusion. This was noticed in #731 when a `gradle clean` was needed. --- .../groovy/com/google/protobuf/gradle/ProtobufExtract.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/groovy/com/google/protobuf/gradle/ProtobufExtract.groovy b/src/main/groovy/com/google/protobuf/gradle/ProtobufExtract.groovy index e27715e2..514900e7 100644 --- a/src/main/groovy/com/google/protobuf/gradle/ProtobufExtract.groovy +++ b/src/main/groovy/com/google/protobuf/gradle/ProtobufExtract.groovy @@ -84,6 +84,9 @@ abstract class ProtobufExtract extends DefaultTask { @TaskAction public void extract() { + copyActionFacade.delete { spec -> + spec.delete(destDir) + } copyActionFacade.copy { spec -> spec.includeEmptyDirs = false spec.from(inputProtoFiles)