Component Selection Rules
Represents a container for component selection rules. Rules can be applied as part of the resolutionStrategy of a configuration and individual components can be explicitly accepted or rejected by rule. Components that are neither accepted or rejected will be subject to the default version matching strategies.
configurations {
conf {
resolutionStrategy {
componentSelection {
all { ComponentSelection selection ->
if (selection.candidate.module == 'someModule' && selection.candidate.version == '1.1') {
selection.reject("bad version '1.1' for 'someModule'")
}
}
all { ComponentSelection selection ->
if (selection.candidate.module == 'someModule' && selection.getDescriptor(IvyModuleDescriptor)?.branch == 'testing') {
if (selection.metadata == null || selection.metadata.status != 'milestone') {
selection.reject("only use milestones for someModule:testing")
}
}
}
withModule("org.sample:api") { ComponentSelection selection ->
if (selection.candidate.version == "1.1") {
selection.reject("known bad version")
}
}
}
}
}
}
Content copied to clipboard
Functions
Link copied to clipboard
abstract fun all(@DelegatesTo(value = ComponentSelection::class ) closure: Closure<out Any>): ComponentSelectionRules
Adds a component selection rule that will apply to all resolved components.
Adds a rule-source backed component selection rule that will apply to all resolved components.
Adds a simple component selection rule that will apply to all resolved components.
Link copied to clipboard
abstract fun withModule(id: Any, @DelegatesTo(value = ComponentSelection::class ) closure: Closure<out Any>): ComponentSelectionRules
abstract fun withModule(id: Any, selectionAction: Action<in ComponentSelection>): ComponentSelectionRules
Adds a component selection rule that will apply to the specified module.
Adds a rule-source backed component selection rule that will apply to the specified module.