public ProgramCommandLine makeProgramCommandLine()

in fxcop-agent/src/jetbrains/buildServer/fxcop/agent/FxCopBuildService.java [186:228]


  public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
    final Map<String, String> runParameters = getRunnerParameters();

    List<String> files = new ArrayList<String>();
    final String what = runParameters.get(FxCopConstants.SETTINGS_WHAT_TO_INSPECT);
    if (FxCopConstants.WHAT_TO_INSPECT_FILES.equals(what)) {
      files = matchFiles();

      if (files.size() == 0) {
        throw new RunBuildException("No files matched the pattern");
      }
    }

    final List<String> finalFiles = files;

    final FxCopCommandLineBuilder commandLineBuilder = new FxCopCommandLineBuilder(runParameters, getBuildParameters().getAllParameters(),  myXmlReportFile, getLogger());
    return new ProgramCommandLine() {
      @NotNull
      public String getExecutablePath() throws RunBuildException {
        return commandLineBuilder.getExecutablePath();
      }

      @NotNull
      public String getWorkingDirectory() throws RunBuildException {
        return getCheckoutDirectory().getPath();
      }

      @Override
      public String getCommandLineForLogging(PasswordReplacer passwordReplacer) throws RunBuildException {
        return getExecutablePath() + " " + commandLineBuilder.getArgsForLogging(finalFiles);
      }

      @NotNull
      public List<String> getArguments() throws RunBuildException {
        return commandLineBuilder.getArguments(finalFiles);
      }

      @NotNull
      public Map<String, String> getEnvironment() throws RunBuildException {
        return getBuildParameters().getEnvironmentVariables();
      }
    };
  }