use of com.typelead.gradle.eta.api.EtaGitDependency in project gradle-eta by typelead.
the class DependencyUtils method foldEtaDependencies.
public static void foldEtaDependencies(final Project project, Collection<EtaDependency> dependencies, BiConsumer<List<String>, List<String>> directProjectConsumer, Consumer<Set<SourceRepository>> gitConsumer) {
List<String> directDependencies = new ArrayList<>();
List<String> projectDependencies = new ArrayList<>();
Set<SourceRepository> gitDependencies = new LinkedHashSet<>();
for (EtaDependency dependency : dependencies) {
if (dependency instanceof EtaDirectDependency) {
directDependencies.add(((EtaDirectDependency) dependency).toString());
} else if (dependency instanceof EtaProjectDependency) {
final Project targetProject = ((EtaProjectDependency) dependency).getProject(project);
if (isEtaProject(targetProject)) {
projectDependencies.add(targetProject.getName());
}
} else if (dependency instanceof EtaGitDependency) {
gitDependencies.add(((EtaGitDependency) dependency).getSourceRepository());
}
}
if (directProjectConsumer != null) {
directProjectConsumer.accept(directDependencies, projectDependencies);
}
if (gitConsumer != null) {
gitConsumer.accept(gitDependencies);
}
}
Aggregations