Kotlin Compiler Plugin that adds some useful features for the Elementa library. This plugin uses the new IR backend for the Kotlin compiler.
Given following code:
val myVarName = UIBlock()
val myComplexVar = (UIBlock().constrain { } childOf myVarName).apply {} as UIComponent
the following will succeed automatically using this plugin
assertEquals("myVarName", myVarName.componentName)
assertEquals("myComplexVar", myComplexVar.componentName)
While this may not seem useful instantly, it works very well in concert with Elementa's
Inspector widget, which will display the componentName
property if available, making
debugging with the Inspector far more enjoyable.
Builds of the Gradle plugin are available through the Gradle Plugin Portal.
plugins {
kotlin("jvm") version "1.4.0"
id("dev.falsehonesty.elementa-tools") version "0.1.0"
}
Using this compiler plugin only works with code compiled with the Kotlin 1.4.0 IR compiler. Note: As of 1.4.0, Kotlin IR is in Alpha.
compileKotlin {
kotlinOptions {
useIR = true
}
}