This is a template project for writing a compiler plugin for the Kotlin compiler.
This project has three modules:
:compiler-plugin module contains the compiler plugin itself.:plugin-annotations module contains annotations which can be used in
user code for interacting with compiler plugin.:gradle-plugin module contains a simple Gradle plugin to add the compiler plugin and
annotation dependency to a Kotlin project.Extension point registration:
SimplePluginRegistrar.SimplePluginComponentRegistrar.The Kotlin compiler test framework is set up for this project.
To create a new test, add a new .kt file in a compiler-plugin/testData sub-directory:
testData/box for codegen tests and testData/diagnostics for diagnostics tests.
The generated JUnit 5 test classes will be updated automatically when tests are next run.
They can be manually updated with the generateTests Gradle task as well.
To aid in running tests, it is recommended to install the Kotlin Compiler DevKit IntelliJ plugin,
which is pre-configured in this repository.
2,628 followers · starred Jun 2025
192 followers · starred Oct 2025
95 followers · starred Jul 2023
344 followers · starred Apr 2022
This is a template project for writing a compiler plugin for the Kotlin compiler.
This project has three modules:
:compiler-plugin module contains the compiler plugin itself.:plugin-annotations module contains annotations which can be used in
user code for interacting with compiler plugin.:gradle-plugin module contains a simple Gradle plugin to add the compiler plugin and
annotation dependency to a Kotlin project.Extension point registration:
SimplePluginRegistrar.SimplePluginComponentRegistrar.The Kotlin compiler test framework is set up for this project.
To create a new test, add a new .kt file in a compiler-plugin/testData sub-directory:
testData/box for codegen tests and testData/diagnostics for diagnostics tests.
The generated JUnit 5 test classes will be updated automatically when tests are next run.
They can be manually updated with the generateTests Gradle task as well.
To aid in running tests, it is recommended to install the Kotlin Compiler DevKit IntelliJ plugin,
which is pre-configured in this repository.
2,628 followers · starred Jun 2025
192 followers · starred Oct 2025
95 followers · starred Jul 2023
344 followers · starred Apr 2022