use of com.typelead.gradle.utils.ImmutableDAG in project gradle-eta by typelead.
the class DefaultEtaConfiguration method doResolve.
public void doResolve(final Project project, final DependencyHandler handler, final ImmutableDAG<String, PackageInfo> dependencyGraph, Set<String> resolvedDependencies) {
final Logger logger = project.getLogger();
final String configurationName = parentConfiguration.getName();
Set<String> resolvedDeps = new HashSet<String>();
for (Configuration configuration : parentConfiguration.getExtendsFrom()) {
DefaultEtaConfiguration etaConfiguration = ExtensionHelper.getExtension(configuration, DefaultEtaConfiguration.class);
etaConfiguration.doResolve(project, handler, dependencyGraph, resolvedDeps);
}
List<String> keys = new ArrayList<String>();
for (EtaDependency dep : dependencies) {
if (dep instanceof HasPackageName) {
keys.add(((HasPackageName) dep).getPackageName());
}
}
if (!resolved.get() && resolved.compareAndSet(false, true)) {
logger.info("Resolving Eta Configuration '" + parentConfiguration.getIncoming().getPath() + "'");
List<PackageInfo> packageInfos = dependencyGraph.differenceClosure(keys, resolvedDeps);
if (packageInfos.size() > 0) {
mavenRepository.installPackages(packageInfos, dependencyGraph);
resolvedMavenDependencies = packageInfos.stream().filter(packageInfo -> keys.contains(packageInfo.getName())).map(mavenRepository::getMavenDependency).collect(Collectors.toList());
for (String mavenDep : resolvedMavenDependencies) {
handler.add(configurationName, mavenDep);
logger.info("Injecting maven dependency '" + mavenDep + "'");
}
} else {
resolvedMavenDependencies = Collections.emptyList();
}
}
resolvedDependencies.addAll(resolvedDeps);
resolvedDependencies.addAll(keys);
}
Aggregations