From 1fab0220a1b5764624c0962856469409c4c709ff Mon Sep 17 00:00:00 2001 From: Xavier Hanin Date: Fri, 20 Jan 2006 15:45:18 +0000 Subject: [PATCH] IMPROVE: generate xml report using ivy:report task (IVY-143) git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/trunk@484127 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + src/java/fr/jayasoft/ivy/ant/IvyReport.java | 33 ++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index dc447fc9..83202f89 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -12,6 +12,7 @@ - NEW: overwrite attribute in the publish task now let force overwrite of read only files (IVY-83) - NEW: add a conflict manager ("strict") making build fail when a diamond conflict is found (thanks to Christer Jonsson) (IVY-118) +- IMPROVE: generate xml report using ivy:report task (IVY-143) - IMPROVE: possibility to configure ivy so that special revisions are not queried as fixed one at all (IVY-139) - IMPROVE: better url querying management (IVY-138) (thanks to Bernard Niset) - IMPROVE: do not add resolver info in ivy files in cache so that they can be safely used as usual ivy files in a repository (IVY-137) diff --git a/src/java/fr/jayasoft/ivy/ant/IvyReport.java b/src/java/fr/jayasoft/ivy/ant/IvyReport.java index 98b4081e..a322aa20 100644 --- a/src/java/fr/jayasoft/ivy/ant/IvyReport.java +++ b/src/java/fr/jayasoft/ivy/ant/IvyReport.java @@ -25,6 +25,8 @@ public class IvyReport extends IvyTask { private String _conf; private File _cache; private boolean _graph = true; + private boolean _xml = false; + private boolean _xsl = true; private String _xslFile; private String _outputpattern; @@ -120,7 +122,12 @@ public class IvyReport extends IvyTask { try { String[] confs = splitConfs(_conf); for (int i = 0; i < confs.length; i++) { - genreport(ivy, _cache, _organisation, _module, confs[i]); + if (_xsl) { + genreport(ivy, _cache, _organisation, _module, confs[i]); + } + if (_xml) { + genxml(ivy, _cache, _organisation, _module, confs[i]); + } if (_graph) { gengraph(ivy, _cache, _organisation, _module, confs[i]); } @@ -130,6 +137,18 @@ public class IvyReport extends IvyTask { } } + private void genxml(Ivy ivy, File cache, String organisation, String module, String conf) throws IOException { + File xml = new File(cache, XmlReportOutputter.getReportFileName(new ModuleId(organisation, module), conf)); + + File out; + if (_todir != null) { + out = new File(_todir, xml.getName()); + } else { + out = new File(xml.getName()); + } + + FileUtil.copy(xml, out, null); + } private void genreport(Ivy ivy, File cache, String organisation, String module, String conf) throws IOException { // first process the report with xslt XSLTProcess xslt = new XSLTProcess(); @@ -205,6 +224,18 @@ public class IvyReport extends IvyTask { FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report-graph.xsl"), style, null); return style.getAbsolutePath(); } + protected boolean isXml() { + return _xml; + } + protected void setXml(boolean xml) { + _xml = xml; + } + protected boolean isXsl() { + return _xsl; + } + protected void setXsl(boolean xsl) { + _xsl = xsl; + }