An open API service indexing awesome lists of open source software.

https://github.com/karmakrafts/introspekt

Positional code and compile-time introspection API for Kotlin/Multiplatform.
https://github.com/karmakrafts/introspekt

compiler-plugin introspection kotlin kotlin-common kotlin-compiler kotlin-compiler-plugin kotlin-js kotlin-jvm kotlin-native trace tracing

Last synced: 15 days ago
JSON representation

Positional code and compile-time introspection API for Kotlin/Multiplatform.

Awesome Lists containing this project

README

        

# Introspekt

[![](https://git.karmakrafts.dev/kk/introspekt/badges/master/pipeline.svg)](https://git.karmakrafts.dev/kk/introspekt/-/pipelines)
[![](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo.maven.apache.org%2Fmaven2%2Fdev%2Fkarmakrafts%2Fintrospekt%2Fintrospekt-runtime%2Fmaven-metadata.xml
)](https://git.karmakrafts.dev/kk/introspekt/-/packages)
[![](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Fdev%2Fkarmakrafts%2Fintrospekt%2Fintrospekt-runtime%2Fmaven-metadata.xml
)](https://git.karmakrafts.dev/kk/introspekt/-/packages)

Introspekt is a positional code API and introspection framework for Kotlin Multiplatform.
It currently adds the following features:

* `SourceLocation` type with access to module name, file path, function name, line and column
* `FunctionInfo` type for introspecting current/caller function signature and location
* `ClassInfo` type for introspecting current/caller classes including functions
* `AnnotationUsageInfo` type for introspecting annotation types and their parameters
* `TypeInfo` type for fundamental RTTI integrated with **kotlin.reflect** to fix gaps on Kotlin/JS and other platforms
* Default-parameter inlining for intrinsic types listed above (like `std::source_location` in C++)
* Compile-time evaluation of location hashes to improve runtime performance for positional memoization

### How to use it

First, add the official Maven Central repository to your `settings.gradle.kts`:

```kotlin
pluginManagement {
repositories {
maven("https://central.sonatype.com/repository/maven-snapshots")
mavenCentral()
}
}

dependencyResolutionManagement {
repositories {
maven("https://central.sonatype.com/repository/maven-snapshots")
mavenCentral()
}
}
```

Then add a dependency on the plugin in your root buildscript:

```kotlin
plugins {
id("dev.karmakrafts.introspekt.introspekt-gradle-plugin") version ""
}

kotlin {
sourceSets {
commonMain {
dependencies {
implementation("dev.karmakrafts.introspekt:introspekt-runtime:")
}
}
}
}
```