Skip to content

Commit

Permalink
update readme with local build instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryanmtate committed Oct 22, 2024
1 parent 788a98e commit 0005376
Show file tree
Hide file tree
Showing 4 changed files with 461 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
- name: Publish package to GHCR
uses: gradle/gradle-build-action@v2
with:
arguments: publish
arguments: publishReleasePublicationToGitHubPackagesRepository
build-root-directory: ./kotlin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ which is a manually triggered action.

## Pre-requisites

For developing Kotlin code, install `cargo-ndk`.

```bash
cargo install cargo-ndk
```

Ensure you have the following rust build targets installed:

```bash
Expand All @@ -44,6 +50,8 @@ rustup target install \
x86_64-linux-android
```

See the `cargo-ndk` [documentation](https://github.com/bbqsrc/cargo-ndk) for more information.

## Build

### Kotlin
Expand Down Expand Up @@ -98,3 +106,57 @@ specify it on every invocation of cargo test:
```bash
CLASSPATH="/path/to/jna-5.14.0.jar:/path/to/kotlinx-coroutines-core-jvm-1.6.4.jar" cargo test
```

## Local Development

### Kotlin

To locally test integration with `mobile-sdk-kt`, it is preferrable to use a `mavenLocal()` repository.

To release to `mavenLocal()` you may use the following command:

```bash
cd kotlin/ && VERSION=x.y.z ./gradlew publishDebugPublicationToMavenLocal
```

Where `VERSION` is set to a SemVer (Semantic Versioning). Note that it is possible to use a tagged version, e.g. `0.0.33-SNAPSHOT`, which may be preferrable to denote
that a certain release version is a local release. Other values may be used instead of `SNAPSHOT`.

When adding the local repository to `mobile-sdk-kt`, update the version in the `build.gradle` file:

```kotlin
api("com.spruceid.mobile.sdk.rs:mobilesdkrs:x.y.z-SNAPSHOT")
```

### Swift

To test local intgration with `mobile-sdk-swift`, update the `Package.swift` file target to use a local `path` binary target. For example:

```swift
targets: [
.binaryTarget(name: "RustFramework", path: "./MobileSdkRs/RustFramework.xcframework"),
.target(
name: "SpruceIDMobileSdkRs",
dependencies: [
.target(name: "RustFramework")
],
path: "./MobileSdkRs/Sources/MobileSdkRs"
),
]
```

> NOTE: For production release, it will be important to replace the binary target with an actual release artifact or revision tag, for example:
> ```
> .binaryTarget(name: "RustFramework", url: "https://github.com/spruceid/mobile-sdk-rs/releases/download/0.0.36/RustFramework.xcframework.zip", checksum: "df587ab46f3604df744a9394c229be40e9a65102429ff1b0379dfeb6ca7fdc3c")
> ```

And update the `packages` property in `project.yml` file in `mobile-sdk-swift` to use the local path to `mobile-sdk-rs`, for example:

```yml
packages:
SpruceIDMobileSdkRs:
path: "../mobile-sdk-rs"
```
Finally, run `xcodegen` in `mobile-sdk-swift` to generate the `xcodeproject` file to open in xcode.
Loading

0 comments on commit 0005376

Please sign in to comment.