This message was deleted.
# kotlin-dsl
s
This message was deleted.
v
I'm not sure what your question is. If you need a Groovy closure, use
closureOf
or
delegateClosureOf
, or if you don't like either, use a Groovy script plugin that you
apply from
if you insist (not recommended). That it is hard to tell which to use is caused by Groovy being an extremely dynamic and duck-typed language while Kotlin is static and type-safe. Just try out which of the two work for the closure you need to give or make the plugin developer switch to
Action
which will then work properly for both DSLs without hassle.
Instead of
closureOf
or
delegatClosureOf
there is also
KotlinClosure{0-3}
actually for cases where it is needed.
m
Thanks for the fast response. After stepping away for a few minutes, I came back and found my own answer. Here is what compiles:
Copy code
val bintrayPackageConfig = delegateClosureOf<BintrayExtension.PackageConfig> { repo = "repossessed" }
        bintray.pkg(bintrayPackageConfig)
Both
closureOf
and
delegatClosureOf
compile. I'll try to apply it to a different DSL and see which works at runtime. It is a bummer to have to have 2 different approaches that compile but not knowing which one works until I get an NPE at runtime.
v
Yeah, complain to the might of Groovy 🙂