Examples of GeneralCommandLine


Examples of com.intellij.execution.configurations.GeneralCommandLine

        ProcessTerminatedListener.attach(osProcessHandler);
        return osProcessHandler;
    }

    private GeneralCommandLine generateCommandLine() {
        GeneralCommandLine commandLine = new GeneralCommandLine();
        commandLine.setExePath(runConfiguration.getInterpreterPath());
        commandLine.getParametersList().addParametersString("/c");
        commandLine.getParametersList().addParametersString(runConfiguration.getInterpreterOptions());
        if (!StringUtil.isEmptyOrSpaces(runConfiguration.getScriptName())) {
            commandLine.addParameter(runConfiguration.getScriptName());
        }

        commandLine.getParametersList().addParametersString(runConfiguration.getScriptParameters());
        if (!StringUtil.isEmptyOrSpaces(runConfiguration.getWorkingDirectory())) {
            commandLine.setWorkDirectory(runConfiguration.getWorkingDirectory());
        }

        commandLine.setEnvParams(runConfiguration.getEnvs());
        commandLine.setPassParentEnvs(runConfiguration.isPassParentEnvs());
        return commandLine;
    }
View Full Code Here

Examples of com.intellij.execution.configurations.GeneralCommandLine

        this.myParameters = parameters;
    }

    @Override
    protected OSProcessHandler startProcess() throws ExecutionException {
        GeneralCommandLine commandLine = new GeneralCommandLine();
        commandLine.setExePath(mySettings.leiningenPath);
        commandLine.addParameters(myParameters.getGoals());
        commandLine.setWorkDirectory(myParameters.getWorkingDirectory());
        return new ColoredProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString(),
                EncodingManager.getInstance().getDefaultCharset());
    }
View Full Code Here

Examples of com.intellij.execution.configurations.GeneralCommandLine

  }

  public static GeneralCommandLine getRebarCommandLine(@NotNull RebarRunConfigurationBase configuration) {
    Project project = configuration.getProject();
    RebarSettings rebarSettings = RebarSettings.getInstance(project);
    GeneralCommandLine commandLine = new GeneralCommandLine();

    commandLine.setWorkDirectory(getWorkingDirectory(configuration));
    commandLine.setExePath(rebarSettings.getRebarPath());

    List<String> split = ContainerUtil.list(configuration.getCommand().split("\\s+"));
    if (configuration.isSkipDependencies() && !split.contains("skip_deps=true")) {
      commandLine.addParameter("skip_deps=true");
    }
    commandLine.addParameters(split);

    return commandLine;
  }
View Full Code Here

Examples of com.intellij.execution.configurations.GeneralCommandLine

                                               @NotNull String... arguments) throws ExecutionException {
    if (!new File(workDir).isDirectory() || !new File(exePath).canExecute()) {
      return new ProcessOutput();
    }

    GeneralCommandLine cmd = new GeneralCommandLine();
    cmd.setWorkDirectory(workDir);
    cmd.setExePath(exePath);
    cmd.addParameters(arguments);

    return execute(cmd, timeout);
  }
View Full Code Here

Examples of com.intellij.execution.configurations.GeneralCommandLine

  @Override
  public void compile(CompileContext context, Chunk<Module> moduleChunk, VirtualFile[] files, OutputSink outputSink) {
    context.getProgressIndicator().pushState();
    context.getProgressIndicator().setText("Hardcore compile action...");

    GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine.setWorkDirectory(PathUtil.getParentPath(context.getProject().getProjectFilePath()));
    commandLine.setPassParentEnvironment(true);

    for (Module module : moduleChunk.getNodes()) {
      ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);

      for (VirtualFile sourceRoot : moduleRootManager.getSourceRoots()) {
        commandLine.addParameter("-I");
        String path = sourceRoot.getCanonicalPath();
        if (path != null) {
          commandLine.addParameter(path);
        }
      }

      VirtualFile outDir = context.getModuleOutputDirectory(module);
      if (outDir == null) {
        context.addMessage(CompilerMessageCategory.ERROR, "No output dir for module: " + module.getName(), null, -1, -1);
        return;
      }
      commandLine.setWorkDirectory(outDir.getCanonicalPath());

      for (VirtualFile o : files) {
        String canonicalPath = o.getCanonicalPath();
        if (canonicalPath == null) continue;
        commandLine.addParameter(canonicalPath);
      }

//      commandLine.addParameters("+warn_unused_vars", "+nowarn_shadow_vars", "+warn_unused_import");

      Sdk sdk = moduleRootManager.getSdk();

      if (sdk == null) {
        context.addMessage(CompilerMessageCategory.ERROR, "No SDK for module: " + module.getName(), null, -1, -1);
        return;
      }

      if (sdk.getSdkType() != ErlangSdkType.getInstance()) {
        context.addMessage(CompilerMessageCategory.ERROR, "Not a Erlang SDK for module: " + module.getName(), null, -1, -1);
        return;
      }

      String sdkHomePath = sdk.getHomePath();

      if (sdkHomePath == null) {
        context.addMessage(CompilerMessageCategory.ERROR, "No home path for Erlang SDK: " + sdk.getName(), null, -1, -1);
        return;
      }

      String erlc = FileUtil.toSystemDependentName(JpsErlangSdkType.getByteCodeCompilerExecutable(sdkHomePath).getAbsolutePath());

      commandLine.setExePath(erlc);

//      System.out.println(commandLine.getCommandLineString());

      ProcessOutput output = null;
      try {
        output = new CapturingProcessHandler(commandLine.createProcess(), Charset.defaultCharset(), commandLine.getCommandLineString()).runProcess();
      } catch (ExecutionException e) {
        context.addMessage(CompilerMessageCategory.ERROR, "process throw exception: " + e.getMessage(), null, -1, -1);
      }

      if (output != null) {
View Full Code Here

Examples of com.intellij.execution.configurations.GeneralCommandLine

      }
    }

    String output = "";
    try {
      GeneralCommandLine which = new GeneralCommandLine("which");
      which.addParameter("rebar");
      output = ScriptRunnerUtil.getProcessOutput(which);
    } catch (Exception ignored) {
    }
    return output.trim();
  }
View Full Code Here

Examples of com.intellij.execution.configurations.GeneralCommandLine

  private static void fetchDependencies(@NotNull final VirtualFile projectRoot, @NotNull final String rebarPath) {
    ProgressManager.getInstance().run(new Task.Modal(ProjectImportBuilder.getCurrentProject(), "Fetching dependencies", true) {
      public void run(@NotNull final ProgressIndicator indicator) {
        indicator.setIndeterminate(true);
        GeneralCommandLine commandLine = new GeneralCommandLine();
        commandLine.setExePath(rebarPath);
        commandLine.setWorkDirectory(projectRoot.getCanonicalPath());
        commandLine.addParameter("get-deps");
        try {
          OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), commandLine.getPreparedCommandLine(Platform.current()));
          handler.addProcessListener(new ProcessAdapter() {
            @Override
            public void onTextAvailable(ProcessEvent event, Key outputType) {
              String text = event.getText();
              indicator.setText2(text);
View Full Code Here

Examples of com.intellij.execution.configurations.GeneralCommandLine

  }

  @NotNull
  @Override
  protected ProcessHandler startProcess() throws ExecutionException {
    GeneralCommandLine commandLine = RebarRunningStateUtil.getRebarCommandLine(myConfiguration);
    return RebarRunningStateUtil.runRebar(myConfiguration.getProject(), commandLine);
  }
View Full Code Here

Examples of org.intellij.erlang.jps.execution.GeneralCommandLine

  private static void runErlc(ErlangTarget target,
                              CompileContext context,
                              ErlangCompilerOptions compilerOptions,
                              File outputDirectory) throws ProjectBuildException {
    GeneralCommandLine commandLine = getErlcCommandLine(target, context, compilerOptions, outputDirectory);
    Process process;
    try {
      process = commandLine.createProcess();
    } catch (ExecutionException e) {
      throw new ProjectBuildException("Failed to launch erlang compiler", e);
    }
    BaseOSProcessHandler handler = new BaseOSProcessHandler(process, commandLine.getCommandLineString(), Charset.defaultCharset());
    ProcessAdapter adapter = new ErlangCompilerProcessAdapter(context, NAME, "");
    handler.addProcessListener(adapter);
    handler.startNotify();
    handler.waitFor();
  }
View Full Code Here

Examples of org.intellij.erlang.jps.execution.GeneralCommandLine

  private static GeneralCommandLine getErlcCommandLine(ErlangTarget target,
                                                       CompileContext context,
                                                       ErlangCompilerOptions compilerOptions,
                                                       File outputDirectory) throws ProjectBuildException {
    GeneralCommandLine commandLine = new GeneralCommandLine();

    JpsModule module = target.getModule();
    JpsSdk<JpsDummyElement> sdk = getSdk(context, module);
    File executable = JpsErlangSdkType.getByteCodeCompilerExecutable(sdk.getHomePath());
    List<String> erlangModulePaths = getErlangModulePaths(module, target, context);

    commandLine.setWorkDirectory(outputDirectory);
    commandLine.setExePath(executable.getAbsolutePath());
    addCodePath(commandLine, module, target, context);
    addParseTransforms(commandLine, module);
    addDebugInfo(commandLine, erlangModulePaths, outputDirectory, compilerOptions.myAddDebugInfoEnabled);
    addIncludePaths(commandLine, module);
    addMacroDefinitions(commandLine, target);
    commandLine.addParameters(erlangModulePaths);

    return commandLine;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.