Search in sources :

Example 1 with DependencyLockingState

use of org.gradle.api.internal.artifacts.dsl.dependencies.DependencyLockingState in project gradle by gradle.

the class ShortCircuitEmptyConfigurationResolver method emptyGraph.

private void emptyGraph(ConfigurationInternal configuration, ResolverResults results, boolean verifyLocking) {
    if (verifyLocking && configuration.getResolutionStrategy().isDependencyLockingEnabled()) {
        DependencyLockingProvider dependencyLockingProvider = configuration.getResolutionStrategy().getDependencyLockingProvider();
        DependencyLockingState lockingState = dependencyLockingProvider.loadLockState(configuration.getName());
        if (lockingState.mustValidateLockState() && !lockingState.getLockedDependencies().isEmpty()) {
            // Invalid lock state, need to do a real resolution to gather locking failures
            delegate.resolveGraph(configuration, results);
            return;
        }
        dependencyLockingProvider.persistResolvedDependencies(configuration.getName(), Collections.emptySet(), Collections.emptySet());
    }
    Module module = configuration.getModule();
    ModuleVersionIdentifier id = moduleIdentifierFactory.moduleWithVersion(module);
    ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
    ResolutionResult emptyResult = DefaultResolutionResultBuilder.empty(id, componentIdentifier, configuration.getAttributes());
    ResolvedLocalComponentsResult emptyProjectResult = new ResolvedLocalComponentsResultGraphVisitor(thisBuild);
    results.graphResolved(emptyResult, emptyProjectResult, EmptyResults.INSTANCE);
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) DependencyLockingProvider(org.gradle.api.internal.artifacts.dsl.dependencies.DependencyLockingProvider) DependencyLockingState(org.gradle.api.internal.artifacts.dsl.dependencies.DependencyLockingState) ResolutionResult(org.gradle.api.artifacts.result.ResolutionResult) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) Module(org.gradle.api.internal.artifacts.Module) ResolvedLocalComponentsResult(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResult) ResolvedLocalComponentsResultGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor)

Aggregations

ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 ResolutionResult (org.gradle.api.artifacts.result.ResolutionResult)1 Module (org.gradle.api.internal.artifacts.Module)1 DependencyLockingProvider (org.gradle.api.internal.artifacts.dsl.dependencies.DependencyLockingProvider)1 DependencyLockingState (org.gradle.api.internal.artifacts.dsl.dependencies.DependencyLockingState)1 ResolvedLocalComponentsResult (org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResult)1 ResolvedLocalComponentsResultGraphVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor)1