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 with gradle kotlin DSL #42

Open
ctzen opened this issue Jan 9, 2019 · 1 comment
Open

Use with gradle kotlin DSL #42

ctzen opened this issue Jan 9, 2019 · 1 comment

Comments

@ctzen
Copy link

ctzen commented Jan 9, 2019

Can optional be used with the gradle kotlin DSL?
If yes, please provide an example.
Thanks.

@tkrullmann
Copy link

tkrullmann commented Mar 19, 2019

I've used the following workaround, it works but it's a bit ugly:

plugins {
    id("nebula.optional-base") version "5.0.0"
}

val optional: Closure<*> by extra

dependencies {
    // use optional.toAction() as the 2nd parameter
    implementation("...", optional.toAction())
}

with toAction defined like this

fun <T : Any> Closure<*>.toAction(): Action<T> =
        ConfigureUtil.configureUsing(this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants