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

Support Kotlin DSL friendly interface #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tnj
Copy link

@tnj tnj commented Feb 2, 2019

Fixes #28

Gradle Kotlin DSL automatically generates accessors for each Extension for static type-safe access, but it didn't play well with Ribonizer because RibobonizerExtension was not public, as described at #28 .

Also, I've modified some codes where depends on Groovy's runtime dynamic type resolution. For utilities like grayRibbonFilter(), I've specified implementation classes like ColorRibbonFilter instead of Consumer<BufferedImage> to enable access to options.

With this change, you can use Ribbonizer in Kotlin DSL, like:

ribbonizer {
    builder { variant, iconFile ->
        when (variant.buildType.name) {
            "debug" -> yellowRibbonFilter(variant, iconFile).apply { label = branchName }
            else -> grayRibbonFilter(variant, iconFile)
        }
    }
}

@pablodeafsapps
Copy link

Hi!

I understand this issue has not been merged yet. Do you plan to do it at some point in the future? I have recently moved my Gradle files to Kotlin DSL and I'd like to keep on using your library.

Thanks and regards,

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

Successfully merging this pull request may close these issues.

Incompatibility with gradle kotlin-dsl
2 participants