List<CompilerMessage> (@NotNull Consumer<? super CompileStatusNotification> runnable) { final Semaphore semaphore = new Semaphore(); semaphore.down(); ErrorReportingCallback callback = new ErrorReportingCallback(semaphore); PlatformTestUtil.saveProject(getProject(), false); CompilerTestUtil.saveApplicationSettings(); EdtTestUtil.runInEdtAndWait(() -> { // for now directory based project is used for external storage if (!ProjectKt.isDirectoryBased(myProject)) { for (Module module : myModules) { Path ioFile = module.getModuleNioFile(); assert Files.exists(ioFile) : "File does not exist: " + ioFile; } } PathMacros pathMacroManager = PathMacros.getInstance(); Map<String, String> userMacros = pathMacroManager.getUserMacros(); if (!userMacros.isEmpty()) { // require to be presented on disk Path macroFilePath = getPersistentStateComponentStorageLocation(pathMacroManager.getClass()); assertNotNull(macroFilePath); if (!Files.exists(macroFilePath)) { String message = "File " + macroFilePath + " doesn't exist, but user macros defined: " + userMacros; // todo find out who deletes this file during tests LOG.warn(message); String fakeMacroName = "__remove_me__"; IComponentStore appStore = ServiceKt.getStateStore(ApplicationManager.getApplication()); pathMacroManager.setMacro(fakeMacroName, fakeMacroName); appStore.saveComponent((PersistentStateComponent<?>)pathMacroManager); pathMacroManager.setMacro(fakeMacroName, null); appStore.saveComponent((PersistentStateComponent<?>)pathMacroManager); if (!Files.exists(macroFilePath)) { throw new AssertionError(message); } } } enableDebugLogging(); runnable.consume(callback); }); // tests run in awt while (!semaphore.waitFor(100)) { if (SwingUtilities.isEventDispatchThread()) { //noinspection TestOnlyProblems UIUtil.dispatchAllInvocationEvents(); } } printBuildLog(); callback.throwException(); if (!((CompilerManagerImpl)CompilerManager.getInstance(getProject())).waitForExternalJavacToTerminate(1, TimeUnit.MINUTES)) { throw new RuntimeException("External javac thread is still running. Thread dump:" + ThreadDumper.dumpThreadsToString()); } checkVfsNotLoadedForOutput(); return callback.getMessages(); }