A simple example of kotlim compiler plugin with FIR and IR.

Overview

A simple Kotlin compiler plugin example

This Kotlin compiler plugin generates a top level class:

public final class foo.bar.MyClass {
    fun foo(): String = "Hello world"
}

This plugin uses 1.8.20-dev-1278 bootstrap Kotlin version and should be used also with the same version of the compiler.

The plugin uses the K2 compiler.

Also, the plugin use the Kotlin compiler test infrastructure. The compiler-plugin module has a special task generateTests that generates simple box tests. Please, don't change the generated tests manually.

The test resources' folder contains also a dumped FIR and IR representations.

How to run

The repository has the example folder, you can compile the Main.kt manually with the compiler plugin:

  1. Build a jar file with the plugin (you can find it in compiler-plugin/build/libs folder)
  2. Compile the Main.kt file with the Kotlin compiler at least 1.8.20-dev-1278 version:
kotlinc -verbose -Xuse-k2 -Xplugin=path_to_plugin_jar path_to_Main_kt

2* - you can download the Kotlin repository, run the dist task and get the necessary version of the Kotlin compiler. 3) run java foo.bar.MainKt, it will print Hello world

You might also like...
This repository contains the article describing my attempt to implement a simple state reducer based on Kotlin Flow and an example app that uses it.
This repository contains the article describing my attempt to implement a simple state reducer based on Kotlin Flow and an example app that uses it.

This repository contains the article describing my attempt to implement a simple state reducer based on Kotlin Flow and an example app that uses it.

An example of a test task for creating a simple currency converter application for the Android platform. The app is developed using Kotlin, MVI, Dagger Hilt, Retrofit, Jetpack Compose.
An example of a test task for creating a simple currency converter application for the Android platform. The app is developed using Kotlin, MVI, Dagger Hilt, Retrofit, Jetpack Compose.

Simple Currency Converter Simple Currency Converter Android App by Isaev Semyon An example of a test task for creating a simple currency converter app

Plugin-shared-preferences - Pluto plugin to manage your Shared Preferences

Pluto Shared Preferences Plugin Pluto Shared Preferences is a Pluto plugin to in

Example Multi module architecture Android project using MVVM, Dynamic Features, Dagger-Hilt, Coroutines and Navigation Components
Example Multi module architecture Android project using MVVM, Dynamic Features, Dagger-Hilt, Coroutines and Navigation Components

ModularDynamicFeatureHilt An Android template project following a multi module approach with clean architecture. It has been built following Clean Arc

Simple (and useless) Minecraft plugin

CDS Minecraft plugin Simple plugin for Minecraft, without any useful feature ๐Ÿ–ฅ Installation ๐Ÿงพ Requirements maven 3.0+ java 8+ spigot server 1.19+ ๐Ÿ”ง

An example for who are all going to start learning Kotlin programming language to develop Android application.

Kotlin Example Here is an example for who are all going to start learning Kotlin programming language to develop Android application. First check this

Native android app made with Kotlin & Compose with example usage of Ktor, SqlDelight.
Native android app made with Kotlin & Compose with example usage of Ktor, SqlDelight.

Delight-Playground ๐ŸŽ‰ Native Android application built with Kotlin and Jetpack Compose. This app also illustrates the usage of advance libraries such

An example of using The Elm Architecture in Android

GreenTea [Work in progress] An example of using The Elm Architecture in Android. There is a working example and the most important base clases. Still,

Example mod with Mixin to help you to get started with creating a mod with mixins.

ExampleMixinMod Example mod with Mixin to help you to get started with creating a mod with mixins. For usage of mixins, see here. Also, remember to tu

Owner
Anastasiia Birillo
Anastasiia Birillo
A composite Github Action to execute the Kotlin Script with compiler plugin and dependency caching!

Kotlin Script Github Action Kotlin can also be used as a scripting language, which is more safer, concise, and fun to write than bash or python. Githu

Suresh 9 Nov 28, 2022
Lightweight compiler plugin intended for Kotlin/JVM library development and symbol visibility control.

Restrikt A Kotlin/JVM compiler plugin to restrict symbols access, from external project sources. This plugin offers two ways to hide symbols: An autom

Lorris Creantor 18 Nov 24, 2022
A Kotlin compiler plugin that allows Java callers to pass in null for default parameters

kotlin-null-defaults (Compiler plugin) (Gradle Plugin) ( Currently pending approval) A Kotlin compiler plugin that allows Java callers to pass in null

Youssef Shoaib 7 Oct 14, 2022
Example of migrating from Dagger to Hilt with a real service/repository example

DaggerToHilt Overview This repo provides a real example of using Hilt for dependency injection. It hits endpoints provided by the Movie Database, and

null 0 Nov 29, 2021
Playground project for Koin Koin Compiler - Sandbox

Koin Compiler - Sandbox The goal of Koin compiler & Annotations project is to help declare Koin definition in a very fast and intuitive way, and gener

insert-koin.io 17 Nov 22, 2021
An experimental tool for building console UI in Kotlin using the Jetpack Compose compiler/runtime

An experimental tool for building console UI in Kotlin using the Jetpack Compose compiler/runtime

Jake Wharton 1.4k Dec 28, 2022
Build a compiler in Kotlin (based on the original tutorial by Jack Crenshaw)

Let's Build a Compiler Based on the original series "Letโ€™s Build a Compiler!" by Jack Crenshaw. This is an adaptation of the original series to Kotlin

null 2 Oct 9, 2022
This repository is part of a Uni-Project to write a complete Compiler for a subset of Java.

Compiler This repository is part of a Uni-Project to write a complete Compiler for a subset of Java. Features error recovery using context sensitive a

null 3 Jan 10, 2022
A Open GAL compiler based on OpenGAL 0.3.1

A Open GAL compiler based on OpenGAL 0.3.1

Li Plum 3 Dec 21, 2022
A CLI tool to convert multi-module Jetpack Compose compiler metrics into beautiful HTML reports

A CLI tool to convert multi-module Jetpack Compose compiler metrics into beautiful HTML reports 1. What are Jetpack Compose compiler metrics? The Comp

Jaya Surya Thotapalli 116 Jan 3, 2023