use of org.gradle.api.artifacts.component.ProjectComponentIdentifier in project gradle by gradle.
the class IdeaPlugin method allImlArtifactsInComposite.
private List<TaskDependency> allImlArtifactsInComposite(ProjectInternal project, IdeaProject ideaProject) {
List<TaskDependency> dependencies = Lists.newArrayList();
ProjectComponentIdentifier thisProjectId = projectPathRegistry.getProjectComponentIdentifier(project.getIdentityPath());
for (IdeArtifactRegistry.Reference<IdeaModuleMetadata> reference : artifactRegistry.getIdeArtifactMetadata(IdeaModuleMetadata.class)) {
BuildIdentifier otherBuildId = reference.getOwningProject().getBuild();
if (thisProjectId.getBuild().equals(otherBuildId)) {
// IDEA Module for project in current build: don't include any module that has been excluded from project
boolean found = false;
for (IdeaModule ideaModule : ideaProject.getModules()) {
if (reference.get().getFile().equals(ideaModule.getOutputFile())) {
found = true;
break;
}
}
if (!found) {
continue;
}
}
dependencies.add(reference.getBuildDependencies());
}
return dependencies;
}
use of org.gradle.api.artifacts.component.ProjectComponentIdentifier in project gradle by gradle.
the class IdeaProject method configureModulePaths.
private void configureModulePaths(Project xmlProject) {
ProjectComponentIdentifier thisProjectId = projectPathRegistry.getProjectComponentIdentifier(((ProjectInternal) project).getIdentityPath());
for (IdeArtifactRegistry.Reference<IdeaModuleMetadata> reference : artifactRegistry.getIdeArtifactMetadata(IdeaModuleMetadata.class)) {
BuildIdentifier otherBuildId = reference.getOwningProject().getBuild();
if (thisProjectId.getBuild().equals(otherBuildId)) {
// IDEA Module for project in current build: handled via `modules` model elements.
continue;
}
xmlProject.addModulePath(reference.get().getFile());
}
}
use of org.gradle.api.artifacts.component.ProjectComponentIdentifier in project gradle by gradle.
the class DefaultIdeArtifactRegistry method registerIdeArtifact.
@Override
public void registerIdeArtifact(final IdeProjectMetadata ideProjectMetadata) {
ProjectComponentIdentifier projectId = newProjectId(buildIdentity.getCurrentBuild(), domainObjectContext.getProjectPath().getPath());
store.put(projectId, ideProjectMetadata);
}
use of org.gradle.api.artifacts.component.ProjectComponentIdentifier in project gradle by gradle.
the class CompositeBuildDependencySubstitutions method execute.
@Override
public void execute(DependencySubstitution sub) {
DependencySubstitutionInternal dependencySubstitution = (DependencySubstitutionInternal) sub;
// Use the result of previous rules as the input for dependency substitution
ComponentSelector requested = dependencySubstitution.getTarget();
if (requested instanceof ModuleComponentSelector) {
ModuleComponentSelector selector = (ModuleComponentSelector) requested;
ProjectComponentIdentifier replacement = getReplacementFor(selector);
if (replacement != null) {
dependencySubstitution.useTarget(DefaultProjectComponentSelector.newSelector(replacement), VersionSelectionReasons.COMPOSITE_BUILD);
}
}
}
use of org.gradle.api.artifacts.component.ProjectComponentIdentifier 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;
}
Aggregations