public interface ComponentSelectionRules
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") } } } } } }
Modifier and Type | Method | Description |
---|---|---|
ComponentSelectionRules |
all(Closure<?> closure) |
Adds a component selection rule that will apply to all resolved components.
|
ComponentSelectionRules |
all(Object ruleSource) |
Adds a rule-source backed component selection rule that will apply to all resolved components.
|
ComponentSelectionRules |
all(Action<? super ComponentSelection> selectionAction) |
Adds a simple component selection rule that will apply to all resolved components.
|
ComponentSelectionRules |
withModule(Object id,
Closure<?> closure) |
Adds a component selection rule that will apply to the specified module.
|
ComponentSelectionRules |
withModule(Object id,
Object ruleSource) |
Adds a rule-source backed component selection rule that will apply to the specified module.
|
ComponentSelectionRules |
withModule(Object id,
Action<? super ComponentSelection> selectionAction) |
Adds a component selection rule that will apply to the specified module.
|
ComponentSelectionRules all(Action<? super ComponentSelection> selectionAction)
ComponentSelection
object as an argument.selectionAction
- the Action that implements a rule to be appliedComponentSelectionRules all(Closure<?> closure)
ComponentSelection
object as an argument.
Injection of other arguments has been deprecated in favor of the added methods
on ComponentSelection
, namely ComponentSelection.getMetadata()
and ComponentSelection.getDescriptor(Class)
.closure
- the Closure that implements a rule to be appliedComponentSelectionRules all(Object ruleSource)
Mutate
.
This rule method:
ComponentSelection
as its parameter.ComponentSelection
, namely ComponentSelection.getMetadata()
and ComponentSelection.getDescriptor(Class)
.ruleSource
- an instance providing a rule implementationComponentSelectionRules withModule(Object id, Action<? super ComponentSelection> selectionAction)
ComponentSelection
object as an argument.id
- the module to apply this rule to in "group:module" format or as a ModuleIdentifier
selectionAction
- the Action that implements a rule to be appliedComponentSelectionRules withModule(Object id, Closure<?> closure)
ComponentSelection
object as an argument.
Injection of other arguments has been deprecated in favor of the added methods
on ComponentSelection
, namely ComponentSelection.getMetadata()
and ComponentSelection.getDescriptor(Class)
.id
- the module to apply this rule to in "group:module" format or as a ModuleIdentifier
closure
- the Closure that implements a rule to be appliedComponentSelectionRules withModule(Object id, Object ruleSource)
Mutate
.
This rule method:
ComponentSelection
as its parameter.ComponentSelection
, namely ComponentSelection.getMetadata()
and ComponentSelection.getDescriptor(Class)
.id
- the module to apply this rule to in "group:module" format or as a ModuleIdentifier
ruleSource
- an instance providing a rule implementation