Search in sources :

Example 1 with BuildOperationExecutor

use of org.gradle.internal.progress.BuildOperationExecutor in project gradle by gradle.

the class DefaultResolvedDependencyTest method createResolvedArtifact.

public static DefaultResolvedArtifact createResolvedArtifact(final Mockery context, final String name, final String type, final String extension, final File file) {
    final IvyArtifactName artifactStub = context.mock(IvyArtifactName.class, "artifact" + name);
    final ImmutableAttributesFactory factory = context.mock(ImmutableAttributesFactory.class);
    final BuildOperationExecutor buildOperationExecutor = context.mock(BuildOperationExecutor.class);
    context.checking(new Expectations() {

        {
            allowing(factory).builder(ImmutableAttributes.EMPTY);
            allowing(artifactStub).getName();
            will(returnValue(name));
            allowing(artifactStub).getType();
            will(returnValue(type));
            allowing(artifactStub).getExtension();
            will(returnValue(extension));
            allowing(artifactStub).getClassifier();
            will(returnValue(null));
        }
    });
    final Factory artifactSource = context.mock(Factory.class);
    context.checking(new Expectations() {

        {
            allowing(artifactSource).create();
            will(returnValue(file));
        }
    });
    final ResolvedDependency resolvedDependency = context.mock(ResolvedDependency.class);
    final ResolvedModuleVersion version = context.mock(ResolvedModuleVersion.class);
    context.checking(new Expectations() {

        {
            allowing(resolvedDependency).getModule();
            will(returnValue(version));
            allowing(version).getId();
            will(returnValue(new DefaultModuleVersionIdentifier("group", name, "1.2")));
        }
    });
    return new DefaultResolvedArtifact(resolvedDependency.getModule().getId(), artifactStub, context.mock(ComponentArtifactIdentifier.class), context.mock(TaskDependency.class), artifactSource);
}
Also used : Expectations(org.jmock.Expectations) TaskDependency(org.gradle.api.tasks.TaskDependency) ComponentArtifactIdentifier(org.gradle.api.artifacts.component.ComponentArtifactIdentifier) ResolvedModuleVersion(org.gradle.api.artifacts.ResolvedModuleVersion) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) ResolvedDependency(org.gradle.api.artifacts.ResolvedDependency) ImmutableAttributesFactory(org.gradle.api.internal.attributes.ImmutableAttributesFactory) Factory(org.gradle.internal.Factory) ImmutableAttributesFactory(org.gradle.api.internal.attributes.ImmutableAttributesFactory) BuildOperationExecutor(org.gradle.internal.progress.BuildOperationExecutor)

Example 2 with BuildOperationExecutor

use of org.gradle.internal.progress.BuildOperationExecutor in project gradle by gradle.

the class DefaultArtifactDependencyResolver method resolve.

@Override
public void resolve(ResolveContext resolveContext, List<? extends ResolutionAwareRepository> repositories, GlobalDependencyResolutionRules metadataHandler, Spec<? super DependencyMetadata> edgeFilter, DependencyGraphVisitor graphVisitor, DependencyArtifactsVisitor artifactsVisitor, AttributesSchema attributesSchema, ImmutableModuleIdentifierFactory moduleIdentifierFactory, ModuleExclusions moduleExclusions) {
    LOGGER.debug("Resolving {}", resolveContext);
    ComponentResolvers resolvers = createResolvers(resolveContext, repositories, metadataHandler);
    DependencyGraphBuilder builder = createDependencyGraphBuilder(resolvers, resolveContext.getResolutionStrategy(), metadataHandler, edgeFilter, attributesSchema, moduleIdentifierFactory, moduleExclusions);
    ArtifactResolver artifactResolver = new ErrorHandlingArtifactResolver(new CacheLockingArtifactResolver(cacheLockingManager, resolvers.getArtifactResolver()));
    BuildOperationExecutor buildOperationExecutor = serviceRegistry.get(BuildOperationExecutor.class);
    DependencyGraphVisitor artifactsGraphVisitor = new ResolvedArtifactsGraphVisitor(artifactsVisitor, artifactResolver, attributesFactory, buildOperationExecutor, moduleExclusions);
    // Resolve the dependency graph
    builder.resolve(resolveContext, new CompositeDependencyGraphVisitor(graphVisitor, artifactsGraphVisitor));
}
Also used : DependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphVisitor) CompositeDependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyGraphVisitor) DependencyGraphBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder) ResolvedArtifactsGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedArtifactsGraphVisitor) CacheLockingArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactResolver) CompositeDependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyGraphVisitor) ErrorHandlingArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingArtifactResolver) ComponentResolvers(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers) CacheLockingArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactResolver) ArtifactResolver(org.gradle.internal.resolve.resolver.ArtifactResolver) ErrorHandlingArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingArtifactResolver) BuildOperationExecutor(org.gradle.internal.progress.BuildOperationExecutor)

Aggregations

BuildOperationExecutor (org.gradle.internal.progress.BuildOperationExecutor)2 ResolvedDependency (org.gradle.api.artifacts.ResolvedDependency)1 ResolvedModuleVersion (org.gradle.api.artifacts.ResolvedModuleVersion)1 ComponentArtifactIdentifier (org.gradle.api.artifacts.component.ComponentArtifactIdentifier)1 CacheLockingArtifactResolver (org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactResolver)1 ComponentResolvers (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers)1 ErrorHandlingArtifactResolver (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingArtifactResolver)1 ResolvedArtifactsGraphVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedArtifactsGraphVisitor)1 CompositeDependencyGraphVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyGraphVisitor)1 DependencyGraphBuilder (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder)1 DependencyGraphVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphVisitor)1 ImmutableAttributesFactory (org.gradle.api.internal.attributes.ImmutableAttributesFactory)1 TaskDependency (org.gradle.api.tasks.TaskDependency)1 Factory (org.gradle.internal.Factory)1 IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)1 ArtifactResolver (org.gradle.internal.resolve.resolver.ArtifactResolver)1 Expectations (org.jmock.Expectations)1