}
private void executeCompileTask(final CompileScope scope, final boolean isRebuild, final boolean forceCompile, final CompileStatusNotification callback, final CompilerMessage message, final boolean checkCachesVersion, CompilerTask compileTask, final CompileContextImpl compileContext) {
final Runnable compileWork = new Runnable() {
public void run() {
final ProgressIndicator indicator = compileContext.getProgressIndicator();
if (indicator.isCanceled() || myProject.isDisposed()) {
if (callback != null) {
callback.finished(true, 0, 0, compileContext);
}
return;
}
try {
LOG.info("RUST COMPILATION STARTED (BUILD PROCESS)");
if (message != null) {
compileContext.addMessage(message);
}
if (isRebuild) {
CompilerUtil.runInContext(compileContext, "Clearing build system data...", new ThrowableRunnable<Throwable>() {
@Override
public void run() throws Throwable {
CompilerCacheManager.getInstance(myProject).clearCaches(compileContext);
}
});
}
final boolean beforeTasksOk = executeCompileTasks(compileContext, true);
final int errorCount = compileContext.getMessageCount(CompilerMessageCategory.ERROR);
if (!beforeTasksOk || errorCount > 0) {
COMPILE_SERVER_BUILD_STATUS.set(compileContext, errorCount > 0? ExitStatus.ERRORS : ExitStatus.CANCELLED);
return;
}
final RequestFuture future = compileInExternalProcess(compileContext, false);
if (future != null) {
while (!future.waitFor(200L , TimeUnit.MILLISECONDS)) {
if (indicator.isCanceled()) {
future.cancel(false);
}
}
if (!executeCompileTasks(compileContext, false)) {
COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.CANCELLED);