From 7092bca7a98d217d65248980256b581d8b654447 Mon Sep 17 00:00:00 2001 From: Dennis Fricke Date: Mon, 20 Jun 2022 10:04:31 +0200 Subject: [PATCH] added delete output directory flag to disable deletion before build to allow output to be set to project dir itself --- .../io/freefair/gradle/plugins/plantuml/PlantumlTask.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plantuml-plugin/src/main/java/io/freefair/gradle/plugins/plantuml/PlantumlTask.java b/plantuml-plugin/src/main/java/io/freefair/gradle/plugins/plantuml/PlantumlTask.java index b3841cf5..e7a32434 100644 --- a/plantuml-plugin/src/main/java/io/freefair/gradle/plugins/plantuml/PlantumlTask.java +++ b/plantuml-plugin/src/main/java/io/freefair/gradle/plugins/plantuml/PlantumlTask.java @@ -42,6 +42,10 @@ public class PlantumlTask extends SourceTask { @Input private final Property includePattern = getProject().getObjects().property(String.class).convention("**/*.puml"); + @Getter + @Input + private final Property deleteOutputBeforeBuild = getProject().getObjects().property(Boolean.class).convention(true); + @Inject public PlantumlTask(WorkerExecutor workerExecutor, FileSystemOperations fileSystemOperations) { this.fileSystemOperations = fileSystemOperations; @@ -52,7 +56,9 @@ public PlantumlTask(WorkerExecutor workerExecutor, FileSystemOperations fileSyst @TaskAction public void execute() { - fileSystemOperations.delete(deleteSpec -> deleteSpec.delete(outputDirectory)); + if(deleteOutputBeforeBuild.get()) { + fileSystemOperations.delete(deleteSpec -> deleteSpec.delete(outputDirectory)); + } WorkQueue workQueue = workerExecutor.processIsolation(process -> { process.getClasspath().from(plantumlClasspath);