Rust is required to build the project. Xcode is required to build and test Swift wrappers. Andriod Stuio and Docker Desktop are required to build and test Android wrappers.
Create Swift bindings by running build-swift-framework.sh
. This will create xcframeworks from the
static libraries generated by UniFFI. It also creates Swift bindings and copy them to swift/Sources
directory.
Run USE_LOCAL_XCFRAMEWORK=1 swift test
. This will build the Swift package and run all the tests.
Swift xcframeworks are created in out
directory of each modules.
For example, anoncreds xcframework file is created at anoncreds/out/anoncreds_uniffiFFI.xcframework
.
Zip the xcframework to a zip file using zip -rq anoncreds/out/anoncreds_uniffiFFI.xcframework.zip anoncreds/out/anoncreds_uniffiFFI.xcframework
and then upload it as a github release asset. Checksum can be computed using swift package compute-checksum anoncreds/out/anoncreds_uniffiFFI.xcframework.zip
. Finally, update the url
and checksum
properties of binaray targets in the Package.swift file. Note that we need to create a tag after the update of Package.swift.
Create Kotlin bindings by running build-kotlin-libraries.sh
. This will create libraries and Kotlin bindings in out/kmpp-uniffi
directory.
Go to one of the Kotlin projects, e.g., kotlin/anoncreds
and run tests using ./gradlew jvmTest
.
Run ./gradlew publishToMavenLocal
to publish to Maven Local.
To use Maven Local in a seperate project you'll want to make sure to add it inside of your build.gradle.kts
.
repositories {
mavenLocal()
mavenCentral()
google()
}
Publishing to github will require you to do a couple more steps. First we will want to get a github token with write:packages
permissions, more details can be found here.
Once you have a token you will want to add both your token and your github username into kotlin/${library}/local.properties
like so:
githubUsername=ExampleUsername
githubToken=ghp_ajsldk1FakeTokenjkash
Now you can publish to github packages using ./gradlew publishAllPublicationsToGithubRepository
.