You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I am not sure how to use it on Kotlin, I need to specify the types but it is impossible to know easily what are types of those properties:
versioning {
releaseMode = { nextTag:String, lastTag:String, currentTag:String, extension:VersioningExtension->println(lastTag) // this is not being printed
lastTag
}
}
I tried Any in all types (I hate it) but it doesn't print too.
The text was updated successfully, but these errors were encountered:
There are ways to do this in Kotlin. I'll document them as soon as I find some time. However, it might handier to have a more Kotlin friendly version of the plugin.
It doesn't print because it doesn't get executed. If it would get executed, you would get a runtime error because of a type mismatch 😉. For the releaseMode to get used you have to set releaseBuild = true and your current branch must be part of releases. The releaseMode parameter only accepts a String or a Groovy Closure, but your used syntax doesn't create a Groovy Closure in Kotlin.
Without extending the plugin you could use one of the KotlinClosureX helper classes of the Gradle Kotlin DSL, sadly these are only defined up to 3 parameters but in your case you need 4. However, it is trivial to create such a class yourself (you can define it directly in the build script):
classKotlinClosure4<inT:Any?, inU:Any?, inV:Any?, inW:Any?, R:Any>(
valfunction: (T, U, V, W) ->R?,
owner:Any? = null,
thisObject:Any? = null
) : groovy.lang.Closure<R?>(owner, thisObject) {
@Suppress("unused") // to be called dynamically by GroovyfundoCall(t:T, u:U, v:V, w:W): R?= function(t, u, v, w)
}
With that class you can create the required Groovy Closure like this:
I am trying to use this one in Kotlin:
But I am not sure how to use it on Kotlin, I need to specify the types but it is impossible to know easily what are types of those properties:
I tried
Any
in all types (I hate it) but it doesn't print too.The text was updated successfully, but these errors were encountered: