Interface BuildFeature
Gradle features can be enabled or disabled via build options,
but in some cases other flags or features can affect that.
For this reason, the getRequested()
status represents the configuration of a feature in isolation,
and the getActive()
status represents the final result, after everything has been taken into account.
Some flags disable features.
For instance, --export-keys
flag always disables Configuration Cache
.
If --configuration-cache
is provided at the same time, then configurationCache.requested.get() == true
,
but configurationCache.active.get() == false
.
Some features automatically enable other features.
For instance, enabling Isolated Projects
enables Configuration Cache.
So that configurationCache.requested
has no value, but configurationCache.active.get() == true
.
- Since:
- 8.5
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionEffective status of the feature: true - the feature is active and taking effect false - the feature is deactivated This method provides only generic information about the status of the feature.How the feature was requested: true - explicitly enabled (e.g.
-
Method Details
-
getRequested
How the feature was requested:- true - explicitly enabled (e.g.
--configuration-cache
) - false - explicitly disabled (e.g.
--no-configuration-cache
) - provider has no value - no preference, default behavior
Provider.getOrNull()
to safely retrieve a nullable value or checkProvider.isPresent()
as the provider can have no value in the case there is no explicit request.Note that enabling the feature doesn't necessary mean the feature will be activated. See
BuildFeature
for more details.Use
getActive()
to get the effective status of the feature.- Returns:
- The provider that can have no value and its value denotes the requested status of a feature
- Since:
- 8.5
- true - explicitly enabled (e.g.
-
getActive
Effective status of the feature:- true - the feature is active and taking effect
- false - the feature is deactivated
Note that a feature can get activated even if not explicitly enabled. See
BuildFeature
for more details.- Returns:
- The provider that is always has a value and its value denotes the effective status of a feature
- Since:
- 8.5
-