From 4c13b978273bd915c7edc00e9cd1ba6d72791182 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Thu, 3 May 2012 12:24:28 +0200 Subject: [PATCH] the right fix for groovy test --- .../intellij/compiler/impl/CompileDriver.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java index f58aaba2a1ca..1ea2de317799 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java @@ -1309,19 +1309,33 @@ public class CompileDriver { } dumbService.waitForSmartMode(); - + if (snapshot == null || ContainerUtil.intersects(generatedTypes, compilerManager.getRegisteredInputTypes(compiler))) { // rescan snapshot if previously generated files may influence the input of this compiler + final Set prevSnapshot = round > 0 && snapshot != null? new HashSet(Arrays.asList(snapshot)) : Collections.emptySet(); snapshot = ApplicationManager.getApplication().runReadAction(new Computable() { public VirtualFile[] compute() { return context.getCompileScope().getFiles(null, true); } }); recalculateChunkToFilesMap(context, sortedChunks, snapshot, chunkMap); - chunkFiles = chunkMap.get(currentChunk); + if (round == 0) { + chunkFiles = chunkMap.get(currentChunk); + } + else { + final Set newFiles = new HashSet(chunkMap.get(currentChunk)); + newFiles.removeAll(prevSnapshot); + newFiles.removeAll(chunkFiles); + if (!newFiles.isEmpty()) { + final ArrayList merged = new ArrayList(chunkFiles.size() + newFiles.size()); + merged.addAll(chunkFiles); + merged.addAll(newFiles); + chunkFiles = merged; + } + } total = snapshot.length * translatorsLength; } - + final CompileContextEx _context; if (compiler instanceof IntermediateOutputCompiler) { // wrap compile context so that output goes into intermediate directories