Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thermondo/funlin
Kotlin Compiler Plugin for injecting function calls in the generated code using annotations.
https://github.com/thermondo/funlin
Last synced: 4 days ago
JSON representation
Kotlin Compiler Plugin for injecting function calls in the generated code using annotations.
- Host: GitHub
- URL: https://github.com/thermondo/funlin
- Owner: thermondo
- Created: 2024-12-17T11:39:37.000Z (10 days ago)
- Default Branch: main
- Last Pushed: 2024-12-17T17:16:06.000Z (10 days ago)
- Last Synced: 2024-12-17T17:32:16.068Z (10 days ago)
- Language: Kotlin
- Size: 50.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Funlin
### Installing
```kotlin
plugins {
//...
id("de.thermondo.funlin") version "latest_version"
}```
### Setup
##### in your module `build.gradle.kts`
```kotlin
funlin {
enabled.set(true)
annoatation.set("TrackIt")
callableTargetPath.set("dev.thermondo.android.app.AnyObjectNameYouWant.anyFunctionName")
}
```- Create your own `Annotation` and annotate your functions with it
- Create an `Object` that will be called when the function which is annotated with your `Annotation`
is called.##### Annotation
```kotlin
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.FUNCTION)
annotation class TrackIt
```##### Object
```kotlin
package any.packagename.you.need
object AnyObjectNameYouWant {
// parameter names are not important, but the types or the order are important.
fun anyFunctionName(
name: String,
parent: String,
body: String,
args: Map,
) {
// your code here, logging/tracking events, etc.
}
}
```> [!WARNING]
> Parameter names are not important, but the types or the order are important.##### In your code
```kotlin
@TrackIt
fun anyFunctionName(
anyParameterName: Any,
) {
// your code here
}
```> [!IMPORTANT]
> All arguments are supported as long as they give meaningful information when .toString() is called
> on them.
> If you want to use a custom object, make sure to override the `toString()` method for that object.---
[Documentation](https://github.com/thermondo/funlin/blob/main/docs/docs.md)