Skip to content

A template for Kotlin compiler frontend plugins with IntelliJ support.

Notifications You must be signed in to change notification settings

irenedea/kotlin-frontend-plugin-template

Repository files navigation

Kotlin Frontend Plugin Template

How to Use Locally

Gradle Project

To publish to MavenLocal:

./gradlew publish

Calling Project Configuration

In the calling project,

Apply the gradle plugin in gradle.build.kts:

plugins {
    id("com.irenedea.template") version "0.1.0-SNAPSHOT"
    // ... other plugins
}

// ... the rest of the build file

Make sure MavenLocal is listed as one of the gradle plugin repositories in settings.gradle.kts:

pluginManagement {
    repositories {
        gradlePluginPortal()
        mavenLocal()
    }
}
// ... the rest of the settings file

IDE Plugin

To build IDE plugin zip:

./gradlew buildPlugin

The plugin zip should be in ide-plugin/build/distributions.

Note: Occasionally this will error, but running it ./gradlew clean buildPlugin again seems to work. 🤷🏻‍♀️

Calling Project Configuration

In the calling project,

In IntelliJ, Go to IntelliJ IDEA > Preferences... > Plugins > (Settings Logo in top bar) > Install Plugin from Disk..., select the plugin zip, and restart IntelliJ to enable the plugin.

Other Resources

Here are some resources for developing compiler plugins: