Skip to content

Commit 5169e21

Browse files
Daniel SalinasDaniel Salinas
authored andcommitted
Complete uniffi 0.29 upgrade and async callback infrastructure
This commit completes the uniffi upgrade from 0.28.0 to 0.29.1 and establishes the infrastructure for async callbacks in WASM32 environments. Key changes: - Upgrade uniffi to 0.29.1 with git source for async callback support - Fix FFI macros to use smart async runtime selection for WASM32 vs native - Update tokio features across matrix-sdk crates for WASM32 compatibility - Add TypeScript bindings configuration to uniffi.toml - Fix xtask build system for uniffi 0.29 API changes
1 parent f108840 commit 5169e21

File tree

11 files changed

+250
-102
lines changed

11 files changed

+250
-102
lines changed

Cargo.lock

Lines changed: 79 additions & 91 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ tracing = { version = "0.1.40", default-features = false, features = ["std"] }
9292
tracing-core = "0.1.32"
9393
tracing-subscriber = "0.3.18"
9494
unicode-normalization = "0.1.24"
95-
uniffi = { version = "0.28.0" }
96-
uniffi_bindgen = { version = "0.28.0" }
95+
uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "c7f6caa3d1bf20f934346cefd8e82b5093f0dc6f" }
96+
uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs", rev = "c7f6caa3d1bf20f934346cefd8e82b5093f0dc6f" }
97+
uniffi_core = { git = "https://github.com/mozilla/uniffi-rs", rev = "c7f6caa3d1bf20f934346cefd8e82b5093f0dc6f" }
9798
url = "2.5.4"
9899
uuid = "1.12.1"
99100
vodozemac = { version = "0.9.0", features = ["insecure-pk-encryption"] }

bindings/matrix-sdk-ffi-macros/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,14 @@ pub fn export(attr: TokenStream, item: TokenStream) -> TokenStream {
4848

4949
let attr2 = proc_macro2::TokenStream::from(attr);
5050
let item2 = proc_macro2::TokenStream::from(item.clone());
51-
5251
let res = match syn::parse(item) {
5352
Ok(item) => match has_async_fn(item) {
54-
true => quote! { #[uniffi::export(async_runtime = "tokio", #attr2)] },
53+
true => {
54+
quote! {
55+
#[cfg_attr(target_arch = "wasm32", uniffi::export(#attr2))]
56+
#[cfg_attr(not(target_arch = "wasm32"), uniffi::export(async_runtime = "tokio", #attr2))]
57+
}
58+
}
5559
false => quote! { #[uniffi::export(#attr2)] },
5660
},
5761
Err(e) => e.into_compile_error(),

0 commit comments

Comments
 (0)