Beispiel #1
0
 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));
   }
 }
  @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 String getOutputPath(CompileContext context, Chunk<Module> moduleChunk) {
   if (moduleChunk.getNodes().isEmpty()) {
     context.addMessage(
         CompilerMessageCategory.WARNING,
         "No module defined, running application might not function properly.",
         null,
         -1,
         -1);
     return CompilerPathsManager.getInstance(project).getCompilerOutput().getPath() + "/go-bins";
   } else {
     // TODO This is a hack to keep GoMakefileCompiler compatible with the way Runner expects
     // binaries, we
     // use any module assuming the path is the same for all
     Module firstModule = moduleChunk.getNodes().iterator().next();
     return context.getModuleOutputDirectory(firstModule).getPath() + "/go-bins";
   }
 }
 @Nullable
 @Override
 public VirtualFile getOutputForFile(Module module, ContentFolderTypeProvider contentFolderType) {
   return CompilerPathsManager.getInstance(myProject).getCompilerOutput(module, contentFolderType);
 }