Skip to content

Commit

Permalink
fix wasm dependencies, try 2
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Dec 19, 2024
1 parent 0c3232f commit 6f9fd4d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

12 changes: 11 additions & 1 deletion xmtp_content_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,14 @@ xmtp_common = { workspace = true, features = ['test-utils'] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tonic = { version = "0.12", features = ["transport"] }
diesel = { workspace = true }
diesel = { workspace = true, features = [
"returning_clauses_for_sqlite_3_35",
"sqlite",
] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
diesel = { workspace = true, features = [
"returning_clauses_for_sqlite_3_35",
] }
sqlite-web = { workspace = true }

12 changes: 11 additions & 1 deletion xmtp_content_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,28 @@ pub mod group_updated;
pub mod membership_change;
pub mod text;

#[cfg(target_arch = "wasm32")]
mod wasm;

use diesel::{
backend::Backend,
deserialize::{self, FromSql, FromSqlRow},
expression::AsExpression,
serialize::{self, IsNull, Output, ToSql},
sql_types::Integer,
sqlite::Sqlite,
};
use serde::{Deserialize, Serialize};
use thiserror::Error;
use xmtp_proto::xmtp::mls::message_contents::{ContentTypeId, EncodedContent};

#[cfg(not(target_arch = "wasm32"))]
pub use diesel::sqlite::{Sqlite, SqliteConnection};

#[cfg(target_arch = "wasm32")]
pub use self::wasm::SqliteConnection;
#[cfg(target_arch = "wasm32")]
pub use sqlite_web::WasmSqlite as Sqlite;

/// ContentType and their corresponding string representation
/// are derived from the `ContentTypeId` enum in the xmtp-proto crate
/// that each content type in this crate establishes for itself
Expand Down

0 comments on commit 6f9fd4d

Please sign in to comment.