This repo contains some of my notes on Kotlin compiler plugin development, internal structure of compiler and possible extension points. Majority of these items are taken from my droidcon 2020 talk, but I might be slowly extending the content to capture new developments (updates to plugin API or FIR).
If you feel like something is missing, feel free to open an issue with feature request. Contributions are welcome too!
Where to start:
- [compiler-structure]: Structured explanation of compiler phases
- [anatomy-of-plugin]: Anatomy of the compiler plugin
- 🚧[tooling]🚧: Tips for compiler plugin development
Notes in this repo are not intended to be a structured tutorial on writing your plugins. However, there are plenty of articles (and talks) on starting with Kotlin compiler plugin development:
- Writing Your Own Compiler plugin from KotlinConf 2018 by Kevin Most (a bit outdated)
- Writing your second compiler plugin series by Brian Norman
- Writing Kotlin Parcelize compiler plugin for iOS by Arkadii Ivanov
- Fixing serialization of Kotlin objects once and for all by yours truly
You can also find examples of compiler plugins to start your experiments from (with varied degree of production readiness):
- First-party plugins by JetBrains:
- Third-party: