Crates.io | uniffi_bindgen_kotlin_multiplatform |
lib.rs | uniffi_bindgen_kotlin_multiplatform |
version | 0.1.0 |
source | src |
created_at | 2023-11-25 21:45:52.13841 |
updated_at | 2023-11-25 21:45:52.13841 |
description | a Kotlin Multiplatform bindings generator for rust (codegen and cli tooling) |
homepage | https://trixnity.gitlab.io/uniffi-kotlin-multiplatform-bindings |
repository | https://gitlab.com/trixnity/uniffi-kotlin-multiplatform-bindings |
max_upload_size | |
id | 1048593 |
size | 161,925 |
This project contains Kotlin Multiplatform bindings generation for UniFFI.
Currently only the Kotlin targets JVM and Native are supported. JS support would be awesome, but needs WASM support within uniffi.
You can find examples on how to use the bindings in the tests directory.
As neither the bindgen crate nor the Gradle plugin are published yet, you have to do some additional Gradle configuration. (See below Use locally)
plugins {
kotlin("multiplatform")
id("io.gitlab.trixnity.uniffi.kotlin.multiplatform") version "0.1.0"
}
uniffi {
// The directory containing the Rust crate.
crateDirectory = layout.projectDirectory.dir("rust")
// The name of the crate as in Cargo.toml's package.name.
crateName = "my_crate"
// The name of the library as in Cargo.toml's library.name. Defaults to "${crateName}".
libraryName = "my_crate"
// The UDL file. Defaults to "${crateDirectory}/src/${crateName}.udl".
udlFile = layout.projectDirectory.file("rust/src/my_crate.udl")
// The UDL namespace as in the UDL file. Defaults to "${crateName}".
namespace = "my_crate"
// The profile to build the crate. Defaults to "debug".
profile = "debug"
}
kotlin {
// The plugin will react to the targets definition
jvm()
linuxX64()
}
TODO
As neither the bindgen crate nor the Gradle plugin are published yet, you have to do some additional Gradle configuration.
Clone the repository and build it.
Add a publishing repository definition at the end of build-logic/gradle-plugin/build.gradle.kts
:
publishing {
repositories {
maven {
name = "local"
url = uri("<path-to-local-plugin-repository>")
}
}
}
Then invoke ./gradlew :build-logic:gradle-plugin:publishAllPublicationsToLocalRepository
.
Add the local repository in you settings.gradle.kts
:
pluginManagement {
repositories {
maven {
name = "local"
url = uri("<path-to-local-plugin-repository>")
}
// ...
}
}
Finally, configure the uniffi
extension with the exact path to the bindgen of this repository.
uniffi {
// ...
bindgenCratePath = "<path-to-our-bindgen>"
}