Search in sources :

Example 1 with EtaGitDependency

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);
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) EtaProjectDependency(com.typelead.gradle.eta.api.EtaProjectDependency) EtaGitDependency(com.typelead.gradle.eta.api.EtaGitDependency) Project(org.gradle.api.Project) EtaDependency(com.typelead.gradle.eta.api.EtaDependency) ArrayList(java.util.ArrayList) EtaDirectDependency(com.typelead.gradle.eta.api.EtaDirectDependency) SourceRepository(com.typelead.gradle.eta.api.SourceRepository)

Aggregations

EtaDependency (com.typelead.gradle.eta.api.EtaDependency)1 EtaDirectDependency (com.typelead.gradle.eta.api.EtaDirectDependency)1 EtaGitDependency (com.typelead.gradle.eta.api.EtaGitDependency)1 EtaProjectDependency (com.typelead.gradle.eta.api.EtaProjectDependency)1 SourceRepository (com.typelead.gradle.eta.api.SourceRepository)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 Project (org.gradle.api.Project)1