From 52aa6232fb8f03461c25cb6ac5981d26882647fc Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Wed, 2 Apr 2014 16:43:38 +0400 Subject: [PATCH] IDEA-122078 Consider excluded output roots on output cleaning --- .../jps/incremental/IncProjectBuilder.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 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 d7f46af47437..7cf0a804f7c9 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java @@ -513,15 +513,20 @@ public class IncProjectBuilder { context.checkCanceled(); boolean okToDelete = true; final File outputRoot = entry.getKey(); - if (JpsPathUtil.isUnder(allSourceRoots, outputRoot)) { - okToDelete = false; - } - else { - final Set _outRoot = Collections.singleton(outputRoot); - for (File srcRoot : allSourceRoots) { - if (JpsPathUtil.isUnder(_outRoot, srcRoot)) { - okToDelete = false; - break; + if (!moduleIndex.isExcluded(outputRoot)) { + // if output root itself is directly or indirectly excluded, + // there cannot be any manageable sources under it, even if the output root is located under some source root + // so in this case it is safe to delete such root + if (JpsPathUtil.isUnder(allSourceRoots, outputRoot)) { + okToDelete = false; + } + else { + final Set _outRoot = Collections.singleton(outputRoot); + for (File srcRoot : allSourceRoots) { + if (JpsPathUtil.isUnder(_outRoot, srcRoot)) { + okToDelete = false; + break; + } } } }