rust/- At the root is the Rust crate which defines the UniFFI bindings
MobileSdkRs/: generated Swift librarytests/: contains cargo tests for Kotlin and Swift for the generated libraries. These tests act as sanity checks to ensure the generated libraries will be usable, and are not meant to be full-fledged functional tests.
android/MobileSdkRs/: generated Kotlin libraryMobileSdk/: Kotlin SDK built on top ofMobileSdkRsShowcase/: Showcase app, our reference app for this SDK
ios/MobileSdk/: Swift SDK built on top ofMobileSdkRS(underrust/)Showcase/: Showcase app, our reference app for this SDK
- XCodeGen
- you can install it on MacOS with
brew install xcodegen
- you can install it on MacOS with
- Rust targets for Android and iOS:
rustup target install \
armv7-linux-androideabi \
aarch64-linux-android \
i686-linux-android \
x86_64-linux-android \
aarch64-apple-ios-sim \
aarch64-apple-ios \
x86_64-apple-ioscargo-ndkcargo install cargo-ndk(or usecargo binstallfor a faster install)
cargo-swiftcargo install --git https://github.com/antoniusnaumann/cargo-swift
Everything is in a single Gradle project under ./android/, including the automatically generated Rust layer.
Make sure to open Android Studio through the terminal to have all your environment working (specifically to have cargo in the PATH):
open -na "Android Studio"You explore the Gradle tasks with ./gradlew projects, ./gradlew tasks and ./gradlew :<project>:tasks, but to get you started:
./gradlew buildwill build everything (if you only build Showcase it will still build the SDK and the Rust layer)./gradlew lintwill lint everything./gradlew testwill test everything
For developing the wallet application, use ./gradlew assembleDebug. In newer versions of Android Studio you may need to add this as
a 'gradle-aware make' task to the 'Before launch' configuration.
If you get this error: `> java.io.FileNotFoundException: .../local.properties (No such file or directory)`
run:
touch android/local.propertiesIf you have issues running the Kotlin uniffi tests in the Rust layer
In order to run the tests you'll need to install the kotlin compiler and download a copy of JNA
wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar
wget https://repo1.maven.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.4/kotlinx-coroutines-core-jvm-1.6.4.jar
JNA will also need to explicitly be on your CLASSPATH. Simply being in a directory doesn't necessarily work. Here is an example of how you might configure this in your .bashrc file
export CLASSPATH="/path/to/jna-5.14.0.jar:/path/to/kotlinx-coroutines-core-jvm-1.6.4.jar:$CLASSPATH"This lets you just run cargo test as normal.
Alternatively, if you don't like the addition to your environment you can specify it on every invocation of cargo test:
CLASSPATH="/path/to/jna-5.14.0.jar:/path/to/kotlinx-coroutines-core-jvm-1.6.4.jar" cargo testIn ./rust/
cargo swift package -p ios -n MobileSdkRs(Somewhat optional, if you want/need to use XCode) Run xcodegen in ./ios/MobileSdk to generate the XCode project.
This and the Rust layer are tied together with the Package.swift at the root of the repo.
Run xcodegen in ./ios/Showcase to generate the XCode project.
Use the cd Github Action which is a manually triggered action, and provide the version is the x.y.z format.
This is currently done manually and locally.