Browse Source

Update the doc, mainly add formatting.

misc/jme/add-logging-to-state-machine
Benoit Marty 2 years ago
parent
commit
b0478862c1
  1. 62
      docs/_developer_onboarding.md

62
docs/_developer_onboarding.md

@ -9,6 +9,8 @@
* [Event](#event) * [Event](#event)
* [Sync](#sync) * [Sync](#sync)
* [Rust SDK](#rust-sdk) * [Rust SDK](#rust-sdk)
* [Matrix Rust Component Kotlin](#matrix-rust-component-kotlin)
* [Build the SDK locally](#build-the-sdk-locally)
* [The Android project](#the-android-project) * [The Android project](#the-android-project)
* [Application](#application) * [Application](#application)
* [Jetpack Compose](#jetpack-compose) * [Jetpack Compose](#jetpack-compose)
@ -90,50 +92,70 @@ This is managed by the Rust SDK.
### Rust SDK ### Rust SDK
The Rust SDK is hosted here : https://github.com/matrix-org/matrix-rust-sdk The Rust SDK is hosted here: https://github.com/matrix-org/matrix-rust-sdk.
This repository contains an implementation of a Matrix client-server library in Rust.
With some bindings we can embed this sdk inside other environments, like Swift or Kotlin, with the help This repository contains an implementation of a Matrix client-server library written in Rust.
of [Uniffi](https://github.com/mozilla/uniffi-rs)
With some bindings we can embed this sdk inside other environments, like Swift or Kotlin, with the help of [Uniffi](https://github.com/mozilla/uniffi-rs).
From these kotlin bindings we can generate native libs (.so files) and kotlin classes/interfaces. From these kotlin bindings we can generate native libs (.so files) and kotlin classes/interfaces.
#### Matrix Rust Component Kotlin
To use these bindings in an android project, we need to wrap this up into an android library (as the form of an .aar file). To use these bindings in an android project, we need to wrap this up into an android library (as the form of an .aar file).
This is the goal of https://github.com/matrix-org/matrix-rust-components-kotlin This is the goal of https://github.com/matrix-org/matrix-rust-components-kotlin.
This repository is used for distributing kotlin releases of the Matrix Rust SDK. This repository is used for distributing kotlin releases of the Matrix Rust SDK.
It'll provide the corresponding aar and also publish them on maven. It'll provide the corresponding aar and also publish them on maven.
Most of the time you want to use the releases made on maven with gradle `implementation("org.matrix.rustcomponents:sdk-android:latest-version")` Most of the time you want to use the releases made on maven with gradle:
```groovy
implementation("org.matrix.rustcomponents:sdk-android:latest-version")
```
You can also have access to the aars through the [release](https://github.com/matrix-org/matrix-rust-components-kotlin/releases) page. You can also have access to the aars through the [release](https://github.com/matrix-org/matrix-rust-components-kotlin/releases) page.
#### Build the SDK locally
If you need to locally build the sdk-android you can use 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. the [build](https://github.com/matrix-org/matrix-rust-components-kotlin/blob/main/scripts/build.sh) script.
For this, you first need to ensure to setup : For this, you first need to ensure to setup :
- rust environment (check https://rust-lang.github.io/rustup/ if needed) - rust environment (check https://rust-lang.github.io/rustup/ if needed)
- cargo-ndk < 2.12.0 `cargo install cargo-ndk --version 2.11.0` - cargo-ndk < 2.12.0
- android targets `rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android` ```shell
- checkout both matrix-rust-sdk and matrix-rust-components-kotlin repositories cargo install cargo-ndk --version 2.11.0
```
- android targets
```shell
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
```
- checkout both [matrix-rust-sdk](https://github.com/matrix-org/matrix-rust-sdk) and [matrix-rust-components-kotlin](https://github.com/matrix-org/matrix-rust-components-kotlin) repositories
```shell
git clone git@github.com:matrix-org/matrix-rust-sdk.git
git clone git@github.com:matrix-org/matrix-rust-components-kotlin.git
```
Then you can launch the build script with the following params: Then you can launch the build script with the following params:
-p Local path to the rust-sdk repository - `-p` Local path to the rust-sdk repository
-o Optional output path with the expected name of the aar file. By default the aar will be located in the corresponding build/outputs/aar directory. - `-o` Optional output path with the expected name of the aar file. By default the aar will be located in the corresponding build/outputs/aar directory.
-r Flag to build in release mode - `-r` Flag to build in release mode
-m Option to select the gradle module to build. Default is sdk. - `-m` Option to select the gradle module to build. Default is sdk.
-t Option to to select an android target to build against. Default will build for all targets. - `-t` Option to to select an android target to build against. Default will build for all targets.
So for example to build the sdk against aarch64-linux-android target and copy the generated aar to ElementX project: So for example to build the sdk against aarch64-linux-android target and copy the generated aar to ElementX project:
`./scripts/build.sh -p matrix-rust-sdk-path -t aarch64-linux-android -o element-x-android-path/libraries/rustsdk/matrix-rust-sdk.aar` ```shell
./scripts/build.sh -p [YOUR MATRIX RUST SDK PATH] -t aarch64-linux-android -o [YOUR element-x-android PATH]/libraries/rustsdk/matrix-rust-sdk.aar
```
Finally let the `matrix/impl` module use this aar by switching those lines in the gradle file : Finally let the `matrix/impl` module use this aar by switching those lines in the gradle file :
``` ```groovy
dependencies { dependencies {
api(projects.libraries.rustsdk) // <- comment this line
api(projects.libraries.rustsdk) // api(libs.matrix.sdk) // <- uncomment this line
// api(libs.matrix.sdk)
...
} }
``` ```

Loading…
Cancel
Save