Skip to content

Commit

Permalink
Fix sqlite deps (#1418)
Browse files Browse the repository at this point in the history
* fix deps

* imports

* fmt
  • Loading branch information
codabrink authored Dec 16, 2024
1 parent 4336127 commit 5b602d7
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 43 deletions.
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ members = [
"xtask",
"xmtp_debug",
"xmtp_content_types",
"common"
"common",
]

# Make the feature resolver explicit.
Expand Down Expand Up @@ -75,7 +75,6 @@ bincode = "1.3"
console_error_panic_hook = "0.1"
const_format = "0.2"
diesel = { version = "2.2", default-features = false }
diesel-wasm-sqlite = "0.0.1"
diesel_migrations = { version = "2.2", default-features = false }
dyn-clone = "1"
fdlimit = "0.3"
Expand All @@ -87,6 +86,7 @@ libsqlite3-sys = { version = "0.29", features = [
openssl = { version = "0.10", features = ["vendored"] }
openssl-sys = { version = "0.9", features = ["vendored"] }
parking_lot = "0.12.3"
sqlite-web = "0.0.1"
tonic = { version = "0.12", default-features = false }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false }
Expand All @@ -100,12 +100,12 @@ zeroize = "1.8"

# Internal Crate Dependencies
xmtp_api_grpc = { path = "xmtp_api_grpc" }
xmtp_common = { path = "common" }
xmtp_content_types = { path = "xmtp_content_types" }
xmtp_cryptography = { path = "xmtp_cryptography" }
xmtp_id = { path = "xmtp_id" }
xmtp_mls = { path = "xmtp_mls" }
xmtp_proto = { path = "xmtp_proto" }
xmtp_content_types = { path = "xmtp_content_types" }
xmtp_common = { path = "common" }

[profile.dev]
# Disabling debug info speeds up builds a bunch,
Expand Down Expand Up @@ -147,6 +147,6 @@ opt-level = "s"
# (cfg-specific patche support does not exist)
[patch.crates-io]
diesel = { git = "https://github.com/diesel-rs/diesel", branch = "master" }
diesel-wasm-sqlite = { git = "https://github.com/xmtp/sqlite-web-rs", branch = "main" }
diesel_derives = { git = "https://github.com/diesel-rs/diesel", branch = "master" }
diesel_migrations = { git = "https://github.com/diesel-rs/diesel", branch = "master" }
sqlite-web = { git = "https://github.com/xmtp/sqlite-web-rs", branch = "main" }
15 changes: 6 additions & 9 deletions xmtp_mls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test-utils = [
"xmtp_api_grpc/test-utils",
"dep:const_format",
"mockall",
"xmtp_common/test-utils"
"xmtp_common/test-utils",
]
update-schema = ["toml"]

Expand Down Expand Up @@ -69,8 +69,8 @@ tokio-stream = { version = "0.1", default-features = false, features = [
] }
tracing.workspace = true
trait-variant.workspace = true
zeroize.workspace = true
xmtp_common.workspace = true
zeroize.workspace = true

# XMTP/Local
xmtp_content_types = { path = "../xmtp_content_types" }
Expand Down Expand Up @@ -133,10 +133,10 @@ diesel = { workspace = true, features = [
"r2d2",
"returning_clauses_for_sqlite_3_35",
] }
diesel-wasm-sqlite = { workspace = true }
getrandom = { workspace = true, features = ["js"] }
gloo-timers = { workspace = true, features = ["futures"] }
openmls = { workspace = true, features = ["js"] }
sqlite-web = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt", "time"] }
wasm-bindgen-futures.workspace = true
web-sys.workspace = true
Expand All @@ -147,10 +147,10 @@ anyhow.workspace = true
const_format.workspace = true
mockall = "0.13.1"
openmls_basic_credential.workspace = true
wasm-bindgen-test.workspace = true
xmtp_common = { workspace = true, features = ["test-utils"] }
xmtp_id = { path = "../xmtp_id", features = ["test-utils"] }
xmtp_proto = { workspace = true, features = ["test-utils"] }
xmtp_common = { workspace = true, features = ["test-utils"]}
wasm-bindgen-test.workspace = true

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
ctor.workspace = true
Expand All @@ -169,12 +169,9 @@ xmtp_api_http = { path = "../xmtp_api_http", features = ["test-utils"] }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
console_error_panic_hook = { version = "0.1" }
diesel-wasm-sqlite = { workspace = true, features = [
"unsafe-debug-query",
"r2d2",
] }
ethers = { workspace = true, features = ["rustls"] }
openmls = { workspace = true, features = ["js"] }
sqlite-web = { workspace = true, features = ["unsafe-debug-query", "r2d2"] }
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
tracing-wasm = { version = "0.2" }
wasm-bindgen-test.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion xmtp_mls/src/storage/encrypted_store/db_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::sync::Arc;
pub type DbConnection = DbConnectionPrivate<super::RawDbConnection>;

#[cfg(target_arch = "wasm32")]
pub type DbConnection = DbConnectionPrivate<diesel_wasm_sqlite::connection::WasmSqliteConnection>;
pub type DbConnection = DbConnectionPrivate<sqlite_web::connection::WasmSqliteConnection>;

/// A wrapper for RawDbConnection that houses all XMTP DB operations.
/// Uses a [`Mutex]` internally for interior mutability, so that the connection
Expand Down
2 changes: 1 addition & 1 deletion xmtp_mls/src/storage/encrypted_store/identity_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use super::{
use diesel::{dsl::max, prelude::*};

#[cfg(target_arch = "wasm32")]
use diesel_wasm_sqlite::dsl::RunQueryDsl;
use sqlite_web::dsl::RunQueryDsl;

use xmtp_id::associations::{unverified::UnverifiedIdentityUpdate, AssociationError};

Expand Down
4 changes: 1 addition & 3 deletions xmtp_mls/src/storage/encrypted_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ pub use sqlcipher_connection::EncryptedConnection;
#[cfg(target_arch = "wasm32")]
pub use self::wasm::SqliteConnection;
#[cfg(target_arch = "wasm32")]
pub use diesel_wasm_sqlite::{
connection::WasmSqliteConnection as RawDbConnection, WasmSqlite as Sqlite,
};
pub use sqlite_web::{connection::WasmSqliteConnection as RawDbConnection, WasmSqlite as Sqlite};

use super::StorageError;
use crate::{xmtp_openmls_provider::XmtpOpenMlsProviderPrivate, Store};
Expand Down
4 changes: 2 additions & 2 deletions xmtp_mls/src/storage/encrypted_store/wallet_addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use crate::storage::{DbConnection, StorageError};
use crate::{impl_fetch, impl_fetch_list_with_key, impl_store, FetchListWithKey};
use diesel::prelude::*;
use diesel::{Insertable, Queryable};
#[cfg(target_arch = "wasm32")]
use diesel_wasm_sqlite::dsl::RunQueryDsl;
use serde::{Deserialize, Serialize};
#[cfg(target_arch = "wasm32")]
use sqlite_web::dsl::RunQueryDsl;
use xmtp_id::{InboxId, WalletAddress};

#[derive(Insertable, Queryable, Debug, Clone, Deserialize, Serialize)]
Expand Down
4 changes: 2 additions & 2 deletions xmtp_mls/src/storage/encrypted_store/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use std::sync::Arc;

use diesel::{connection::AnsiTransactionManager, prelude::*};
pub use diesel_wasm_sqlite::connection::WasmSqliteConnection as SqliteConnection;
use parking_lot::Mutex;
pub use sqlite_web::connection::WasmSqliteConnection as SqliteConnection;

use super::{db_connection::DbConnectionPrivate, StorageError, StorageOption, XmtpDb};

Expand All @@ -26,7 +26,7 @@ impl std::fmt::Debug for WasmDb {
impl WasmDb {
pub async fn new(opts: &StorageOption) -> Result<Self, StorageError> {
use super::StorageOption::*;
diesel_wasm_sqlite::init_sqlite().await;
sqlite_web::init_sqlite().await;
let conn = match opts {
Ephemeral => SqliteConnection::establish(":memory:"),
Persistent(ref db_path) => SqliteConnection::establish(db_path),
Expand Down
2 changes: 1 addition & 1 deletion xmtp_mls/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub use errors::*;
/// Initialize the SQLite WebAssembly Library
#[cfg(target_arch = "wasm32")]
pub async fn init_sqlite() {
diesel_wasm_sqlite::init_sqlite().await;
sqlite_web::init_sqlite().await;
}
#[cfg(not(target_arch = "wasm32"))]
pub async fn init_sqlite() {}
Expand Down

0 comments on commit 5b602d7

Please sign in to comment.