-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: conanoc <[email protected]>
- Loading branch information
Showing
5 changed files
with
70 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
## Requirements | ||
|
||
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. | ||
|
||
## Swift wrappers | ||
|
||
### Build | ||
|
||
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. | ||
|
||
### Test | ||
|
||
Run `USE_LOCAL_XCFRAMEWORK=1 swift test`. This will build the Swift package and run all the tests. | ||
|
||
### Publish | ||
|
||
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. | ||
|
||
## Kotlin wrappers | ||
|
||
### Build | ||
|
||
Create Kotlin bindings by running `build-kotlin-libraries.sh`. This will create libraries and Kotlin bindings in `out/kmpp-uniffi` directory. | ||
|
||
### Test | ||
|
||
Go to one of the Kotlin projects, e.g., `kotlin/anoncreds` and run tests using `./gradlew jvmTest`. | ||
|
||
### Publish | ||
|
||
#### Publish to Maven Local | ||
|
||
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`. | ||
```kotlin | ||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
google() | ||
} | ||
``` | ||
|
||
#### Publish Kotlin libraries to github | ||
|
||
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](https://docs.github.com/en/packages/learn-github-packages/about-permissions-for-github-packages#about-scopes-and-permissions-for-package-registries). | ||
|
||
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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,6 @@ cargo install cross --git https://github.com/cross-rs/cross | |
# Build for android targets | ||
for target in "${android_targets[@]}"; do | ||
echo "Building for $target..." | ||
rustup toolchain install 1.65.0 --target $target | ||
cross build --release --target $target | ||
done | ||
|
||
|
@@ -62,4 +61,4 @@ echo "Generating wrapper..." | |
mkdir -p $OUT_PATH | ||
cargo install --bin uniffi-bindgen-kotlin-multiplatform [email protected] | ||
CURRENT_ARCH=$(rustc --version --verbose | grep host | cut -f2 -d' ') | ||
uniffi-bindgen-kotlin-multiplatform --lib-file ./target/$CURRENT_ARCH/release/$LIBRARY_NAME --out-dir $OUT_PATH uniffi/indy_vdr_uniffi.udl | ||
uniffi-bindgen-kotlin-multiplatform --lib-file ./target/$CURRENT_ARCH/release/$LIBRARY_NAME --out-dir $OUT_PATH uniffi/indy_vdr_uniffi.udl |