Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building Developer Tools with Kotlin

Building Developer Tools with Kotlin

Breandan Considine

April 19, 2017
Tweet

More Decks by Breandan Considine

Other Decks in Programming

Transcript

  1. Why develop tools? • Syntax manipulation • Typing completions •

    Static code analysis • UI/UX components • Language support • Framework support
  2. Why use Kotlin? • IntelliJ Platform / Eclipse integration •

    Java language / JVM interoperability • Functional programming patterns • Simplifies framework interactions • Domain specific languages • Build tools integration
  3. Why use Gradle? • Comprehensive tooling support • Cross-platform IDE

    • Gradle tooling API • Language-native buildscripts • Vibrant plugin ecosystem • Gradlew is awesome!
  4. public class Singleton { private Singleton() {} private static instance;

    public static Singleton getInstance() { if(instance == null) instance = new Singleton(); return instance; } public void doSomething() {} } 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: Singleton pattern: Java
  5. public class Singleton { private Singleton() {} private static instance;

    public static Singleton getInstance() { if(instance == null) instance = new Singleton(); return instance; } public void doSomething() {} } 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: Singleton pattern: Java
  6. IntelliJ Platform Kotlin DSL 1: val panel = panel {

    2: noteRow("Login:") 3: row("Username:") { userField() } 4: row("Password:") { passwordField() } 5: row { 6: rememberCheckBox() 7: right { 8: link("Forgot?") { browse(forgot) } 9: } 10: } 11: noteRow("No account? $signupLink") 12: }
  7. Gradle Script Kotlin (GSK) buildscript { repositories { gradleScriptKotlin() }

    dependencies { classpath(kotlinModule("gradle-plugin")) } }