use of org.gradle.api.artifacts.component.ProjectComponentSelector in project gradle by gradle.
the class DefaultIncludedBuildExecuter method checkNoCycles.
private void checkNoCycles(BuildRequest buildRequest, BuildIdentifier target, List<BuildIdentifier> candidateCycle) {
candidateCycle.add(target);
for (BuildRequest executingBuild : executingBuilds) {
if (executingBuild.requestingBuild.equals(target)) {
BuildIdentifier nextTarget = executingBuild.targetBuild;
if (nextTarget.equals(buildRequest.requestingBuild)) {
candidateCycle.add(nextTarget);
ProjectComponentSelector selector = DefaultProjectComponentSelector.newSelector(buildRequest.targetBuild, ":");
throw new ModuleVersionResolveException(selector, "Included build dependency cycle: " + reportCycle(candidateCycle));
}
checkNoCycles(buildRequest, nextTarget, candidateCycle);
}
}
candidateCycle.remove(target);
}
use of org.gradle.api.artifacts.component.ProjectComponentSelector in project gradle by gradle.
the class DefaultDependencyMetadata method withTarget.
@Override
public DependencyMetadata withTarget(ComponentSelector target) {
if (target instanceof ModuleComponentSelector) {
ModuleComponentSelector moduleTarget = (ModuleComponentSelector) target;
ModuleVersionSelector requestedVersion = DefaultModuleVersionSelector.newSelector(moduleTarget.getGroup(), moduleTarget.getModule(), moduleTarget.getVersion());
if (requestedVersion.equals(requested)) {
return this;
}
return withRequested(requestedVersion);
} else if (target instanceof ProjectComponentSelector) {
ProjectComponentSelector projectTarget = (ProjectComponentSelector) target;
return new DefaultProjectDependencyMetadata(projectTarget, this);
} else {
throw new IllegalArgumentException("Unexpected selector provided: " + target);
}
}
use of org.gradle.api.artifacts.component.ProjectComponentSelector in project gradle by gradle.
the class LocalComponentDependencyMetadata method withTarget.
@Override
public LocalOriginDependencyMetadata withTarget(ComponentSelector target) {
if (target instanceof ModuleComponentSelector) {
ModuleComponentSelector moduleTarget = (ModuleComponentSelector) target;
ModuleVersionSelector requestedVersion = DefaultModuleVersionSelector.newSelector(moduleTarget.getGroup(), moduleTarget.getModule(), moduleTarget.getVersion());
if (selector.equals(target) && requested.equals(requestedVersion)) {
return this;
}
return copyWithTarget(moduleTarget, requestedVersion);
} else if (target instanceof ProjectComponentSelector) {
if (target.equals(selector)) {
return this;
}
return copyWithTarget(target, requested);
} else {
throw new AssertionError("Invalid component selector type for substitution: " + target);
}
}
use of org.gradle.api.artifacts.component.ProjectComponentSelector in project gradle by gradle.
the class ProjectDependencyResolver method resolve.
@Override
public void resolve(DependencyMetadata dependency, BuildableComponentIdResolveResult result) {
if (dependency.getSelector() instanceof ProjectComponentSelector) {
ProjectComponentSelector selector = (ProjectComponentSelector) dependency.getSelector();
ProjectComponentIdentifier project = componentIdentifierFactory.createProjectComponentIdentifier(selector);
LocalComponentMetadata componentMetaData = localComponentRegistry.getComponent(project);
if (componentMetaData == null) {
result.failed(new ModuleVersionResolveException(selector, project + " not found."));
} else {
result.resolved(componentMetaData);
}
}
}
use of org.gradle.api.artifacts.component.ProjectComponentSelector in project gradle by gradle.
the class ProjectDependencyResolver method resolve.
@Override
public void resolve(DependencyMetadata dependency, ResolvedVersionConstraint versionConstraint, BuildableComponentIdResolveResult result) {
if (dependency.getSelector() instanceof ProjectComponentSelector) {
ProjectComponentSelector selector = (ProjectComponentSelector) dependency.getSelector();
ProjectComponentIdentifier project = componentIdentifierFactory.createProjectComponentIdentifier(selector);
LocalComponentMetadata componentMetaData = localComponentRegistry.getComponent(project);
if (componentMetaData == null) {
result.failed(new ModuleVersionResolveException(selector, project + " not found."));
} else {
result.resolved(componentMetaData);
}
}
}
Aggregations