@Incubating interface ComponentMetadataHandler
Allows the build to provide rules that modify the metadata of depended-on software components.
Possible uses of component metadata rules are:
Example:
dependencies { components { // Set the status and status scheme for every component belonging to a module in the group "org.foo" all { ComponentMetadataDetails details -> if (details.id.group == "org.foo") { def version = details.id.version // assuming status is last part of version string details.status = version.substring(version.lastIndexOf("-") + 1) details.statusScheme = ["bronze", "silver", "gold", "platinum"] } } // Treat all components in the module "org.foo:bar" as changing withModule("org.foo:bar") { ComponentMetadataDetails details -> details.changing = true } } }
Since
1.8
abstract fun all(rule: Action<in ComponentMetadataDetails>): ComponentMetadataHandler
Adds a rule action that may modify the metadata of any resolved software component. abstract fun all(rule: Closure<*>): ComponentMetadataHandler
Adds a rule closure that may modify the metadata of any resolved software component. The supplied rule closure must declare a ComponentMetadataDetails as it's first parameter, allowing the component metadata to be modified. In addition, the rule can declare additional (read-only) parameters, which may provide extra details about the component. The order of these additional parameters is not significant. The following additional parameter types are supported:
abstract fun all(ruleSource: Any): ComponentMetadataHandler
Adds a rule that may modify the metadata of any resolved software component. The ruleSource is an Object that has a single rule method annotated with org.gradle.model.Mutate. This rule method:
abstract fun all(rule: Class<out ComponentMetadataRule>): ComponentMetadataHandler
Adds a class based rule that may modify the metadata of any resolved software component. abstract fun all(rule: Class<out ComponentMetadataRule>, configureAction: Action<in ActionConfiguration>): ComponentMetadataHandler
Adds a class based rule that may modify the metadata of any resolved software component. The rule itself is configured by the provided configure action. |
|
abstract fun withModule(id: Any, rule: Action<in ComponentMetadataDetails>): ComponentMetadataHandler
Adds a rule that may modify the metadata of any resolved software component belonging to the specified module. abstract fun withModule(id: Any, rule: Closure<*>): ComponentMetadataHandler
Adds a rule that may modify the metadata of any resolved software component belonging to the specified module. The rule closure parameter is subject to the same requirements as abstract fun withModule(id: Any, ruleSource: Any): ComponentMetadataHandler
Adds a rule that may modify the metadata of any resolved software component belonging to the specified module. The rule source parameter is subject to the same requirements as abstract fun withModule(id: Any, rule: Class<out ComponentMetadataRule>): ComponentMetadataHandler abstract fun withModule(id: Any, rule: Class<out ComponentMetadataRule>, configureAction: Action<in ActionConfiguration>): ComponentMetadataHandler
Adds a class based rule that may modify the metadata of any resolved software component belonging to the specified module. |