BuildFeature (Gradle API 9.5.1)
Description: declaration: package: org.gradle.api.configuration, interface: BuildFeature

Package org.gradle.api.configuration

# Interface BuildFeature

public interface BuildFeature
Status of a Gradle feature in the current invocation, such as Configuration Cache.

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:
  - `BuildFeatures`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Provider<Boolean>`
  `getActive()`
  Effective 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.
  `Provider<Boolean>`
  `getRequested()`
  How the feature was requested: true - explicitly enabled (e.g.

- ## Method Details

  - ### getRequested

    Provider<Boolean> 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
    Use `Provider.getOrNull()` to safely retrieve a nullable value or check `Provider.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

  - ### getActive

    Provider<Boolean> getActive()
    Effective 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. It does not provide information about a behavior that is specific for any given feature. For instance, it does not say whether Configuration Cache got a hit or a miss for a given invocation.

    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