symbol-export

Exporting library symbols into generated Symbols objects for tooling use, enabling compile-time errors on symbol renames, integrating with compiler plugins, symbol processors and code-gen tools, plus annotation read/write.

JVMKotlin/NativeWasmJS
GitHub stars2
Authorsrnett
Dependents1
LicenseApache License 2.0
Creation date12 months ago

Last activity3 days ago
Latest release0.0.4 (about 2 months ago)

Maven Central Version Maven snapshots Documentation GitHub License

Symbol-export

Symbol-export is a tool for exporting symbols from Kotlin libraries so that they can be referenced by tooling such as compiler plugins or annotation processors.

Features:

  • Compile time errors if symbol names change
  • Integrations with the Kotlin compiler, KSP, and Kotlinpoet
  • Reading and writing of annotation instances, including their arguments, from compiler plugins or annotation processors

[!WARNING] Compatibility of compiler plugins with Kotlin's Incremental Compilation is somewhat iffy and may cause issues in some scenarios.

Getting started

All you need to do is apply the Gradle plugins to the appropriate projects and add a dependency between the exported symbols and the project that uses them.

Exporting project

build.gradle.kts
plugins {
    id("dev.rnett.symbol-export.export")
}

name = "foobar"
Your code
package foo.bar

@ExportSymbol
fun bar() {
}

@ExportSymbol
class FooService {
}

Importing project

build.gradle.kts
plugins {
    id("dev.rnett.symbol-export.import")
}

dependencies {
    importSymbols(project(":foobar"))
}
Your code
val bar = Symbols.foobar.foo_bar_bar
val fooService = Symbols.foobar.foo_bar_FooService

By default, the Symbols object is generated with a package matching the importing project's group ID.

Documentation

Documentation can be found at symbol-export.rnett.dev.

JVMKotlin/NativeWasmJS
GitHub stars2
Authorsrnett
Dependents1
LicenseApache License 2.0
Creation date12 months ago

Last activity3 days ago
Latest release0.0.4 (about 2 months ago)

Maven Central Version Maven snapshots Documentation GitHub License

Symbol-export

Symbol-export is a tool for exporting symbols from Kotlin libraries so that they can be referenced by tooling such as compiler plugins or annotation processors.

Features:

  • Compile time errors if symbol names change
  • Integrations with the Kotlin compiler, KSP, and Kotlinpoet
  • Reading and writing of annotation instances, including their arguments, from compiler plugins or annotation processors

[!WARNING] Compatibility of compiler plugins with Kotlin's Incremental Compilation is somewhat iffy and may cause issues in some scenarios.

Getting started

All you need to do is apply the Gradle plugins to the appropriate projects and add a dependency between the exported symbols and the project that uses them.

Exporting project

build.gradle.kts
plugins {
    id("dev.rnett.symbol-export.export")
}

name = "foobar"
Your code
package foo.bar

@ExportSymbol
fun bar() {
}

@ExportSymbol
class FooService {
}

Importing project

build.gradle.kts
plugins {
    id("dev.rnett.symbol-export.import")
}

dependencies {
    importSymbols(project(":foobar"))
}
Your code
val bar = Symbols.foobar.foo_bar_bar
val fooService = Symbols.foobar.foo_bar_FooService

By default, the Symbols object is generated with a package matching the importing project's group ID.

Documentation

Documentation can be found at symbol-export.rnett.dev.