@Override public void recalculateOutputDirs() { final Module[] allModules = ModuleManager.getInstance(myProject).getModules(); final Set<VirtualFile> allDirs = new OrderedSet<VirtualFile>(); final Set<VirtualFile> testOutputDirs = new java.util.HashSet<VirtualFile>(); final Set<VirtualFile> productionOutputDirs = new java.util.HashSet<VirtualFile>(); CompilerPathsManager pathsManager = CompilerPathsManager.getInstance(getProject()); for (Module module : allModules) { final VirtualFile output = pathsManager.getCompilerOutput(module, ProductionContentFolderTypeProvider.getInstance()); if (output != null && output.isValid()) { allDirs.add(output); productionOutputDirs.add(output); } final VirtualFile testsOutput = pathsManager.getCompilerOutput(module, TestContentFolderTypeProvider.getInstance()); if (testsOutput != null && testsOutput.isValid()) { allDirs.add(testsOutput); testOutputDirs.add(testsOutput); } } myOutputDirectories = VfsUtil.toVirtualFileArray(allDirs); // need this to ensure that the sent contains only _dedicated_ test output dirs // Directories that are configured for both test and production classes must not be added in the // resulting set testOutputDirs.removeAll(productionOutputDirs); myTestOutputDirectories = Collections.unmodifiableSet(testOutputDirs); }
private static void removeModuleOutput(Module module, List<VirtualFile> from) { CompilerPathsManager compilerPathsManager = CompilerPathsManager.getInstance(module.getProject()); for (ContentFolderType contentFolderType : ContentFolderType.ALL_SOURCE_ROOTS) { from.remove(compilerPathsManager.getCompilerOutput(module, contentFolderType)); } }