Skip to content

feat(wasm): complete PR of all wasm related changes to compile matrix-sdk-ffi bindings #5127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 103 additions & 91 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = [
"benchmarks",
"bindings/matrix-sdk-crypto-ffi",
"bindings/matrix-sdk-ffi",
"bindings/matrix-sdk-ffi-web",
"crates/*",
"examples/*",
"labs/*",
Expand Down Expand Up @@ -94,8 +95,9 @@ tracing = { version = "0.1.40", default-features = false, features = ["std"] }
tracing-core = "0.1.32"
tracing-subscriber = "0.3.18"
unicode-normalization = "0.1.24"
uniffi = { version = "0.28.0" }
uniffi_bindgen = { version = "0.28.0" }
uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "c7f6caa3d1bf20f934346cefd8e82b5093f0dc6f" }
uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs", rev = "c7f6caa3d1bf20f934346cefd8e82b5093f0dc6f" }
uniffi_core = { git = "https://github.com/mozilla/uniffi-rs", rev = "c7f6caa3d1bf20f934346cefd8e82b5093f0dc6f" }
url = "2.5.4"
uuid = "1.12.1"
vodozemac = { version = "0.9.0", features = ["insecure-pk-encryption"] }
Expand Down
17 changes: 17 additions & 0 deletions bindings/matrix-sdk-ffi-web/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "matrix-sdk-ffi-web"
version = "0.1.0"
edition = "2021"

[dependencies]
matrix-sdk-ffi = { path = "../matrix-sdk-ffi/", features = ["js"] }
uniffi = { workspace = true }

[build-dependencies]
uniffi = { workspace = true, features = ["build"] }

[dev-dependencies]
uniffi = { workspace = true, features = ["bindgen-tests"] }

[lib]
crate-type = ["lib", "staticlib", "cdylib"]
1 change: 1 addition & 0 deletions bindings/matrix-sdk-ffi-web/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub use matrix_sdk_ffi;
69 changes: 39 additions & 30 deletions bindings/matrix-sdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ publish = false
release = true

[lib]
crate-type = ["cdylib", "staticlib"]
crate-type = ["lib", "cdylib", "staticlib"]

[features]
default = ["bundled-sqlite", "unstable-msc4274"]
bundled-sqlite = ["matrix-sdk/bundled-sqlite"]
unstable-msc4274 = ["matrix-sdk-ui/unstable-msc4274"]
js = []

[dependencies]
anyhow.workspace = true
as_variant.workspace = true
async-compat = "0.2.4"
extension-trait = "1.0.1"
eyeball-im.workspace = true
futures-util.workspace = true
Expand All @@ -36,35 +36,18 @@ matrix-sdk-ui = { workspace = true, features = ["uniffi"] }
mime = "0.3.16"
once_cell.workspace = true
ruma = { workspace = true, features = ["html", "unstable-unspecified", "unstable-msc3488", "compat-unset-avatar", "unstable-msc3245-v1-compat", "unstable-msc4278"] }
sentry-tracing = "0.36.0"
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
tracing.workspace = true
tracing-appender = { version = "0.2.2" }
tracing-core.workspace = true
tracing-subscriber = { workspace = true, features = ["env-filter"] }
uniffi = { workspace = true, features = ["tokio"] }
url.workspace = true
uuid = { version = "1.4.1", features = ["v4"] }
zeroize.workspace = true

[target.'cfg(not(target_os = "android"))'.dependencies.matrix-sdk]
workspace = true
features = [
"anyhow",
"e2e-encryption",
"experimental-widgets",
"markdown",
# note: differ from block below
"native-tls",
"socks",
"sqlite",
"uniffi",
]

[target.'cfg(not(target_os = "android"))'.dependencies.sentry]
[target.'cfg(all(not(target_os = "android"), not(target_family = "wasm")))'.dependencies.sentry]
version = "0.36.0"
default-features = false
features = [
Expand All @@ -80,6 +63,17 @@ features = [
[target.'cfg(target_os = "android")'.dependencies]
paranoid-android = "0.2.1"

[target.'cfg(target_family = "wasm")'.dependencies]
console_error_panic_hook = "0.1.7"
tokio = { workspace = true, features = ["sync", "macros"] }
uniffi = { workspace = true, features = ["wasm-unstable-single-threaded"] }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
async-compat.workspace = true
sentry-tracing = "0.36.0"
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
uniffi = { workspace = true, features = ["tokio"] }

[target.'cfg(target_os = "android")'.dependencies.matrix-sdk]
workspace = true
features = [
Expand All @@ -94,19 +88,34 @@ features = [
"uniffi",
]

[target.'cfg(target_os = "android")'.dependencies.sentry]
version = "0.36.0"
default-features = false
[target.'cfg(all(not(target_os = "android"), not(target_family = "wasm")))'.dependencies.matrix-sdk]
workspace = true
features = [
# TLS lib specific for Android.
"rustls",
# Most default features enabled otherwise.
"backtrace",
"contexts",
"panic",
"reqwest",
"anyhow",
"e2e-encryption",
"experimental-widgets",
"markdown",
# note: differ from block above
"native-tls",
"socks",
"sqlite",
"uniffi",
]

[target.'cfg(target_family = "wasm")'.dependencies.matrix-sdk]
workspace = true
features = [
"anyhow",
"e2e-encryption",
"experimental-widgets",
"markdown",
"native-tls",
"socks",
"indexeddb",
"uniffi",
]


[build-dependencies]
uniffi = { workspace = true, features = ["build"] }
vergen = { version = "8.1.3", features = ["build", "git", "gitcl"] }
Expand Down
2 changes: 2 additions & 0 deletions bindings/matrix-sdk-ffi/src/api.udl
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
namespace matrix_sdk_ffi {};

[Remote]
dictionary Mentions {
sequence<string> user_ids;
boolean room;
};

[Remote]
interface RoomMessageEventContentWithoutRelation {
RoomMessageEventContentWithoutRelation with_mentions(Mentions mentions);
};
Loading
Loading