Ejemplo n.º 1
0
 private static void retainOnlyJarsAndDirectories(List<VirtualFile> woSdk) {
   for (Iterator<VirtualFile> iterator = woSdk.iterator(); iterator.hasNext(); ) {
     VirtualFile file = iterator.next();
     final VirtualFile local = ArchiveVfsUtil.getVirtualFileForJar(file);
     final boolean dir = file.isDirectory();
     final String name = file.getName();
     if (LOG.isDebugEnabled()) {
       LOG.debug(
           "Considering: "
               + file.getPath()
               + "; local="
               + local
               + "; dir="
               + dir
               + "; name="
               + name);
     }
     if (dir || local != null) {
       continue;
     }
     if (name.endsWith(".jar")) {
       continue;
     }
     LOG.debug("Removing");
     iterator.remove();
   }
 }
Ejemplo n.º 2
0
  @NotNull
  public GeneralCommandLine createCommand(
      @NotNull Module module,
      @Nullable String jvmParams,
      boolean forCreation,
      @NotNull MvcCommand command)
      throws ExecutionException {
    final JavaParameters params =
        createJavaParameters(module, forCreation, false, true, jvmParams, command);
    addJavaHome(params, module);

    final GeneralCommandLine commandLine = createCommandLine(params);

    final VirtualFile griffonHome = getSdkRoot(module);
    if (griffonHome != null) {
      commandLine
          .getEnvironment()
          .put(getSdkHomePropertyName(), FileUtil.toSystemDependentName(griffonHome.getPath()));
    }

    final VirtualFile root = findAppRoot(module);
    final File ioRoot =
        root != null ? VfsUtilCore.virtualToIoFile(root) : new File(module.getModuleDirPath());
    commandLine.setWorkDirectory(forCreation ? ioRoot.getParentFile() : ioRoot);

    return commandLine;
  }
Ejemplo n.º 3
0
 @NotNull
 public static Collection<VcsDirectoryMapping> findRoots(
     @NotNull VirtualFile rootDir, @NotNull Project project) throws IllegalArgumentException {
   if (!rootDir.isDirectory()) {
     throw new IllegalArgumentException(
         "Can't find VCS at the target file system path. Reason: expected to find a directory there but it's not. The path: "
             + rootDir.getParent());
   }
   Collection<VcsRoot> roots =
       ServiceManager.getService(project, VcsRootDetector.class).detect(rootDir);
   Collection<VcsDirectoryMapping> result = ContainerUtilRt.newArrayList();
   for (VcsRoot vcsRoot : roots) {
     VirtualFile vFile = vcsRoot.getPath();
     AbstractVcs rootVcs = vcsRoot.getVcs();
     if (rootVcs != null && vFile != null) {
       result.add(new VcsDirectoryMapping(vFile.getPath(), rootVcs.getName()));
     }
   }
   return result;
 }