I’m rewiring my plugin from groovy to Kotlin.
I’m often using this code in Groovy
project.ext.isSnapshotBuild = {
return versionProvider.get().isSnapshotBuild()
}
project.ext.isWindows = {
return Os.isFamily(Os.FAMILY_WINDOWS)
}
project.ext.isIDEBuild = {
return (boolean) project.properties['android.injected.invoked.from.ide']
}
How rewrite the same logic to Kolin. I need to keep compatibility with project which still using groovy based build script.
And what is currently the suggested way how to do it?
I was thinking about project.extensions.create where I can put my object with my methods which can be called easily from Kotlin build script. It is a good way?
I did not found a way how to extend Project class in the way that will be available in the project which using my plugin. Inside of plugin I have this
fun Project.isIDEBuild(): Boolean {
return this.hasProperty("android.injected.invoked.from.ide")
}
but it is not working the project which using my plugin.