public BuildFinishedStatus getRunResult()

in fxcop-agent/src/jetbrains/buildServer/fxcop/agent/FxCopBuildService.java [118:177]


  public BuildFinishedStatus getRunResult(final int exitCode) {
    String failMessage = null;

    if (exitCode != 0) {
      final EnumSet<FxCopReturnCode> errors = FxCopReturnCode.decodeReturnCode(exitCode);
      StringBuilder exitCodeStr = new StringBuilder("FxCop return code (" + exitCode + "):");
      for (FxCopReturnCode rc : errors) {
        exitCodeStr.append(" ").append(rc.name());
      }

      getLogger().warning(exitCodeStr.toString());

      if (errors.contains(FxCopReturnCode.BUILD_BREAKING_MESSAGE)) {
        failMessage = "FxCop return code contains 'Build breaking message'";
      }

      if (errors.contains(FxCopReturnCode.COMMAND_LINE_SWITCH_ERROR)) {
        failMessage = exitCodeStr.toString();
      }

      if (errors.contains(FxCopReturnCode.ANALYSIS_ERROR) ||
          errors.contains(FxCopReturnCode.ASSEMBLY_LOAD_ERROR) ||
          errors.contains(FxCopReturnCode.ASSEMBLY_REFERENCES_ERROR) ||
          errors.contains(FxCopReturnCode.PROJECT_LOAD_ERROR) ||
          errors.contains(FxCopReturnCode.RULE_LIBRARY_LOAD_ERROR) ||
          errors.contains(FxCopReturnCode.UNKNOWN_ERROR) ||
          errors.contains(FxCopReturnCode.OUTPUT_ERROR)) {
        boolean failOnAnalysisErrors = isParameterEnabled(FxCopConstants.SETTINGS_FAIL_ON_ANALYSIS_ERROR);

        if (failOnAnalysisErrors) {
          failMessage = exitCodeStr.toString();
        } else {
          getLogger().warning("Analysis errors ignored as 'Fail on analysis errors' option unchecked");
        }
      }
    }

    if (myXmlReportFile.exists()) {
      myArtifactsWatcher.addNewArtifactsPath(myXmlReportFile.getPath() + "=>" + ArtifactsUtil.getInternalArtifactPath(""));

      try {
        importInspectionResults();
        generateHtmlReport();
      } catch (Exception e) {
        getLogger().error("Exception while importing fxcop results: " + e);
        failMessage = "FxCop results import error";
      }
    } else {
      if (failMessage == null) {
        failMessage = "Output xml from FxCop is not found";
      }
    }

    if (failMessage != null) {
      logBuildProblem(BuildProblemData.createBuildProblem(String.valueOf(exitCode), FxCopConstants.RUNNER_TYPE, failMessage));
      return BuildFinishedStatus.FINISHED_WITH_PROBLEMS;
    }

    return BuildFinishedStatus.FINISHED_SUCCESS;
  }