use of org.apache.ivy.core.resolve.IvyNode in project ant-ivy by apache.
the class XmlReportWriter method output.
public void output(ConfigurationResolveReport report, String[] confs, OutputStream stream) {
OutputStreamWriter encodedOutStream;
try {
encodedOutStream = new OutputStreamWriter(stream, REPORT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(REPORT_ENCODING + " is not known on your jvm", e);
}
PrintWriter out = new PrintWriter(new BufferedWriter(encodedOutStream));
ModuleRevisionId mrid = report.getModuleDescriptor().getModuleRevisionId();
// out.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
out.println("<?xml version=\"1.0\" encoding=\"" + REPORT_ENCODING + "\"?>");
out.println("<?xml-stylesheet type=\"text/xsl\" href=\"ivy-report.xsl\"?>");
out.println("<ivy-report version=\"1.0\">");
out.println("\t<info");
out.println("\t\torganisation=\"" + XMLHelper.escape(mrid.getOrganisation()) + "\"");
out.println("\t\tmodule=\"" + XMLHelper.escape(mrid.getName()) + "\"");
out.println("\t\trevision=\"" + XMLHelper.escape(mrid.getRevision()) + "\"");
if (mrid.getBranch() != null) {
out.println("\t\tbranch=\"" + XMLHelper.escape(mrid.getBranch()) + "\"");
}
out.println(extraToString(mrid.getExtraAttributes(), "\t\t"));
out.println("\t\tconf=\"" + XMLHelper.escape(report.getConfiguration()) + "\"");
out.println("\t\tconfs=\"" + XMLHelper.escape(joinArray(confs, ", ")) + "\"");
out.println("\t\tdate=\"" + DateUtil.format(report.getDate()) + "\"/>");
out.println("\t<dependencies>");
// create a list of ModuleRevisionIds indicating the position for each dependency
List<ModuleRevisionId> dependencies = new ArrayList<>(report.getModuleRevisionIds());
for (ModuleId mid : report.getModuleIds()) {
out.println("\t\t<module organisation=\"" + XMLHelper.escape(mid.getOrganisation()) + "\"" + " name=\"" + XMLHelper.escape(mid.getName()) + "\">");
for (IvyNode dep : report.getNodes(mid)) {
outputRevision(report, out, dependencies, dep);
}
out.println("\t\t</module>");
}
out.println("\t</dependencies>");
out.println("</ivy-report>");
out.flush();
}
Aggregations