Skip to content

Commit

Permalink
chore(bindings): Move matrix-sdk-ffi and matrix-sdk-crypto-ffi in…
Browse files Browse the repository at this point in the history
…to the `bindings/` directory

chore(bindings): Move `matrix-sdk-ffi` and `matrix-sdk-crypto-ffi` into the `bindings/` directory
  • Loading branch information
Hywan authored Jun 23, 2022
2 parents f3a6102 + 818d715 commit 091fab8
Show file tree
Hide file tree
Showing 33 changed files with 80 additions and 69 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/bindings_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,44 @@ jobs:
- name: Build the documentation
working-directory: ${{ env.MATRIX_SDK_CRYPTO_JS_PATH }}
run: npm run doc

test-apple:
name: matrix-rust-components-swift
runs-on: macos-12

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true

- name: Install targets
run: |
rustup target add aarch64-apple-ios-sim --toolchain nightly
rustup target add x86_64-apple-ios --toolchain nightly
- name: Load cache
uses: Swatinem/rust-cache@v1

- name: Install Uniffi
uses: actions-rs/cargo@v1
with:
command: install
# keep in sync with uniffi dependency in Cargo.toml's
args: uniffi_bindgen --version ^0.18

- name: Generate .xcframework
run: sh bindings/apple/debug_build_xcframework.sh ci

- name: Run XCTests
run: |
xcodebuild test \
-project bindings/apple/MatrixRustSDK.xcodeproj \
-scheme MatrixRustSDK \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 13,OS=15.4'
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: nextest
args: run
args: run --workspace

- name: Test documentation
uses: actions-rs/cargo@v1
Expand Down
58 changes: 0 additions & 58 deletions .github/workflows/ffi.yml

This file was deleted.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[workspace]
members = [
"benchmarks",
"bindings/matrix-sdk-crypto-ffi",
"bindings/matrix-sdk-crypto-js",
"bindings/matrix-sdk-crypto-nodejs",
"bindings/matrix-sdk-ffi",
"crates/*",
"labs/*",
"xtask",
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ the API will change in breaking ways.
If you are interested in using the matrix-sdk now is the time to try it out and
provide feedback.

## Bindings

Some crates of the **matrix-rust-sdk** can be embedded inside other
environments, like Swift, Kotlin, JavaScript, Node.js etc. Please,
explore the [`bindings/`](./bindings/) directory to learn more.

## License

[Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
22 changes: 22 additions & 0 deletions bindings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Matrix Rust SDK bindings

In this directory, one can find bindings to the Rust SDK that are
maintained by the owners of the Matrix Rust SDK project.

* [`apple`] or `matrix-rust-components-swift`, Swift bindings of the
[`matrix-sdk`] crate via [`matrix-sdk-ffi`],
* [`matrix-sdk-crypto-ffi`], bindings of the [`matrix-sdk-crypto`]
crate,
* [`matrix-sdk-crypto-js`], JavaScript bindings of the
[`matrix-sdk-crypto`] crate,
* [`matrix-sdk-crypto-nodejs`], Node.js bindings of the
[`matrix-sdk-crypto`] crate,
* [`matrix-sdk-ffi`], bindings of the [`matrix-sdk`] crate,

[`apple`]: ./apple
[`matrix-sdk-crypto-ffi`]: ./matrix-sdk-crypto-ffi
[`matrix-sdk-crypto-js`]: ../crates/matrix-sdk-crypto
[`matrix-sdk-crypto-nodejs`]: ../crates/matrix-sdk-crypto
[`matrix-sdk-crypto`]: ../crates/matrix-sdk-crypto
[`matrix-sdk-ffi`]: ./matrix-sdk-ffi
[`matrix-sdk`]: ../crates/matrix-sdk
2 changes: 1 addition & 1 deletion bindings/apple/build_xcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ lipo -create \


# Generate uniffi files
uniffi-bindgen generate "${SRC_ROOT}/crates/matrix-sdk-ffi/src/api.udl" --language swift --out-dir ${GENERATED_DIR}
uniffi-bindgen generate "${SRC_ROOT}/bindings/matrix-sdk-ffi/src/api.udl" --language swift --out-dir ${GENERATED_DIR}

# Move them to the right place
HEADERS_DIR=${GENERATED_DIR}/headers
Expand Down
2 changes: 1 addition & 1 deletion bindings/apple/debug_build_xcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ lipo -create \
-output "${GENERATED_DIR}/libmatrix_sdk_ffi_iossimulator.a"

# Generate uniffi files
uniffi-bindgen generate "${SRC_ROOT}/crates/matrix-sdk-ffi/src/api.udl" --language swift --out-dir ${GENERATED_DIR}
uniffi-bindgen generate "${SRC_ROOT}/bindings/matrix-sdk-ffi/src/api.udl" --language swift --out-dir ${GENERATED_DIR}

# Move them to the right place
HEADERS_DIR=${GENERATED_DIR}/headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ version = "0.2.2"
features = ["lax_deserialize"]

[dependencies.matrix-sdk-common]
path = "../matrix-sdk-common"
path = "../../crates/matrix-sdk-common"
version = "0.5.0"

[dependencies.matrix-sdk-crypto]
path = "../matrix-sdk-crypto"
path = "../../crates/matrix-sdk-crypto"
version = "0.5.0"
features = ["qrcode", "backups_v1"]

[dependencies.matrix-sdk-sled]
path = "../matrix-sdk-sled"
path = "../../crates/matrix-sdk-sled"
version = "0.1.0"
default_features = false
features = ["crypto-store"]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ anyhow = "1.0.51"
extension-trait = "1.0.1"
futures-core = "0.3.17"
futures-util = { version = "0.3.17", default-features = false }
matrix-sdk = { path = "../matrix-sdk", features = ["experimental-timeline", "markdown"] }
matrix-sdk = { path = "../../crates/matrix-sdk", features = ["experimental-timeline", "markdown"] }
once_cell = "1.10.0"
parking_lot = "0.12.0"
sanitize-filename-reader-friendly = "2.2.1"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 2 additions & 4 deletions codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ coverage:
informational: true
paths:
- "bindings/"
- "crates/matrix-sdk-crypto-ffi/"
- "crates/matrix-sdk-ffi/"
patch: off
ignore:
- "bindings/matrix-sdk-crypto-ffi"
- "bindings/matrix-sdk-crypto-js"
- "bindings/matrix-sdk-crypto-nodejs"
- "crates/matrix-sdk-crypto-ffi"
- "crates/matrix-sdk-ffi"
- "bindings/matrix-sdk-ffi"
- "crates/matrix-sdk-indexeddb"
- "crates/matrix-sdk-test"
- "crates/matrix-sdk-test-macros"
Expand Down

0 comments on commit 091fab8

Please sign in to comment.