Search in sources :

Example 1 with DefaultBuildableComponentResolveResult

use of org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult in project gradle by gradle.

the class DependencyGraphBuilder method resolve.

public void resolve(ResolveContext resolveContext, DependencyGraphVisitor modelVisitor) {
    IdGenerator<Long> idGenerator = new LongIdGenerator();
    DefaultBuildableComponentResolveResult rootModule = new DefaultBuildableComponentResolveResult();
    moduleResolver.resolve(resolveContext, rootModule);
    ResolveState resolveState = new ResolveState(idGenerator, rootModule, resolveContext.getName(), idResolver, metaDataResolver, edgeFilter, attributesSchema, moduleIdentifierFactory, moduleExclusions);
    conflictHandler.registerResolver(new DirectDependencyForcingResolver(resolveState.root.moduleRevision));
    traverseGraph(resolveState, conflictHandler);
    resolveState.root.moduleRevision.setSelectionReason(VersionSelectionReasons.ROOT);
    assembleResult(resolveState, modelVisitor);
}
Also used : LongIdGenerator(org.gradle.internal.id.LongIdGenerator) DefaultBuildableComponentResolveResult(org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult)

Example 2 with DefaultBuildableComponentResolveResult

use of org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult in project gradle by gradle.

the class DependencyGraphBuilder method resolve.

public void resolve(final ResolveContext resolveContext, final DependencyGraphVisitor modelVisitor) {
    IdGenerator<Long> idGenerator = new LongIdGenerator();
    DefaultBuildableComponentResolveResult rootModule = new DefaultBuildableComponentResolveResult();
    moduleResolver.resolve(resolveContext, rootModule);
    final ResolveState resolveState = new ResolveState(idGenerator, rootModule, resolveContext.getName(), idResolver, metaDataResolver, edgeFilter, attributesSchema, moduleExclusions, moduleReplacementsData, componentSelectorConverter, attributesFactory, dependencySubstitutionApplicator);
    moduleConflictHandler.registerResolver(new DirectDependencyForcingResolver(resolveState.getRoot().getComponent()));
    traverseGraph(resolveState);
    validateGraph(resolveState);
    resolveState.getRoot().getComponent().setRoot();
    assembleResult(resolveState, modelVisitor);
}
Also used : LongIdGenerator(org.gradle.internal.id.LongIdGenerator) DefaultBuildableComponentResolveResult(org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult)

Example 3 with DefaultBuildableComponentResolveResult

use of org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult in project gradle by gradle.

the class DependencyGraphBuilder method resolve.

public void resolve(final ResolveContext resolveContext, final DependencyGraphVisitor modelVisitor, boolean includeSyntheticDependencies) {
    IdGenerator<Long> idGenerator = new LongIdGenerator();
    DefaultBuildableComponentResolveResult rootModule = new DefaultBuildableComponentResolveResult();
    moduleResolver.resolve(resolveContext, rootModule);
    int graphSize = estimateSize(resolveContext);
    ResolutionStrategyInternal resolutionStrategy = resolveContext.getResolutionStrategy();
    List<? extends DependencyMetadata> syntheticDependencies = includeSyntheticDependencies ? syntheticDependenciesOf(rootModule, resolveContext.getName()) : Collections.emptyList();
    final ResolveState resolveState = new ResolveState(idGenerator, rootModule, resolveContext.getName(), idResolver, metaDataResolver, edgeFilter, attributesSchema, moduleExclusions, componentSelectorConverter, attributesFactory, dependencySubstitutionApplicator, versionSelectorScheme, versionComparator, versionParser, moduleConflictHandler.getResolver(), graphSize, resolveContext.getResolutionStrategy().getConflictResolution(), syntheticDependencies, conflictTracker);
    Map<ModuleVersionIdentifier, ComponentIdentifier> componentIdentifierCache = Maps.newHashMapWithExpectedSize(graphSize / 2);
    traverseGraph(resolveState, componentIdentifierCache);
    validateGraph(resolveState, resolutionStrategy.isFailingOnDynamicVersions(), resolutionStrategy.isFailingOnChangingVersions());
    assembleResult(resolveState, modelVisitor);
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) LongIdGenerator(org.gradle.internal.id.LongIdGenerator) DefaultBuildableComponentResolveResult(org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) ResolutionStrategyInternal(org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) BuildOperationConstraint(org.gradle.internal.operations.BuildOperationConstraint) ResolvedVersionConstraint(org.gradle.api.internal.artifacts.ResolvedVersionConstraint)

Example 4 with DefaultBuildableComponentResolveResult

use of org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult in project gradle by gradle.

the class ComponentState method resolve.

public void resolve() {
    if (alreadyResolved()) {
        return;
    }
    ComponentOverrideMetadata componentOverrideMetadata;
    if (selectors != null && selectors.size() > 0) {
        // Taking the first selector here to determine the 'changing' status and 'client module' is our best bet to get the selector that will most likely be chosen in the end.
        // As selectors are sorted accordingly (see ModuleSelectors.SELECTOR_COMPARATOR).
        SelectorState firstSelector = selectors.first();
        componentOverrideMetadata = DefaultComponentOverrideMetadata.forDependency(firstSelector.isChanging(), selectors.getFirstDependencyArtifact(), firstSelector.getClientModule());
    } else {
        componentOverrideMetadata = DefaultComponentOverrideMetadata.EMPTY;
    }
    DefaultBuildableComponentResolveResult result = new DefaultBuildableComponentResolveResult();
    if (tryResolveVirtualPlatform()) {
        return;
    }
    resolver.resolve(componentIdentifier, componentOverrideMetadata, result);
    if (result.getFailure() != null) {
        metadataResolveFailure = result.getFailure();
        return;
    }
    metadata = result.getMetadata();
}
Also used : ComponentOverrideMetadata(org.gradle.internal.component.model.ComponentOverrideMetadata) DefaultComponentOverrideMetadata(org.gradle.internal.component.model.DefaultComponentOverrideMetadata) DefaultBuildableComponentResolveResult(org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult)

Example 5 with DefaultBuildableComponentResolveResult

use of org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult in project gradle by gradle.

the class DefaultArtifactResolutionQuery method buildComponentResult.

private ComponentArtifactsResult buildComponentResult(ComponentIdentifier componentId, ComponentMetaDataResolver componentMetaDataResolver, ArtifactResolver artifactResolver) {
    BuildableComponentResolveResult moduleResolveResult = new DefaultBuildableComponentResolveResult();
    componentMetaDataResolver.resolve(componentId, DefaultComponentOverrideMetadata.EMPTY, moduleResolveResult);
    ComponentResolveMetadata component = moduleResolveResult.getMetadata();
    DefaultComponentArtifactsResult componentResult = new DefaultComponentArtifactsResult(component.getId());
    for (Class<? extends Artifact> artifactType : artifactTypes) {
        addArtifacts(componentResult, artifactType, component, artifactResolver);
    }
    return componentResult;
}
Also used : DefaultBuildableComponentResolveResult(org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult) BuildableComponentResolveResult(org.gradle.internal.resolve.result.BuildableComponentResolveResult) DefaultBuildableComponentResolveResult(org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult) ComponentResolveMetadata(org.gradle.internal.component.model.ComponentResolveMetadata) DefaultComponentArtifactsResult(org.gradle.api.internal.artifacts.result.DefaultComponentArtifactsResult)

Aggregations

DefaultBuildableComponentResolveResult (org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult)6 LongIdGenerator (org.gradle.internal.id.LongIdGenerator)3 BuildableComponentResolveResult (org.gradle.internal.resolve.result.BuildableComponentResolveResult)2 File (java.io.File)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 ComponentArtifactIdentifier (org.gradle.api.artifacts.component.ComponentArtifactIdentifier)1 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 ResolvedVersionConstraint (org.gradle.api.internal.artifacts.ResolvedVersionConstraint)1 ResolutionStrategyInternal (org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal)1 DefaultMetadataFileSource (org.gradle.api.internal.artifacts.repositories.metadata.DefaultMetadataFileSource)1 DefaultComponentArtifactsResult (org.gradle.api.internal.artifacts.result.DefaultComponentArtifactsResult)1 DefaultModuleComponentIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier)1 ModuleComponentArtifactIdentifier (org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier)1 ComponentArtifactMetadata (org.gradle.internal.component.model.ComponentArtifactMetadata)1 ComponentOverrideMetadata (org.gradle.internal.component.model.ComponentOverrideMetadata)1 ComponentResolveMetadata (org.gradle.internal.component.model.ComponentResolveMetadata)1 DefaultComponentOverrideMetadata (org.gradle.internal.component.model.DefaultComponentOverrideMetadata)1 BuildOperationConstraint (org.gradle.internal.operations.BuildOperationConstraint)1 BuildableArtifactResolveResult (org.gradle.internal.resolve.result.BuildableArtifactResolveResult)1 BuildableArtifactSetResolveResult (org.gradle.internal.resolve.result.BuildableArtifactSetResolveResult)1