Skip to content

Commit 6afe289

Browse files
authored
Update readme (#19)
Signed-off-by: conanoc <[email protected]>
1 parent 0298ab5 commit 6afe289

File tree

5 files changed

+70
-60
lines changed

5 files changed

+70
-60
lines changed

DEVELOP.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
## Requirements
2+
3+
Rust is required to build the project. Xcode is required to build and test Swift wrappers.
4+
Andriod Stuio and Docker Desktop are required to build and test Android wrappers.
5+
6+
## Swift wrappers
7+
8+
### Build
9+
10+
Create Swift bindings by running `build-swift-framework.sh`. This will create xcframeworks from the
11+
static libraries generated by UniFFI. It also creates Swift bindings and copy them to `swift/Sources` directory.
12+
13+
### Test
14+
15+
Run `USE_LOCAL_XCFRAMEWORK=1 swift test`. This will build the Swift package and run all the tests.
16+
17+
### Publish
18+
19+
Swift xcframeworks are created in `out` directory of each modules.
20+
For example, anoncreds xcframework file is created at `anoncreds/out/anoncreds_uniffiFFI.xcframework`.
21+
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.
22+
23+
## Kotlin wrappers
24+
25+
### Build
26+
27+
Create Kotlin bindings by running `build-kotlin-libraries.sh`. This will create libraries and Kotlin bindings in `out/kmpp-uniffi` directory.
28+
29+
### Test
30+
31+
Go to one of the Kotlin projects, e.g., `kotlin/anoncreds` and run tests using `./gradlew jvmTest`.
32+
33+
### Publish
34+
35+
#### Publish to Maven Local
36+
37+
Run `./gradlew publishToMavenLocal` to publish to Maven Local.
38+
39+
To use Maven Local in a seperate project you'll want to make sure to add it inside of your `build.gradle.kts`.
40+
```kotlin
41+
repositories {
42+
mavenLocal()
43+
mavenCentral()
44+
google()
45+
}
46+
```
47+
48+
#### Publish Kotlin libraries to github
49+
50+
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).
51+
52+
Once you have a token you will want to add both your token and your github username into `kotlin/${library}/local.properties` like so:
53+
```
54+
githubUsername=ExampleUsername
55+
githubToken=ghp_ajsldk1FakeTokenjkash
56+
```
57+
58+
Now you can publish to github packages using `./gradlew publishAllPublicationsToGithubRepository`.

README.md

Lines changed: 11 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -31,65 +31,18 @@ And add the following dependency to your target:
3131
),
3232
```
3333

34-
Take a look at the tests in `Tests` folder for examples on how to use the wrappers.
34+
Take a look at the tests in `swift/Tests` directory for examples on how to use the wrappers.
3535

3636
### Kotlin
3737

38-
The Kotlin wrappers are set up to be distributed as a Maven package. In the future we aim to have releases on github packages. For now you will either have to use Maven Local or fork this repository and publish it yourself.
39-
40-
#### Generate Kotlin bindings
41-
42-
First step before publishing will be to generate the bindings. To generate all bindings for Kotlin just run the `build-kotlin-libraries.sh` file from root. You can also generate bindings for a specific library by running the `build-kotlin-libraries.sh` found inside of target library's directory. (ie: `/askar/build-kotlin-library.sh`)
43-
44-
#### Publish Kotlin libraries with Maven Local
45-
46-
Once bindings have been generated we can now publish to Maven Local. To do so we'll cd into the target kotlin wrapper (ie: `/kotlin/askar/`) and then we will run `./gradlew publishToMavenLocal`.
47-
48-
To use Maven Local in a seperate project you'll want to make sure to add it inside of your `build.gradle.kts`
49-
```kotlin
50-
repositories {
51-
mavenLocal()
52-
mavenCentral()
53-
google()
54-
}
55-
```
56-
57-
#### Publish Kotlin libraries to github
58-
59-
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)
60-
61-
Once you have a token we will want to add both your token and your github username into `kotlin/${library}/local.properties` like so:
62-
```
63-
githubUsername=ExampleUsername
64-
githubToken=ghp_ajsldk1FakeTokenjkash
65-
```
66-
Next you'll want to make sure you are targetting the correct URL for publishing. Make sure that the `setUrl` function in `kotlin/${library}/build.gradle.kts` targets your fork's URL instead of the main repository's.
67-
68-
```kotlin
69-
publishing{
70-
repositories{
71-
maven{
72-
name = "github"
73-
setUrl("https://maven.pkg.github.com/${FORK_DIRECTORY}/aries-uniffi-wrappers")
74-
credentials {
75-
username = getExtraString("githubUsername")
76-
password = getExtraString("githubToken")
77-
}
78-
}
79-
}
80-
...
81-
}
82-
```
83-
84-
Now we can publish to github packages. You'll want to call `./gradlew publishAllPublicationsToGithubRepository` inside of the target wrapper root directory.
85-
38+
The Kotlin wrappers are distributed as a Maven package hosted by GitHub Packages.
8639
To add a github packages repository in a seperate project you will have to have a github token with `read:packages` permissions. Then you will add the repository to your `build.gradle.kts` like so:
8740
```kotlin
8841
repositories {
8942
mavenCentral()
9043
google()
9144
maven {
92-
setUrl("https://maven.pkg.github.com/${FORK_DIRECTORY}/aries-uniffi-wrappers")
45+
setUrl("https://maven.pkg.github.com/hyperledger/aries-uniffi-wrappers")
9346
credentials {
9447
username = getExtraString("githubUsername")
9548
password = getExtraString("githubToken")
@@ -98,21 +51,23 @@ To add a github packages repository in a seperate project you will have to have
9851
}
9952
```
10053

101-
#### Adding as a dependency
102-
103-
Now all we have to do is add the libraries as a dependency in your `build.gradle.kts` like so:
54+
Now you will add the libraries as a dependency in your `build.gradle.kts` like so:
10455
```kotlin
10556
dependencies {
106-
implementation("org.hyperledger:anoncreds_uniffi:0.1.0-wrapper.1")
107-
implementation("org.hyperledger:indy_vdr_uniffi:0.1.0-wrapper.1")
108-
implementation("org.hyperledger:askar_uniffi:0.1.0-wrapper.1")
57+
implementation("org.hyperledger:anoncreds_uniffi:0.1.1-wrapper.1")
58+
implementation("org.hyperledger:indy_vdr_uniffi:0.1.1-wrapper.1")
59+
implementation("org.hyperledger:askar_uniffi:0.1.1-wrapper.1")
10960
}
11061
```
11162

63+
Take a look at the tests in `kotlin/${library}/src/commonTest` for usage examples.
64+
11265
## Contributing
11366

11467
Pull requests are welcome! We enforce [developer certificate of origin](https://developercertificate.org/) (DCO) commit signing. See guidance [here](https://github.com/apps/dco).
11568

69+
Please see our [Developer Guide](DEVELOP.md) for more information.
70+
11671
## License
11772

11873
Aries uniffi wrappers are licensed under the [Apache License 2.0](LICENSE).

anoncreds/build-kotlin-library.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ cargo install cross --git https://github.com/cross-rs/cross
4444
# Build for android targets
4545
for target in "${android_targets[@]}"; do
4646
echo "Building for $target..."
47-
rustup toolchain install 1.65.0 --target $target
4847
cross build --release --target $target
4948
done
5049

askar/build-kotlin-library.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ cargo install cross --git https://github.com/cross-rs/cross
4444
# Build for android targets
4545
for target in "${android_targets[@]}"; do
4646
echo "Building for $target..."
47-
rustup toolchain install 1.65.0 --target $target
4847
cross build --release --target $target
4948
done
5049

indy-vdr/build-kotlin-library.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ cargo install cross --git https://github.com/cross-rs/cross
4545
# Build for android targets
4646
for target in "${android_targets[@]}"; do
4747
echo "Building for $target..."
48-
rustup toolchain install 1.65.0 --target $target
4948
cross build --release --target $target
5049
done
5150

@@ -62,4 +61,4 @@ echo "Generating wrapper..."
6261
mkdir -p $OUT_PATH
6362
cargo install --bin uniffi-bindgen-kotlin-multiplatform [email protected]
6463
CURRENT_ARCH=$(rustc --version --verbose | grep host | cut -f2 -d' ')
65-
uniffi-bindgen-kotlin-multiplatform --lib-file ./target/$CURRENT_ARCH/release/$LIBRARY_NAME --out-dir $OUT_PATH uniffi/indy_vdr_uniffi.udl
64+
uniffi-bindgen-kotlin-multiplatform --lib-file ./target/$CURRENT_ARCH/release/$LIBRARY_NAME --out-dir $OUT_PATH uniffi/indy_vdr_uniffi.udl

0 commit comments

Comments
 (0)