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 } } }
Type | Name and description |
---|---|
ComponentMetadataHandler |
all(Action<? super ComponentMetadataDetails> rule) Adds a rule action that may modify the metadata of any resolved software component. |
ComponentMetadataHandler |
all(groovy.lang.Closure<?> rule) Adds a rule closure that may modify the metadata of any resolved software component. |
ComponentMetadataHandler |
all(Object ruleSource) Adds a rule that may modify the metadata of any resolved software component. |
ComponentMetadataHandler |
withModule(Object id, Action<? super ComponentMetadataDetails> rule) Adds a rule that may modify the metadata of any resolved software component belonging to the specified module. |
ComponentMetadataHandler |
withModule(Object id, groovy.lang.Closure<?> rule) Adds a rule that may modify the metadata of any resolved software component belonging to the specified module. |
ComponentMetadataHandler |
withModule(Object id, Object ruleSource) Adds a rule that may modify the metadata of any resolved software component belonging to the specified module. |
Adds a rule action that may modify the metadata of any resolved software component.
rule
- the rule to be addedAdds 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:
rule
- the rule to be addedAdds 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 Mutate.
This rule method:
ruleSource
- the rule source object to be addedAdds a rule that may modify the metadata of any resolved software component belonging to the specified module.
id
- the module to apply this rule to in "group:module" format or as a ModuleIdentifierrule
- the rule to be addedAdds 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 all(groovy.lang.Closure).
id
- the module to apply this rule to in "group:module" format or as a ModuleIdentifierrule
- the rule to be addedAdds 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 all(Object).
id
- the module to apply this rule to in "group:module" format or as a ModuleIdentifierruleSource
- the rule source object to be added