use of com.typelead.gradle.eta.api.EtaProjectDependency 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);
}
}
use of com.typelead.gradle.eta.api.EtaProjectDependency in project gradle-eta by typelead.
the class DefaultEtaConfiguration method getAllResolvedDependencies.
@Override
public List<String> getAllResolvedDependencies(final Project project) {
List<String> allResolvedDependencies = new ArrayList<String>(getResolvedDependencies());
for (EtaDependency dependency : dependencies) {
if (dependency instanceof EtaProjectDependency) {
final EtaProjectDependency projectDependency = (EtaProjectDependency) dependency;
final Project targetProject = projectDependency.getProject(project);
final String targetConfiguration = projectDependency.getTargetConfiguration();
List<String> mavenDependencies;
if (targetProject.getPlugins().hasPlugin(EtaBasePlugin.class)) {
mavenDependencies = ConfigurationUtils.getEtaConfiguration(targetProject, targetConfiguration).getAllResolvedDependencies(project);
} else {
mavenDependencies = searchForEtaProjectDependencies(project, ConfigurationUtils.getConfiguration(targetProject, targetConfiguration));
}
allResolvedDependencies.addAll(mavenDependencies);
}
}
for (Configuration configuration : parentConfiguration.getExtendsFrom()) {
allResolvedDependencies.addAll(ConfigurationUtils.getEtaConfiguration(configuration).getAllResolvedDependencies(project));
}
return allResolvedDependencies;
}
use of com.typelead.gradle.eta.api.EtaProjectDependency in project gradle-eta by typelead.
the class DefaultEtaConfiguration method getAllArtifacts.
@Override
public Set<Provider<File>> getAllArtifacts(final Project project) {
Set<Provider<File>> allArtifacts = new LinkedHashSet<Provider<File>>();
allArtifacts.addAll(artifacts);
for (EtaDependency dependency : getDependencies()) {
if (dependency instanceof EtaProjectDependency) {
final EtaProjectDependency projectDependency = ((EtaProjectDependency) dependency);
final EtaConfiguration etaConfiguration = ConfigurationUtils.getEtaConfiguration(projectDependency.getProject(project), projectDependency.getTargetConfiguration());
if (etaConfiguration != null) {
allArtifacts.addAll(etaConfiguration.getAllArtifacts(project));
}
}
}
for (Configuration configuration : parentConfiguration.getExtendsFrom()) {
final EtaConfiguration etaConfiguration = ExtensionHelper.getExtension(configuration, EtaConfiguration.class);
allArtifacts.addAll(etaConfiguration.getAllArtifacts(project));
}
return allArtifacts;
}
use of com.typelead.gradle.eta.api.EtaProjectDependency in project gradle-eta by typelead.
the class DependencyUtils method foldEtaDependencies.
public static void foldEtaDependencies(final Project project, final Collection<EtaDependency> dependencies, final QuadConsumer<List<String>, List<String>, List<String>, Set<SourceRepository>> directProjectConsumer) {
List<String> directDependencies = new ArrayList<>();
List<String> projectDependencies = new ArrayList<>();
List<String> gitStringDependencies = 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(NamingScheme.getPackageName(targetProject, SourceSet.MAIN_SOURCE_SET_NAME));
}
} else if (dependency instanceof EtaGitDependency) {
final EtaGitDependency gitDep = (EtaGitDependency) dependency;
gitDependencies.add(gitDep.getSourceRepository());
gitStringDependencies.add(gitDep.getPackageName());
}
}
if (directProjectConsumer != null) {
directProjectConsumer.accept(directDependencies, projectDependencies, gitStringDependencies, gitDependencies);
}
}
Aggregations