public Set<File> getFiles(Spec<Dependency> dependencySpec) { rethrowFailure(); Set<ModuleDependency> allDependencies = configuration.getAllDependencies(ModuleDependency.class); Set<ModuleDependency> selectedDependencies = Specs.filterIterable(allDependencies, dependencySpec); Set<ResolvedArtifact> artifacts = new LinkedHashSet<ResolvedArtifact>(); for (ModuleDependency moduleDependency : selectedDependencies) { Set<ResolvedDependency> resolvedDependencies = conversionResult.getFirstLevelResolvedDependencies().get(moduleDependency); for (ResolvedDependency resolvedDependency : resolvedDependencies) { artifacts.addAll(resolvedDependency.getParentArtifacts(conversionResult.getRoot())); walker.add(resolvedDependency); } } artifacts.addAll(walker.findValues()); Set<File> files = new LinkedHashSet<File>(); for (ResolvedArtifact artifact : artifacts) { File depFile = artifact.getFile(); if (depFile != null) { files.add(depFile); } else { logger.debug(String.format("Resolved artifact %s contains a null value.", artifact)); } } return files; }
ResolvedArtifactLibrary(ResolvedArtifact artifact, LibraryScope scope) { super(artifact.getModuleVersion().getId().getGroup(), artifact.getFile(), scope); this.artifact = artifact; }