use of org.gradle.api.internal.artifacts.ivyservice.dependencysubstitution.DependencySubstitutionApplicator in project gradle by gradle.
the class NodeState method maybeSubstitute.
/**
* Execute any dependency substitution rules that apply to this dependency.
*
* This may be better done as a decorator on ConfigurationMetadata.getDependencies()
*/
static DependencyState maybeSubstitute(DependencyState dependencyState, DependencySubstitutionApplicator dependencySubstitutionApplicator) {
DependencySubstitutionApplicator.SubstitutionResult substitutionResult = dependencySubstitutionApplicator.apply(dependencyState.getDependency());
if (substitutionResult.hasFailure()) {
dependencyState.failure = new ModuleVersionResolveException(dependencyState.getRequested(), substitutionResult.getFailure());
return dependencyState;
}
DependencySubstitutionInternal details = substitutionResult.getResult();
if (details != null && details.isUpdated()) {
ArtifactSelectionDetailsInternal artifactSelectionDetails = details.getArtifactSelectionDetails();
if (artifactSelectionDetails.isUpdated()) {
return dependencyState.withTargetAndArtifacts(details.getTarget(), artifactSelectionDetails.getTargetSelectors(), details.getRuleDescriptors());
}
return dependencyState.withTarget(details.getTarget(), details.getRuleDescriptors());
}
return dependencyState;
}
use of org.gradle.api.internal.artifacts.ivyservice.dependencysubstitution.DependencySubstitutionApplicator in project gradle by gradle.
the class DefaultArtifactDependencyResolver method createDependencySubstitutionApplicator.
private DependencySubstitutionApplicator createDependencySubstitutionApplicator(ResolutionStrategyInternal resolutionStrategy) {
Action<DependencySubstitution> rule = resolutionStrategy.getDependencySubstitutionRule();
DependencySubstitutionApplicator applicator;
if (Actions.<DependencySubstitution>doNothing() == rule) {
applicator = NO_OP;
} else {
applicator = new CachingDependencySubstitutionApplicator(new DefaultDependencySubstitutionApplicator(componentSelectionDescriptorFactory, rule, instantiator));
}
return applicator;
}
use of org.gradle.api.internal.artifacts.ivyservice.dependencysubstitution.DependencySubstitutionApplicator in project gradle by gradle.
the class DefaultArtifactDependencyResolver method createDependencyGraphBuilder.
private DependencyGraphBuilder createDependencyGraphBuilder(ComponentResolversChain componentSource, ResolutionStrategyInternal resolutionStrategy, GlobalDependencyResolutionRules globalRules, Spec<? super DependencyMetadata> edgeFilter, AttributesSchemaInternal attributesSchema, ModuleExclusions moduleExclusions, BuildOperationExecutor buildOperationExecutor) {
DependencyToComponentIdResolver componentIdResolver = componentSource.getComponentIdResolver();
ComponentMetaDataResolver componentMetaDataResolver = new ClientModuleResolver(componentSource.getComponentResolver(), dependencyDescriptorFactory);
ResolveContextToComponentResolver requestResolver = createResolveContextConverter();
ModuleConflictHandler conflictHandler = createModuleConflictHandler(resolutionStrategy, globalRules);
DefaultCapabilitiesConflictHandler capabilitiesConflictHandler = createCapabilitiesConflictHandler(resolutionStrategy.getCapabilitiesResolutionRules());
DependencySubstitutionApplicator applicator = createDependencySubstitutionApplicator(resolutionStrategy);
return new DependencyGraphBuilder(componentIdResolver, componentMetaDataResolver, requestResolver, conflictHandler, capabilitiesConflictHandler, edgeFilter, attributesSchema, moduleExclusions, buildOperationExecutor, applicator, componentSelectorConverter, attributesFactory, versionSelectorScheme, versionComparator.asVersionComparator(), versionParser);
}
Aggregations