in src/main/java/org/apache/easyant/tasks/PluginReport.java [146:206]
public void execute() throws BuildException {
IvySettings settings = getEasyAntIvyInstance().getSettings();
if (moduleIvy == null || !moduleIvy.exists()) {
throw new BuildException("moduleIvy attribute is not set or is not a file");
}
if (sourceDirectory == null || !sourceDirectory.exists()) {
throw new BuildException("sourceDirectory attribute is not set or doesn't exists");
}
conf = getProperty(conf, settings, "ivy.resolved.configurations");
if ("*".equals(conf)) {
conf = getProperty(settings, "ivy.resolved.configurations");
}
if (conf == null) {
throw new BuildException("no conf provided for ivy report task: "
+ "It can either be set explicitely via the attribute 'conf' or "
+ "via 'ivy.resolved.configurations' property or a prior call to <resolve/>");
}
if (todir == null) {
String t = getProperty(settings, "ivy.report.todir");
if (t != null) {
todir = getProject().resolveFile(t);
} else {
todir = getProject().getBaseDir();
}
}
if (todir != null && todir.exists()) {
todir.mkdirs();
}
outputpattern = getProperty(outputpattern, settings, "ivy.report.output.pattern");
if (outputpattern == null) {
outputpattern = "[organisation]-[module]-[conf].[ext]";
}
if (todir != null && todir.exists() && !todir.isDirectory()) {
throw new BuildException("destination directory should be a directory !");
}
PluginService pluginService = getProject().getReference(
EasyAntMagicNames.PLUGIN_SERVICE_INSTANCE);
OutputStream stream = null;
try {
EasyAntReport easyantReport = pluginService.getPluginInfo(moduleIvy, sourceDirectory, conf);
ModuleRevisionId moduleRevisionId = easyantReport.getModuleDescriptor().getModuleRevisionId();
File reportFile = new File(todir, getOutputPattern(moduleRevisionId, conf, "xml"));
todir.mkdirs();
stream = new FileOutputStream(reportFile);
XMLEasyAntReportWriter writer = new XMLEasyAntReportWriter();
writer.output(easyantReport, stream);
genStyled(reportFile, getReportStylePath(), easyantReport);
} catch (Exception e) {
throw new BuildException("impossible to generate report: " + e, e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// do nothing
}
}
}
}