Skip to content

Commit

Permalink
Use sync instead of delete-then-copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Jan 22, 2025
1 parent 2810499 commit 0cd9e08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/main/groovy/com/google/protobuf/gradle/CopyActionFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
interface CopyActionFacade {
WorkResult copy(Action<? super CopySpec> var1);
WorkResult delete(Action<? super DeleteSpec> action);
WorkResult sync(Action<? super CopySpec> var1);

@CompileStatic
final class Loader {
Expand Down Expand Up @@ -79,6 +80,11 @@ public WorkResult copy(Action<? super CopySpec> action) {
public WorkResult delete(Action<? super DeleteSpec> action) {
return project.delete(action);
}

@Override
public WorkResult sync(Action<? super CopySpec> action) {
return project.sync(action);
}
}

@CompileStatic
Expand All @@ -95,5 +101,10 @@ public WorkResult copy(Action<? super CopySpec> action) {
public WorkResult delete(Action<? super DeleteSpec> action) {
return getFileSystemOperations().delete(action);
}

@Override
public WorkResult sync(Action<? super CopySpec> action) {
return getFileSystemOperations().sync(action);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ abstract class ProtobufExtract extends DefaultTask {

@TaskAction
public void extract() {
copyActionFacade.delete { spec ->
spec.delete(destDir)
}
copyActionFacade.copy { spec ->
copyActionFacade.sync { spec ->
spec.includeEmptyDirs = false
spec.from(inputProtoFiles)
spec.into(destDir)
Expand Down

0 comments on commit 0cd9e08

Please sign in to comment.