Browse Source

Use local SDK if the file exist

pull/1582/head
Benoit Marty 11 months ago committed by Benoit Marty
parent
commit
cc2664c519
  1. 13
      docs/_developer_onboarding.md
  2. 8
      libraries/matrix/impl/build.gradle.kts

13
docs/_developer_onboarding.md

@ -117,6 +117,10 @@ You can also have access to the aars through the [release](https://github.com/ma @@ -117,6 +117,10 @@ You can also have access to the aars through the [release](https://github.com/ma
#### Build the SDK locally
Easiest way: run the script [./tools/sdk/build_rust_sdk.sh](./tools/sdk/build_rust_sdk.sh) and just answer the questions.
Legacy way:
If you need to locally build the sdk-android you can use
the [build](https://github.com/matrix-org/matrix-rust-components-kotlin/blob/main/scripts/build.sh) script.
@ -147,15 +151,6 @@ Troubleshooting: @@ -147,15 +151,6 @@ Troubleshooting:
- If you get the error `thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', .cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-ndk-2.11.0/src/cli.rs:345:18` try updating your Cargo NDK version. In this case, 2.11.0 is too old so `cargo install cargo-ndk` to install a newer version.
- If you get the error `Unsupported class file major version 64` try changing your JVM version. In this case, Java 20 is not supported in Gradle yet, so downgrade to an earlier version (Java 17 worked in this case).
Finally let the `matrix/impl` module use this aar by changing the dependencies from `libs.matrix.sdk` to `projects.libraries.rustsdk`:
```groovy
dependencies {
api(projects.libraries.rustsdk) // <- use the local version of the sdk. Uncomment this line.
//implementation(libs.matrix.sdk) // <- use the released version. Comment this line.
}
```
You are good to test your local rust development now!
### The Android project

8
libraries/matrix/impl/build.gradle.kts

@ -29,8 +29,12 @@ anvil { @@ -29,8 +29,12 @@ anvil {
}
dependencies {
// implementation(projects.libraries.rustsdk)
implementation(libs.matrix.sdk)
if (file("${rootDir.path}/libraries/rustsdk/matrix-rust-sdk.aar").exists()) {
println("\nNote: Using local binary of the Rust SDK.\n")
implementation(projects.libraries.rustsdk)
} else {
implementation(libs.matrix.sdk)
}
implementation(projects.libraries.di)
implementation(projects.libraries.androidutils)
implementation(projects.libraries.network)

Loading…
Cancel
Save