use of org.gradle.api.tasks.diagnostics.internal.graph.nodes.RenderableDependency in project gradle by gradle.
the class JsonProjectDependencyRenderer method createDependencies.
private List createDependencies(Configuration configuration) {
if (configuration.isCanBeResolved()) {
ResolutionResult result = configuration.getIncoming().getResolutionResult();
RenderableDependency root = new RenderableModuleResult(result.getRoot());
return createDependencyChildren(root, new HashSet<Object>());
} else {
return createDependencyChildren(new UnresolvableConfigurationResult(configuration), new HashSet<Object>());
}
}
use of org.gradle.api.tasks.diagnostics.internal.graph.nodes.RenderableDependency in project gradle by gradle.
the class JsonProjectDependencyRenderer method collectModules.
private Set<ModuleIdentifier> collectModules(Configuration configuration) {
RenderableDependency root;
if (configuration.isCanBeResolved()) {
ResolutionResult result = configuration.getIncoming().getResolutionResult();
root = new RenderableModuleResult(result.getRoot());
} else {
root = new UnresolvableConfigurationResult(configuration);
}
Set<ModuleIdentifier> modules = Sets.newHashSet();
Set<ComponentIdentifier> visited = Sets.newHashSet();
populateModulesWithChildDependencies(root, visited, modules);
return modules;
}
use of org.gradle.api.tasks.diagnostics.internal.graph.nodes.RenderableDependency in project gradle by gradle.
the class JsonProjectDependencyRenderer method createInsight.
private List createInsight(ModuleIdentifier module, final Configuration configuration) {
final Spec<DependencyResult> dependencySpec = new StrictDependencyResultSpec(module);
ResolutionResult result = configuration.getIncoming().getResolutionResult();
final Set<DependencyResult> selectedDependencies = new LinkedHashSet<DependencyResult>();
result.allDependencies(new Action<DependencyResult>() {
@Override
public void execute(DependencyResult it) {
if (dependencySpec.isSatisfiedBy(it)) {
selectedDependencies.add(it);
}
}
});
Collection<RenderableDependency> sortedDeps = new DependencyInsightReporter().prepare(selectedDependencies, versionSelectorScheme, versionComparator);
return CollectionUtils.collect(sortedDeps, new Transformer<Object, RenderableDependency>() {
@Override
public Object transform(RenderableDependency dependency) {
String name = replaceArrow(dependency.getName());
LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>(5);
map.put("name", replaceArrow(dependency.getName()));
map.put("description", dependency.getDescription());
map.put("resolvable", dependency.getResolutionState());
map.put("hasConflict", !name.equals(dependency.getName()));
map.put("children", createInsightDependencyChildren(dependency, new HashSet<Object>(), configuration));
return map;
}
});
}
use of org.gradle.api.tasks.diagnostics.internal.graph.nodes.RenderableDependency in project gradle by gradle.
the class DependentComponentsGraphRenderer method renderChildren.
private void renderChildren(Set<? extends RenderableDependency> children) {
renderer.startChildren();
int idx = 0;
for (RenderableDependency child : children) {
boolean last = idx++ == children.size() - 1;
doRender(child, last);
}
renderer.completeChildren();
}
use of org.gradle.api.tasks.diagnostics.internal.graph.nodes.RenderableDependency in project gradle by gradle.
the class JsonProjectDependencyRenderer method populateModulesWithChildDependencies.
private void populateModulesWithChildDependencies(RenderableDependency dependency, Set<ComponentIdentifier> visited, Set<ModuleIdentifier> modules) {
for (RenderableDependency childDependency : dependency.getChildren()) {
ModuleIdentifier moduleId = getModuleIdentifier(childDependency);
if (moduleId == null) {
continue;
}
modules.add(moduleId);
boolean alreadyVisited = !visited.add((ComponentIdentifier) childDependency.getId());
if (!alreadyVisited) {
populateModulesWithChildDependencies(childDependency, visited, modules);
}
}
}
Aggregations