コード例 #1
0
    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;
    }
コード例 #2
0
 public FileCollection resolve() {
   try {
     walker.add(queue);
     return new UnionFileCollection(walker.findValues());
   } finally {
     queue.clear();
   }
 }