• Stars
    star
    107
  • Rank 323,587 (Top 7 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This is an example project that shows how to create a Kotlin Compiler Plugin. The plugin will print "Hello from" and the name of the file that is being compiled, as a compiler warning to the terminal log.

KotlinCompilerPluginExample

jCenter PRs Welcome jCenter

Introduction ๐Ÿ™‹โ€โ™‚๏ธ

This is an example project that shows how to create a Kotlin Compiler Plugin. At compile time a gradle plugin will trigger the compiler plugin. The plugin will print "Hello from" and the name of the file that is being compiled, as a compiler warning to the terminal log.

Show some โค๏ธ and star the repo to support the project

GitHub stars GitHub forks GitHub watchers Twitter Follow

Usage

โ„น๏ธ Please be aware that the Kotlin Compiler still doesnโ€™t have any stable API and there is no backwards compatibility guaranteed. Kotlin versions above 1.8.22 can have a totally different API.

  • Inside the project folder run ./gradlew clean build

The plugin is only active when the build cache is changed. This is why you need to run "clean" before building, when you want to see the log output again.

๐Ÿ‘ท Project Structure

  • lib - A Kotlin Multiplatform project which applies a gradle plugin(compiler.plugin.helloworld) whichs triggers the compiler plugin.
  • compiler-plugin - This module contains the Kotlin Compiler Plugin
  • gradle-plugin - This module contains the gradle plugin which trigger the compiler plugin

Useful resources

The Road to the New Kotlin Compiler

https://github.com/bnorm/kotlin-ir-plugin-template

Writing Your Second Kotlin Compiler Plugin, Part 1 โ€” Project Setup

Experimenting with the Kotlin Compiler by Jossi Wolf, Snapp Mobile EN

Crash course on the Kotlin compiler | 1. Frontend: Parsing phase

โœ๏ธ Feedback

Feel free to send feedback on Twitter or file an issue. Feature requests are always welcome.

Find this project useful ? โค๏ธ

  • Support it by clicking the โญ button on the upper right of this page. โœŒ๏ธ

๐Ÿ“œ License


This project is licensed under Apache License, Version 2.0

Copyright 2019 Jens Klingenberg

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Acknowledgments

Projects that helped me understand how to setup the project:

More Repositories

1

Jetpack-Compose-Playground

Community-driven collection of Jetpack Compose example code and tutorials ๐Ÿš€ https://foso.github.io/compose
Kotlin
3,132
star
2

Ktorfit

HTTP client generator / KSP plugin for Kotlin Multiplatform (Android, iOS, Js, Jvm, Native) using KSP and Ktor clients inspired by Retrofit https://foso.github.io/Ktorfit
Kotlin
1,545
star
3

MpApt

(Deprecated) ๐Ÿ”ง Kotlin Native/JS/JVM Annotation Processor library for Kotlin compiler plugins
Kotlin
238
star
4

Cabret-Log

โœ๏ธ Method call logging for Kotlin Multiplatform
Kotlin
196
star
5

HtmlToComposeWebConverter

IntelliJ Idea Plugin that can convert HTML to Compose HTML code. https://plugins.jetbrains.com/plugin/18261-html-to-compose-web-converter
Kotlin
96
star
6

Showdown

Showdown is a selfhosted open source web app/server, you can use for remote planning pokerยฎ with scrum teams. Try at http://showdown.fly.dev/#/
Kotlin
48
star
7

KotlinReactNativeMpp

A ReactNative App written with Kotlin JS
Kotlin
35
star
8

Sheasy

This an Android App that helps you share/manage your files on your Android Device through a WebInterface in the Browser - Built with Ktor and Kotlin-React
Kotlin
35
star
9

Folders2kt

An interpreter/transpiler, written in Kotlin, for the esoteric programming language Folders, a language with no code and just folders
Kotlin
27
star
10

ExoPlayer-with-MediaControls

This is a small project i created to learn how to use the Exoplayer from Google. It plays an video from an URL and you can control the playback. It can now play HLS,Dash and mp4 streams
Java
20
star
11

gtvmonkey-scripts

This a template project that helps you write Greasemonkey/Tampermonkey/ViolentMonkey scripts with KotlinJs
Kotlin
18
star
12

compose-snake-web

This is a Compose HTML port of CompoSnake
Kotlin
12
star
13

JKAndroidWebserver

This is an example project that uses NanoHTTPd to run a Webserver on Android
Java
9
star
14

BitriseArtifactDownloader

This is a flutter app which uses the Bitrise Api(https://api-docs.bitrise.io/) to show the bitrise projects and builds and lets you download your artifacts.
Dart
9
star
15

JKManageSpaceActivity

This is an example project for my post about ManageSpaceActivity on Android
Kotlin
8
star
16

C-Crit_Generator

A generator for your critical secret keys
Kotlin
6
star
17

Android-Deeplink-Starter

IntelliJ/Android Studio plugin that adds an alternative UI to start Android deeplinks
Kotlin
3
star
18

compose-html-hello-world

Kotlin
3
star
19

ReverseMe

The app is part of my post about reserve engineering android apps
Java
3
star
20

ComposeReact

Just for fun experiment with a React like API for Jetpack Compose
Kotlin
2
star
21

MealApp

Kotlin Multiplatform project using Jetpack Compose and SwiftUI
Kotlin
2
star
22

JKLiveDataExample

This is an example project for my article about LiveData http://jensklingenberg.de/learn-how-to-use-livedata/
Java
2
star
23

KmdcExample

Example project with Compose HTML and Kmdc
Kotlin
2
star
24

JKWebsocket

Example Project that shows how to use NanoHTTP/NanoWSD to create a Websocket Server. After you connect to it, it will post "Hello World" plus the systemdate to the client every second.
Kotlin
2
star
25

KSP-Example

Kotlin
1
star
26

BasicKmm

Kotlin
1
star
27

dukat-idea

Intellij Plugin that adds a menu entry to start Dukat to generate KotlinJs Wrappers
Kotlin
1
star
28

ExtensionGenerator

Work in Progress
Kotlin
1
star
29

BananiaMapConverter

Tiled map files and converter for the game Banania
Kotlin
1
star
30

Foso

1
star
31

compose-web-nes-css

Compose Wrapper for Nes Css (WIP)
Kotlin
1
star
32

kt_dart_builder

A fluent Kotlin API for generating valid Dart source code
Kotlin
1
star
33

Experimental

Nothing to see here
Kotlin
1
star
34

kotlin-react-Hello-World

A simple Kotlin React Project with gradle, that shows Hello World and a reactstrap button
Kotlin
1
star
35

kotlinforeverything

WIP
1
star
36

compose

This is only used as an url shortener for https://github.com/Foso/Jetpack-Compose-Playground/
HTML
1
star
37

JK_Launcher

This is a very simple launcher app.
Java
1
star