Search in sources :

Example 1 with IdeProjectDependency

use of org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency in project gradle by gradle.

the class IdeaDependenciesProvider method getProjectDependencies.

private Set<Dependency> getProjectDependencies(IdeaModule ideaModule, GeneratedIdeaScope scope) {
    Collection<Configuration> plusConfigurations = getPlusConfigurations(ideaModule, scope);
    Collection<Configuration> minusConfigurations = getMinusConfigurations(ideaModule, scope);
    Collection<IdeProjectDependency> extractedDependencies = dependenciesExtractor.extractProjectDependencies(ideaModule.getProject(), plusConfigurations, minusConfigurations);
    Set<Dependency> dependencies = Sets.newLinkedHashSet();
    for (IdeProjectDependency ideProjectDependency : extractedDependencies) {
        dependencies.add(moduleDependencyBuilder.create(ideProjectDependency, scope.name()));
    }
    return dependencies;
}
Also used : IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) Configuration(org.gradle.api.artifacts.Configuration) UnresolvedIdeRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.UnresolvedIdeRepoFileDependency) IdeLocalFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency) IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) Dependency(org.gradle.plugins.ide.idea.model.Dependency) IdeExtendedRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency)

Example 2 with IdeProjectDependency

use of org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency in project gradle by gradle.

the class EclipseDependenciesCreator method createProjectDependencies.

private List<AbstractClasspathEntry> createProjectDependencies() {
    ArrayList<AbstractClasspathEntry> projects = Lists.newArrayList();
    Collection<IdeProjectDependency> projectDependencies = dependenciesExtractor.extractProjectDependencies(classpath.getProject(), classpath.getPlusConfigurations(), classpath.getMinusConfigurations());
    for (IdeProjectDependency projectDependency : projectDependencies) {
        projects.add(projectDependencyBuilder.build(projectDependency));
    }
    return projects;
}
Also used : IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) AbstractClasspathEntry(org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry)

Example 3 with IdeProjectDependency

use of org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency in project gradle by gradle.

the class DefaultIdeDependencyResolver method getIdeProjectDependencies.

/**
     * Gets IDE project dependencies.
     *
     * @param configuration Configuration
     * @param project Project
     * @return IDE project dependencies
     */
public List<IdeProjectDependency> getIdeProjectDependencies(Configuration configuration, Project project) {
    ResolutionResult result = getIncomingResolutionResult(configuration);
    final Set<ResolvedComponentResult> projectComponents = CollectionUtils.filter(result.getAllComponents(), new Spec<ResolvedComponentResult>() {

        @Override
        public boolean isSatisfiedBy(ResolvedComponentResult element) {
            return element.getId() instanceof ProjectComponentIdentifier;
        }
    });
    List<IdeProjectDependency> ideProjectDependencies = new ArrayList<IdeProjectDependency>();
    ProjectComponentIdentifier thisProjectId = DefaultProjectComponentIdentifier.newProjectId(project);
    for (ResolvedComponentResult projectComponent : projectComponents) {
        ProjectComponentIdentifier projectId = (ProjectComponentIdentifier) projectComponent.getId();
        if (thisProjectId.equals(projectId)) {
            continue;
        }
        if (!projectId.getBuild().isCurrentBuild()) {
            // Don't have access to the ProjectInstance: we can't use it to determine the name.
            ideProjectDependencies.add(new IdeProjectDependency(projectId));
        } else {
            Project resolvedProject = project.project(projectId.getProjectPath());
            ideProjectDependencies.add(new IdeProjectDependency(projectId, resolvedProject.getName()));
        }
    }
    return ideProjectDependencies;
}
Also used : IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) Project(org.gradle.api.Project) ResolutionResult(org.gradle.api.artifacts.result.ResolutionResult) ArrayList(java.util.ArrayList) ResolvedComponentResult(org.gradle.api.artifacts.result.ResolvedComponentResult) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) DefaultProjectComponentIdentifier(org.gradle.internal.component.local.model.DefaultProjectComponentIdentifier)

Example 4 with IdeProjectDependency

use of org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency in project gradle by gradle.

the class WtpComponentFactory method getEntriesFromProjectDependencies.

private List<WbDependentModule> getEntriesFromProjectDependencies(Project project, Set<Configuration> plusConfigurations, Set<Configuration> minusConfigurations, String deployPath) {
    IdeDependenciesExtractor extractor = new IdeDependenciesExtractor();
    Collection<IdeProjectDependency> dependencies = extractor.extractProjectDependencies(project, plusConfigurations, minusConfigurations);
    List<WbDependentModule> projectDependencies = Lists.newArrayList();
    for (IdeProjectDependency dependency : dependencies) {
        String moduleName = determineProjectName(dependency);
        projectDependencies.add(new WbDependentModule(deployPath, "module:/resource/" + moduleName + "/" + moduleName));
    }
    return projectDependencies;
}
Also used : IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) WbDependentModule(org.gradle.plugins.ide.eclipse.model.WbDependentModule) IdeDependenciesExtractor(org.gradle.plugins.ide.internal.IdeDependenciesExtractor)

Aggregations

IdeProjectDependency (org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency)4 ArrayList (java.util.ArrayList)1 Project (org.gradle.api.Project)1 Configuration (org.gradle.api.artifacts.Configuration)1 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)1 ResolutionResult (org.gradle.api.artifacts.result.ResolutionResult)1 ResolvedComponentResult (org.gradle.api.artifacts.result.ResolvedComponentResult)1 DefaultProjectComponentIdentifier (org.gradle.internal.component.local.model.DefaultProjectComponentIdentifier)1 AbstractClasspathEntry (org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry)1 WbDependentModule (org.gradle.plugins.ide.eclipse.model.WbDependentModule)1 Dependency (org.gradle.plugins.ide.idea.model.Dependency)1 IdeDependenciesExtractor (org.gradle.plugins.ide.internal.IdeDependenciesExtractor)1 IdeExtendedRepoFileDependency (org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency)1 IdeLocalFileDependency (org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency)1 UnresolvedIdeRepoFileDependency (org.gradle.plugins.ide.internal.resolver.model.UnresolvedIdeRepoFileDependency)1