android: refresh generated source roots

This commit is contained in:
Eugene Kudelevsky
2012-04-02 23:18:34 +04:00
parent 8fd3793698
commit 0db813abaf
4 changed files with 21 additions and 2 deletions
@@ -85,6 +85,8 @@ public class AndroidAptCompiler implements SourceGeneratingCompiler {
private static GenerationItem[] doGenerate(final CompileContext context, GenerationItem[] items, VirtualFile outputRootDirectory) {
List<GenerationItem> results = new ArrayList<GenerationItem>(items.length);
boolean toRefresh = false;
for (GenerationItem item : items) {
if (item instanceof AptGenerationItem) {
final AptGenerationItem aptItem = (AptGenerationItem)item;
@@ -101,7 +103,7 @@ public class AndroidAptCompiler implements SourceGeneratingCompiler {
aptItem.myManifestFile.getPath(), aptItem.myPackage,
outputDirOsPath, aptItem.myResourcesPaths,
aptItem.myLibraryPackages, aptItem.myIsLibrary));
toRefresh = true;
AndroidCompileUtil.addMessages(context, messages);
if (messages.get(CompilerMessageCategory.ERROR).isEmpty()) {
results.add(aptItem);
@@ -118,6 +120,10 @@ public class AndroidAptCompiler implements SourceGeneratingCompiler {
}
}
}
if (toRefresh) {
outputRootDirectory.refresh(false, true);
}
return results.toArray(new GenerationItem[results.size()]);
}
@@ -183,6 +183,8 @@ public class AndroidIdlCompiler implements SourceGeneratingCompiler {
return EMPTY_GENERATION_ITEM_ARRAY;
}
List<GenerationItem> results = new ArrayList<GenerationItem>(items.length);
boolean toRefresh = false;
for (GenerationItem item : items) {
if (item instanceof IdlGenerationItem) {
final IdlGenerationItem idlItem = (IdlGenerationItem)item;
@@ -209,6 +211,7 @@ public class AndroidIdlCompiler implements SourceGeneratingCompiler {
}
});
if (messages.get(CompilerMessageCategory.ERROR).isEmpty()) {
toRefresh = true;
results.add(idlItem);
}
}
@@ -222,6 +225,10 @@ public class AndroidIdlCompiler implements SourceGeneratingCompiler {
}
}
}
if (toRefresh) {
outputRootDirectory.refresh(false, true);
}
return results.toArray(new GenerationItem[results.size()]);
}
@@ -163,12 +163,13 @@ public class AndroidIncludingCompiler implements SourceGeneratingCompiler {
context.getProgressIndicator().setText(AndroidBundle.message("android.compile.messages.copying.sources.from.libraries"));
}
List<GenerationItem> result = new ArrayList<GenerationItem>();
boolean toRefresh = false;
for (GenerationItem item : items) {
if (!AndroidCompileUtil.isModuleAffected(context, ((MyItem)item).myModule)) {
continue;
}
toRefresh = true;
String fromPath = ((MyItem)item).mySourceFile.getPath();
File from = new File(fromPath);
File to = new File(outputRootDirectory.getPath() + '/' + item.getPath());
@@ -183,6 +184,10 @@ public class AndroidIncludingCompiler implements SourceGeneratingCompiler {
context.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
}
}
if (toRefresh) {
outputRootDirectory.refresh(false, true);
}
return result.toArray(new GenerationItem[result.size()]);
}
@@ -216,6 +216,7 @@ public class AndroidRenderscriptCompiler implements SourceGeneratingCompiler {
}
}
}
outputRootDirectory.refresh(false, true);
return results.toArray(new GenerationItem[results.size()]);
}