Skip to content

Use the Gradle Provider API to allow for lazy configuration #207

Closed
@aSemy

Description

@aSemy

Currently BCV uses vars for configuring behaviour.

This causes issues when configuring BCV, as the order of operations is now very sensitive to the order of configuration, and the interaction with different plugins. It also means that values must be computed lazily.

Lazy values also means that afterEvaluate {} can be avoided, which can also cause compatibility issues with other Gradle plugins, and should be avoided.

In order for BCV to follow best practices, properties that are compatible with the Gradle Provider API should be used instead.

For example:

Conventional values

Currently, the conventions for the non-lazy properties are configured in-place.

The Provider API allows for setting default conventions, and these should be set in the BinaryCompatibilityValidatorPlugin.

For example:

    override fun apply(target: Project): Unit = with(target) {
        val extension = extensions.create("apiValidation", ApiValidationExtension::class.java)
        
        extension.apply {
           klib.enabled.convention(false)
        }
    }

Further reading:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions