fix: Move runtime module from matrix-sdk-common to matrix-sdk-ffi (#5184)

This module only builds on non-wasm with the patched async-compat from
the workspace Cargo.toml's patch section, and it is only used by the ffi
crate. It is currently breaking the use of the SDK as a git dependency,
and would prevent the publishing of matrix-sdk-common (unless using
--no-verify, but then that would just break all users of the newly
published crates.io version).

This bug was introduced in
https://github.com/matrix-org/matrix-rust-sdk/pull/5089.

Signed-off-by: Jonas Platte <jplatte+matrix@posteo.de>
This commit is contained in:
Jonas Platte
2025-06-05 21:30:15 +02:00
committed by GitHub
parent becbb63ad7
commit 2a140770a0
16 changed files with 29 additions and 23 deletions

1
Cargo.lock generated
View File

@@ -2980,7 +2980,6 @@ version = "0.11.0"
dependencies = [
"assert_matches",
"assert_matches2",
"async-compat",
"eyeball-im",
"futures-core",
"futures-executor",

View File

@@ -41,9 +41,7 @@ use matrix_sdk::{
AuthApi, AuthSession, Client as MatrixClient, SessionChange, SessionTokens,
STATE_STORE_DATABASE_NAME,
};
use matrix_sdk_common::{
runtime::get_runtime_handle, stream::StreamExt, SendOutsideWasm, SyncOutsideWasm,
};
use matrix_sdk_common::{stream::StreamExt, SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_ui::{
notification_client::{
NotificationClient as MatrixNotificationClient,
@@ -102,6 +100,7 @@ use crate::{
AccountDataEvent, AccountDataEventType, AuthData, InviteAvatars, MediaPreviewConfig,
MediaPreviews, MediaSource, RoomAccountDataEvent, RoomAccountDataEventType,
},
runtime::get_runtime_handle,
sync_service::{SyncService, SyncServiceBuilder},
task_handle::TaskHandle,
utd::{UnableToDecryptDelegate, UtdHook},

View File

@@ -18,7 +18,7 @@ use matrix_sdk::{
Client as MatrixClient, ClientBuildError as MatrixClientBuildError, HttpError, IdParseError,
RumaApiError, SqliteStoreConfig,
};
use matrix_sdk_common::{runtime::get_runtime_handle, SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_common::{SendOutsideWasm, SyncOutsideWasm};
use ruma::api::error::{DeserializationError, FromHttpResponseError};
use tracing::{debug, error};
use zeroize::Zeroizing;
@@ -26,7 +26,7 @@ use zeroize::Zeroizing;
use super::client::Client;
use crate::{
authentication::OidcConfiguration, client::ClientSessionDelegate, error::ClientError,
helpers::unwrap_or_clone_arc, task_handle::TaskHandle,
helpers::unwrap_or_clone_arc, runtime::get_runtime_handle, task_handle::TaskHandle,
};
/// A list of bytes containing a certificate in DER or PEM form.

View File

@@ -5,12 +5,15 @@ use matrix_sdk::{
encryption,
encryption::{backups, recovery},
};
use matrix_sdk_common::{runtime::get_runtime_handle, SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_common::{SendOutsideWasm, SyncOutsideWasm};
use thiserror::Error;
use tracing::{error, info};
use zeroize::Zeroize;
use crate::{client::Client, error::ClientError, ruma::AuthData, task_handle::TaskHandle};
use crate::{
client::Client, error::ClientError, ruma::AuthData, runtime::get_runtime_handle,
task_handle::TaskHandle,
};
#[derive(uniffi::Object)]
pub struct Encryption {

View File

@@ -26,6 +26,7 @@ mod room_list;
mod room_member;
mod room_preview;
mod ruma;
mod runtime;
mod session_verification;
mod sync_service;
mod task_handle;

View File

@@ -12,7 +12,7 @@ use matrix_sdk::{
PredecessorRoom as SdkPredecessorRoom, RoomHero as SdkRoomHero, RoomMemberships, RoomState,
SuccessorRoom as SdkSuccessorRoom,
};
use matrix_sdk_common::{runtime::get_runtime_handle, SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_common::{SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_ui::{
timeline::{default_event_filter, RoomExt, TimelineBuilder},
unable_to_decrypt_hook::UtdHookManager,
@@ -46,6 +46,7 @@ use crate::{
room_member::{RoomMember, RoomMemberWithSenderInfo},
room_preview::RoomPreview,
ruma::{ImageInfo, LocationContent, Mentions, NotifyType},
runtime::get_runtime_handle,
timeline::{
configuration::{TimelineConfiguration, TimelineFilter},
EventTimelineItem, ReceiptType, SendHandle, Timeline,

View File

@@ -18,11 +18,11 @@ use std::{fmt::Debug, sync::Arc};
use eyeball_im::VectorDiff;
use futures_util::StreamExt;
use matrix_sdk::room_directory_search::RoomDirectorySearch as SdkRoomDirectorySearch;
use matrix_sdk_common::{runtime::get_runtime_handle, SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_common::{SendOutsideWasm, SyncOutsideWasm};
use ruma::ServerName;
use tokio::sync::RwLock;
use crate::{error::ClientError, task_handle::TaskHandle};
use crate::{error::ClientError, runtime::get_runtime_handle, task_handle::TaskHandle};
#[derive(uniffi::Enum)]
pub enum PublicRoomJoinRule {

View File

@@ -11,7 +11,7 @@ use matrix_sdk::{
},
Room as SdkRoom,
};
use matrix_sdk_common::{runtime::get_runtime_handle, SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_common::{SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_ui::{
room_list_service::filters::{
new_filter_all, new_filter_any, new_filter_category, new_filter_deduplicate_versions,
@@ -24,6 +24,7 @@ use matrix_sdk_ui::{
use crate::{
room::{Membership, Room},
runtime::get_runtime_handle,
TaskHandle,
};

View File

@@ -19,7 +19,7 @@
#[cfg(not(target_family = "wasm"))]
mod sys {
pub use tokio::runtime::{Handle, Runtime};
pub use tokio::runtime::Handle;
/// Get a runtime handle appropriate for the current target platform.
///

View File

@@ -10,11 +10,13 @@ use matrix_sdk::{
ruma::events::key::verification::VerificationMethod,
Account,
};
use matrix_sdk_common::{runtime::get_runtime_handle, SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_common::{SendOutsideWasm, SyncOutsideWasm};
use ruma::UserId;
use tracing::{error, warn};
use crate::{client::UserProfile, error::ClientError, utils::Timestamp};
use crate::{
client::UserProfile, error::ClientError, runtime::get_runtime_handle, utils::Timestamp,
};
#[derive(uniffi::Object)]
pub struct SessionVerificationEmoji {

View File

@@ -16,7 +16,7 @@ use std::{fmt::Debug, sync::Arc};
use futures_util::pin_mut;
use matrix_sdk::Client;
use matrix_sdk_common::{runtime::get_runtime_handle, SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_common::{SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_ui::{
sync_service::{
State as MatrixSyncServiceState, SyncService as MatrixSyncService,
@@ -26,7 +26,8 @@ use matrix_sdk_ui::{
};
use crate::{
error::ClientError, helpers::unwrap_or_clone_arc, room_list::RoomListService, TaskHandle,
error::ClientError, helpers::unwrap_or_clone_arc, room_list::RoomListService,
runtime::get_runtime_handle, TaskHandle,
};
#[derive(uniffi::Enum)]

View File

@@ -30,7 +30,6 @@ use matrix_sdk::{
reply::{EnforceThread, Reply},
},
};
use matrix_sdk_common::runtime::get_runtime_handle;
use matrix_sdk_ui::timeline::{
self, AttachmentSource, EventItemOrigin, Profile, TimelineDetails,
TimelineUniqueId as SdkTimelineUniqueId,
@@ -75,6 +74,7 @@ use crate::{
AssetType, AudioInfo, FileInfo, FormattedBody, ImageInfo, Mentions, PollKind,
ThumbnailInfo, VideoInfo,
},
runtime::get_runtime_handle,
task_handle::TaskHandle,
utils::Timestamp,
};

View File

@@ -14,10 +14,11 @@
use std::{mem::ManuallyDrop, ops::Deref};
use matrix_sdk_common::runtime::get_runtime_handle;
use ruma::{MilliSecondsSinceUnixEpoch, UInt};
use tracing::warn;
use crate::runtime::get_runtime_handle;
#[derive(Debug, Clone)]
pub struct Timestamp(u64);

View File

@@ -5,11 +5,11 @@ use matrix_sdk::{
async_trait,
widget::{MessageLikeEventFilter, StateEventFilter, ToDeviceEventFilter},
};
use matrix_sdk_common::{runtime::get_runtime_handle, SendOutsideWasm, SyncOutsideWasm};
use matrix_sdk_common::{SendOutsideWasm, SyncOutsideWasm};
use ruma::events::MessageLikeEventType;
use tracing::error;
use crate::room::Room;
use crate::{room::Room, runtime::get_runtime_handle};
#[derive(uniffi::Record)]
pub struct WidgetDriverAndHandle {

View File

@@ -25,7 +25,6 @@ uniffi = ["dep:uniffi"]
test-send-sync = []
[dependencies]
async-compat.workspace = true
eyeball-im.workspace = true
futures-core.workspace = true
futures-util.workspace = true

View File

@@ -28,7 +28,6 @@ pub mod failures_cache;
pub mod linked_chunk;
pub mod locks;
pub mod ring_buffer;
pub mod runtime;
pub mod serde_helpers;
pub mod sleep;
pub mod store_locks;