From 707c27c6e9d727e1dbd2a96072be450cdc6a79c2 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Thu, 27 Sep 2012 16:38:48 +0200 Subject: [PATCH] when rebuilding project delete the contents of output roots and not roots directly to avoid unnecessary "roots changed" events in IDEA --- .../jetbrains/jps/incremental/IncProjectBuilder.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java index dfa43513ca09..48c6268b94ee 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java @@ -363,7 +363,11 @@ public class IncProjectBuilder { } } if (okToDelete) { - filesToDelete.add(outputRoot); + // do not delete output root itself to avoid lots of unnecessary "roots_changed" events in IDEA + final File[] children = outputRoot.listFiles(); + if (children != null) { + filesToDelete.addAll(Arrays.asList(children)); + } } else { context.processMessage(new CompilerMessage(BUILD_NAME, BuildMessage.Kind.WARNING, "Output path " + outputRoot.getPath() + " intersects with a source root. The output cannot be cleaned.")); @@ -375,7 +379,11 @@ public class IncProjectBuilder { } for (File annotationOutput : annotationOutputs) { - filesToDelete.add(annotationOutput); + // do not delete output root itself to avoid lots of unnecessary "roots_changed" events in IDEA + final File[] children = annotationOutput.listFiles(); + if (children != null) { + filesToDelete.addAll(Arrays.asList(children)); + } } context.processMessage(new ProgressMessage("Cleaning output directories..."));