Skip to content

Commit

Permalink
added delete output directory flag to disable deletion before build t…
Browse files Browse the repository at this point in the history
…o allow output to be set to project dir itself
  • Loading branch information
Frisch12 committed Jun 20, 2022
1 parent b04ff31 commit 7092bca
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public class PlantumlTask extends SourceTask {
@Input
private final Property<String> includePattern = getProject().getObjects().property(String.class).convention("**/*.puml");

@Getter
@Input
private final Property<Boolean> deleteOutputBeforeBuild = getProject().getObjects().property(Boolean.class).convention(true);

@Inject
public PlantumlTask(WorkerExecutor workerExecutor, FileSystemOperations fileSystemOperations) {
this.fileSystemOperations = fileSystemOperations;
Expand All @@ -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);
Expand Down

0 comments on commit 7092bca

Please sign in to comment.