use of org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData in project ant-ivy by apache.
the class IvyNode method markEvicted.
public void markEvicted(String rootModuleConf, IvyNode node, ConflictManager conflictManager, Collection<IvyNode> resolved) {
EvictionData evictionData = new EvictionData(rootModuleConf, node, conflictManager, resolved);
markEvicted(evictionData);
}
use of org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData in project ant-ivy by apache.
the class LogReportOutputter method output.
public void output(ResolveReport report, ResolutionCacheManager cacheMgr, ResolveOptions options) throws IOException {
IvySettings settings = IvyContext.getContext().getSettings();
if (settings.logModulesInUse() && ResolveOptions.LOG_DEFAULT.equals(options.getLog())) {
Message.info("\t:: modules in use:");
List<IvyNode> dependencies = new ArrayList<>(report.getDependencies());
Collections.sort(dependencies);
if (dependencies.size() > 0) {
String[] confs = report.getConfigurations();
for (IvyNode node : dependencies) {
if (node.isCompletelyEvicted() || node.hasProblem()) {
continue;
}
List<String> nodeConfs = new ArrayList<>(confs.length);
for (String conf : confs) {
if (report.getConfigurationReport(conf).getModuleRevisionIds().contains(node.getResolvedId())) {
nodeConfs.add(conf);
}
}
Message.info("\t" + node + " from " + node.getModuleRevision().getResolver().getName() + " in " + nodeConfs);
}
}
}
IvyNode[] evicted = report.getEvictedNodes();
if (evicted.length > 0 && ResolveOptions.LOG_DEFAULT.equals(options.getLog())) {
Message.info("\t:: evicted modules:");
for (IvyNode evictedNode : evicted) {
Collection<String> allEvictingNodes = evictedNode.getAllEvictingNodesDetails();
if (allEvictingNodes == null) {
Message.info("\t" + evictedNode + " transitively in " + Arrays.asList(evictedNode.getEvictedConfs()));
} else if (allEvictingNodes.isEmpty()) {
Message.info("\t" + evictedNode + " by [] (" + evictedNode.getAllEvictingConflictManagers() + ") in " + Arrays.asList(evictedNode.getEvictedConfs()));
} else {
Message.info("\t" + evictedNode + " by " + allEvictingNodes + " in " + Arrays.asList(evictedNode.getEvictedConfs()));
}
for (String conf : evictedNode.getEvictedConfs()) {
EvictionData evictedData = evictedNode.getEvictedData(conf);
if (evictedData.getParent() != null) {
Message.verbose("\t in " + evictedData.getParent() + " with " + evictedData.getConflictManager());
}
}
}
}
if (ResolveOptions.LOG_DEFAULT.equals(options.getLog())) {
// CheckStyle:MagicNumber| OFF
char[] sep = new char[69];
Arrays.fill(sep, '-');
Message.rawinfo("\t" + new String(sep));
StringBuilder line = new StringBuilder("\t");
append(line, "", 18);
append(line, "modules", 31);
line.append("|");
append(line, "artifacts", 15);
line.append("|");
Message.rawinfo(line.toString());
line = new StringBuilder("\t");
append(line, "conf", 18);
append(line, "number", 7);
append(line, "search", 7);
append(line, "dwnlded", 7);
append(line, "evicted", 7);
line.append("|");
append(line, "number", 7);
append(line, "dwnlded", 7);
// CheckStyle:MagicNumber| ON
line.append("|");
Message.rawinfo(line.toString());
Message.rawinfo("\t" + new String(sep));
for (String conf : report.getConfigurations()) {
output(report.getConfigurationReport(conf));
}
Message.rawinfo("\t" + new String(sep));
}
IvyNode[] unresolved = report.getUnresolvedDependencies();
if (unresolved.length > 0) {
Message.warn("\t::::::::::::::::::::::::::::::::::::::::::::::");
Message.warn("\t:: UNRESOLVED DEPENDENCIES ::");
Message.warn("\t::::::::::::::::::::::::::::::::::::::::::::::");
}
for (IvyNode anUnresolved : unresolved) {
Message.warn("\t:: " + anUnresolved + ": " + anUnresolved.getProblemMessage());
}
if (unresolved.length > 0) {
Message.warn("\t::::::::::::::::::::::::::::::::::::::::::::::\n");
}
ArtifactDownloadReport[] errors = report.getFailedArtifactsReports();
if (errors.length > 0) {
Message.warn("\t::::::::::::::::::::::::::::::::::::::::::::::");
Message.warn("\t:: FAILED DOWNLOADS ::");
Message.warn("\t:: ^ see resolution messages for details ^ ::");
Message.warn("\t::::::::::::::::::::::::::::::::::::::::::::::");
}
for (ArtifactDownloadReport error : errors) {
Message.warn("\t:: " + error.getArtifact());
}
if (errors.length > 0) {
Message.warn("\t::::::::::::::::::::::::::::::::::::::::::::::\n");
}
}
use of org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData in project ant-ivy by apache.
the class XmlReportWriter method outputRevision.
private void outputRevision(ConfigurationResolveReport report, PrintWriter out, List<ModuleRevisionId> dependencies, IvyNode dep) {
Map<String, String> extraAttributes;
ModuleDescriptor md = null;
if (dep.getModuleRevision() != null) {
md = dep.getModuleRevision().getDescriptor();
}
StringBuilder details = new StringBuilder();
if (dep.isLoaded()) {
details.append(" status=\"");
details.append(XMLHelper.escape(dep.getDescriptor().getStatus()));
details.append("\" pubdate=\"");
details.append(DateUtil.format(new Date(dep.getPublication())));
details.append("\" resolver=\"");
details.append(XMLHelper.escape(dep.getModuleRevision().getResolver().getName()));
details.append("\" artresolver=\"");
details.append(XMLHelper.escape(dep.getModuleRevision().getArtifactResolver().getName()));
details.append("\"");
}
if (dep.isEvicted(report.getConfiguration())) {
EvictionData ed = dep.getEvictedData(report.getConfiguration());
if (ed.getConflictManager() != null) {
details.append(" evicted=\"").append(XMLHelper.escape(ed.getConflictManager().toString())).append("\"");
} else {
details.append(" evicted=\"transitive\"");
}
details.append(" evicted-reason=\"").append(XMLHelper.escape(ed.getDetail() == null ? "" : ed.getDetail())).append("\"");
}
if (dep.hasProblem()) {
details.append(" error=\"").append(XMLHelper.escape(dep.getProblem().getMessage())).append("\"");
}
if (md != null && md.getHomePage() != null) {
details.append(" homepage=\"").append(XMLHelper.escape(md.getHomePage())).append("\"");
}
extraAttributes = (md != null) ? md.getExtraAttributes() : dep.getResolvedId().getExtraAttributes();
details.append(extraToString(extraAttributes, SEPARATOR));
out.println(String.format("\t\t\t<revision name=\"%s\"%s%s downloaded=\"%s\" searched=\"%s\"%s conf=\"%s\" position=\"%d\">", XMLHelper.escape(dep.getResolvedId().getRevision()), (dep.getResolvedId().getBranch() == null) ? "" : " branch=\"" + XMLHelper.escape(dep.getResolvedId().getBranch()) + "\"", details, dep.isDownloaded(), dep.isSearched(), (dep.getDescriptor() == null) ? "" : " default=\"" + dep.getDescriptor().isDefault() + "\"", XMLHelper.escape(joinArray(dep.getConfigurations(report.getConfiguration()), ", ")), dependencies.indexOf(dep.getResolvedId())));
if (md != null) {
License[] licenses = md.getLicenses();
for (License license : licenses) {
out.println(String.format("\t\t\t\t<license name=\"%s\"%s/>", XMLHelper.escape(license.getName()), license.getUrl() == null ? "" : " url=\"" + XMLHelper.escape(license.getUrl()) + "\""));
}
}
outputMetadataArtifact(out, dep);
outputEvictionInformation(report, out, dep);
outputCallers(report, out, dep);
outputArtifacts(report, out, dep);
out.println("\t\t\t</revision>");
}
Aggregations