Skip to content

A Kotlin Compiler plugin to improve the Elementa experience

License

Notifications You must be signed in to change notification settings

FalseHonesty/ElementaTools

Repository files navigation

Elementa-Tools

Kotlin Compiler Plugin that adds some useful features for the Elementa library. This plugin uses the new IR backend for the Kotlin compiler.

Example

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.

Gradle Plugin

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"
}

Kotlin IR

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
    }
}

About

A Kotlin Compiler plugin to improve the Elementa experience

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages