Interface ComponentSelectionRules


@Incubating public interface ComponentSelectionRules
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, IvyModuleDescriptor descriptor, ComponentMetadata metadata ->
                         if (selection.candidate.module == 'someModule' && descriptor.branch == 'testing') {
                             if (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")
                         }
                     }
                 }
             }
         }
     }