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

Klib validation DSL for Groovy is different #214

Open
sandwwraith opened this issue Apr 4, 2024 · 1 comment · Fixed by #215
Open

Klib validation DSL for Groovy is different #214

sandwwraith opened this issue Apr 4, 2024 · 1 comment · Fixed by #215
Assignees
Labels
bug Something isn't working gradle klib

Comments

@sandwwraith
Copy link
Member

sandwwraith commented Apr 4, 2024

DSL mentioned in the documentation:

apiValidation {
    @OptIn(kotlinx.validation.ExperimentalBCVApi::class)
    klib {
        enabled = true
    }
}

works for Kotlin, but for some reason, when one wants to use it in Groovy, one should write it slightly differently:

apiValidation {
    klib {
        it.enabled = true
    }
}

It looks like there is no particular reason for DSL having it.enabled = true instead of just enabled = true.

@fzhinkin fzhinkin self-assigned this Apr 4, 2024
@fzhinkin fzhinkin added bug Something isn't working klib labels Apr 4, 2024
@JakeWharton
Copy link

This:

public fun klib(block: KlibValidationSettings.() -> Unit) {

Should use an Action<KlibValidationSettings> which will do the right thing in Groovy and use Kotlin's SAM-with-receiver compiler plugin to do the right thing for Kotlin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gradle klib
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants