Configuration Utilities

As from 2.1, Grolifant offers a ConfigurationTools interface which is available via ConfigurationPhaseOperations.getConfigurations().

Creating dependency-scoped Configuration definitions

In order to simplify dependency-scoped configurations and offer backwards compatibility prior to Gradle 8.4. check out createRoleFocusedConfigurations.

Converting objects to Configuration instances

Adding configurations to tasks is a not uncommon situation. In order to help plugin authors have a more flexible way, so utilities have been added to lazy-resolve items to project configurations. Grolifant offers a method in asConfiguration to resolve a single item to a configuration. It can be provided with an existing configuration or anything resolvable to a string using stringize. If the configurations do not exist at the time they are evaluated an exception will be thrown. There is also a version that takes a collection of objects and converts them a list of configurations.

Native attributes

There is some support for manipulating native attributes.

  • applyNativeAttributes adds the correct native attributes to a specific configuration.

  • applyNativeAttributesWithRulesToAll adds the correct native attributes to all resolvable configurations and then also adds rules to the attribute schema that will prevent errors when resolving variants that do not have native attributes.