fixed problem mentioned in CR-IC-3742

This commit is contained in:
nik
2013-12-20 19:13:48 +04:00
parent 77792a3770
commit 7e9eaf963b
2 changed files with 11 additions and 7 deletions
@@ -207,9 +207,9 @@ public class BuildOperations {
public static boolean deleteRecursively(@NotNull String path, @NotNull Collection<String> deletedPaths, @Nullable Set<File> parentDirs) {
File file = new File(path);
boolean deleted = deleteRecursively(file, deletedPaths);
if (deleted) {
if (deleted && parentDirs != null) {
File parent = file.getParentFile();
if (parent != null && parentDirs != null) {
if (parent != null) {
parentDirs.add(parent);
}
}
@@ -446,7 +446,9 @@ public class IncProjectBuilder {
for (String out : outs) {
BuildOperations.deleteRecursively(out, deletedPaths, dirsToDelete);
}
context.processMessage(new FileDeletedEvent(deletedPaths));
if (!deletedPaths.isEmpty()) {
context.processMessage(new FileDeletedEvent(deletedPaths));
}
}
}
registerTargetsWithClearedOutput(context, Collections.singletonList(target));
@@ -959,18 +961,20 @@ public class IncProjectBuilder {
for (String deletedSource : pathsForIteration) {
// deleting outputs corresponding to non-existing source
final Collection<String> outputs = sourceToOutputStorage.getOutputs(deletedSource);
List<String> deletedOutputPaths = new ArrayList<String>();
if (outputs != null && !outputs.isEmpty()) {
List<String> deletedOutputPaths = new ArrayList<String>();
for (String output : outputs) {
final boolean deleted = BuildOperations.deleteRecursively(output, deletedOutputPaths, shouldPruneEmptyDirs ? dirsToDelete : null);
if (deleted) {
doneSomething = true;
}
}
if (logger.isEnabled()) {
logger.logDeletedFiles(deletedOutputPaths);
if (!deletedOutputPaths.isEmpty()) {
if (logger.isEnabled()) {
logger.logDeletedFiles(deletedOutputPaths);
}
context.processMessage(new FileDeletedEvent(deletedOutputPaths));
}
context.processMessage(new FileDeletedEvent(deletedOutputPaths));
}
if (target instanceof ModuleBuildTarget) {