force running compiler in a non-AWT thread in test mode

This commit is contained in:
Eugene Zhuravlev
2012-10-14 23:12:00 +02:00
parent e545cbbcba
commit 08fbec4816
4 changed files with 9 additions and 7 deletions
@@ -213,7 +213,7 @@ public class CompileDriver {
}
scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);
final CompilerTask task = new CompilerTask(myProject, "Classes up-to-date check", true);
final CompilerTask task = new CompilerTask(myProject, "Classes up-to-date check", true, false);
final CompileContextImpl compileContext = new CompileContextImpl(myProject, task, scope, createDependencyCache(), true, false);
checkCachesVersion(compileContext, ((PersistentFS)ManagingFS.getInstance()).getCreationTimestamp());
@@ -549,7 +549,7 @@ public class CompileDriver {
final String contentName =
forceCompile ? CompilerBundle.message("compiler.content.name.compile") : CompilerBundle.message("compiler.content.name.make");
final CompilerTask compileTask = new CompilerTask(myProject, contentName, ApplicationManager.getApplication().isUnitTestMode());
final CompilerTask compileTask = new CompilerTask(myProject, contentName, ApplicationManager.getApplication().isUnitTestMode(), true);
StatusBar.Info.set("", myProject, "Compiler");
if (useExtProcessBuild && BuildManager.getInstance().rescanRequired(myProject)) {
@@ -2168,7 +2168,7 @@ public class CompileDriver {
public void executeCompileTask(final CompileTask task, final CompileScope scope, final String contentName, final Runnable onTaskFinished) {
final CompilerTask progressManagerTask =
new CompilerTask(myProject, contentName, false);
new CompilerTask(myProject, contentName, false, false);
final CompileContextImpl compileContext = new CompileContextImpl(myProject, progressManagerTask, scope, null, false, false);
FileDocumentManager.getInstance().saveAllDocuments();
@@ -79,6 +79,7 @@ public class CompilerTask extends Task.Backgroundable {
private final Object myMessageViewLock = new Object();
private final String myContentName;
private final boolean myHeadlessMode;
private final boolean myForceAsyncExecution;
private int myErrorCount = 0;
private int myWarningCount = 0;
private boolean myMessagesAutoActivated = false;
@@ -88,10 +89,11 @@ public class CompilerTask extends Task.Backgroundable {
private final AtomicBoolean myMessageViewWasPrepared = new AtomicBoolean(false);
private Runnable myRestartWork;
public CompilerTask(@NotNull Project project, String contentName, final boolean headlessMode) {
public CompilerTask(@NotNull Project project, String contentName, final boolean headlessMode, boolean forceAsync) {
super(project, contentName);
myContentName = contentName;
myHeadlessMode = headlessMode;
myForceAsyncExecution = forceAsync;
}
public void setContentIdKey(Key<Key<?>> contentIdKey) {
@@ -465,7 +467,7 @@ public class CompilerTask extends Task.Backgroundable {
}
public boolean isHeadless() {
return myHeadlessMode;
return myHeadlessMode && !myForceAsyncExecution;
}
private boolean isHeadlessMode() {