Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aSemy opened this issue Mar 28, 2024 · 1 comment
Open

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

aSemy opened this issue Mar 28, 2024 · 1 comment
Labels
enhancement New feature or request gradle

Comments

@aSemy
Copy link
Contributor

aSemy commented Mar 28, 2024

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:

@fzhinkin
Copy link
Collaborator

@aSemy thanks for opening the issue!

As of Klib-related tasks, (almost) everything should be fixed with #204.

For old JVM-related tasks, we'll probably have to gradually deprecate and remove them and provide new "better" tasks as a replacements.

@fzhinkin fzhinkin added the enhancement New feature or request label Mar 28, 2024
@fzhinkin fzhinkin added the gradle label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gradle
Projects
None yet
Development

No branches or pull requests

2 participants