https://github.com/anthonycr/tagger
An example Kotlin Symbol Processor (KSP)
https://github.com/anthonycr/tagger
kotlin kotlin-symbol-processing
Last synced: about 1 month ago
JSON representation
An example Kotlin Symbol Processor (KSP)
- Host: GitHub
- URL: https://github.com/anthonycr/tagger
- Owner: anthonycr
- License: mit
- Created: 2017-12-05T00:51:47.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2025-03-12T02:35:22.000Z (2 months ago)
- Last Synced: 2025-04-13T12:27:40.311Z (about 1 month ago)
- Topics: kotlin, kotlin-symbol-processing
- Language: Kotlin
- Homepage:
- Size: 155 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tagger
A Kotlin symbol processor example## Abstract
This Kotlin symbol processor acts as an example of how to generate Kotlin code using the Kotlin Symbol Processing (KSP) framework. Using KSP, we can generate idiomatic Kotlin code. This example generates tag properties which are commonly used for logging, as extensions of the annotated class.
## Gradle
```kotlin
plugins {
id("com.google.devtools.ksp")
}dependencies {
ksp(project(":tagger-compiler"))
implementation(project(":tagger")
}
```## Usage
Apply the `@Tag` annotation to a class, and Tagger will auto-generate a log tag for the class.
```kotlin
@Tag
class HelloWorld {fun hello() {
println("$TAG - is the class name")
}}
```
The symbol processor generates an extension property for the annotated class.
```kotlin
val HelloWorld.TAG: String
get() = "HelloWorld"
```## License
`tagger` is available under the MIT license. See the [LICENSE](LICENSE) file for more information.