Exemplo n.º 1
0
  public static int merge(String[] args) {
    Header.print(System.out);

    try {
      args = CommandLineBuilder.preprocessCommandLineArguments(args);
    } catch (Exception ex) {
      System.err.println("Error: Cannot process arguments: " + ex.getMessage());
      return 1;
    }
    new MergeMain(args);
    return 0;
  }
  public XMLReport(
      ProjectData projectData,
      File destinationDir,
      FileFinder finder,
      ComplexityCalculator complexity)
      throws IOException {
    this.complexity = complexity;
    this.finder = finder;

    File file = new File(destinationDir, "coverage.xml");
    pw = IOUtil.getPrintWriter(file);

    try {
      println("<?xml version=\"1.0\"?>");
      println(
          "<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/"
              + coverageDTD
              + "\">");
      println("");

      // TODO: Set a schema?
      // println("<coverage " + sourceDirectories.toString() + "
      // xmlns=\"http://cobertura.sourceforge.net\"
      // xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
      // xsi:schemaLocation=\"http://cobertura.sourceforge.net/xml/coverage.xsd\">");
      println(
          "<coverage line-rate=\""
              + projectData.getLineCoverageRate()
              + "\" branch-rate=\""
              + projectData.getBranchCoverageRate()
              + "\" version=\""
              + Header.version()
              + "\" timestamp=\""
              + new Date().getTime()
              + "\">");

      increaseIndentation();
      dumpSources();
      dumpPackages(projectData);
      decreaseIndentation();
      println("</coverage>");
    } finally {
      pw.close();
    }
  }