Skip to content

Commit

Permalink
Depend on portable-atomic-* only if the target has no OS (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefunctional authored Jan 17, 2024
1 parent f0ae87b commit 468ffc5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
9 changes: 6 additions & 3 deletions mls-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ thiserror = { version = "1.0.40", optional = true }
itertools = { version = "0.12.0", default-features = false, features = ["use_alloc"]}
cfg-if = "1"
debug_tree = { version = "0.4.0", optional = true }
spin = { version = "0.9.8", default-features = false, features = ["mutex", "spin_mutex", "portable_atomic"] }
portable-atomic = { version = "1.5.1", default-features = false, features = ["critical-section"] }
portable-atomic-util = { version = "0.1.2", default-features = false, features = ["alloc"] }
spin = { version = "0.9.8", default-features = false, features = ["mutex", "spin_mutex"] }
maybe-async = { version = "0.2.7" }

# Optional dependencies
Expand All @@ -77,6 +75,11 @@ once_cell = { version = "1.18", optional = true }
futures = { version = "0.3.25", default-features = false, features = ["alloc"]}
async-trait = "0.1.74"

[target.'cfg(target_os = "none")'.dependencies]
portable-atomic = { version = "1.5.1", default-features = false, features = ["critical-section"] }
portable-atomic-util = { version = "0.1.2", default-features = false, features = ["alloc"] }
spin = { version = "0.9.8", default-features = false, features = ["portable_atomic"] }

[target.'cfg(mls_build_async)'.dev-dependencies]
futures-test = "0.3.25"

Expand Down
4 changes: 2 additions & 2 deletions mls-rs/src/storage_provider/in_memory/group_state_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

use alloc::collections::VecDeque;

#[cfg(feature = "std")]
#[cfg(not(target_os = "none"))]
use alloc::sync::Arc;

#[cfg(mls_build_async)]
use alloc::boxed::Box;
use alloc::vec::Vec;
use mls_rs_codec::{MlsDecode, MlsEncode};
use mls_rs_core::group::{EpochRecord, GroupState, GroupStateStorage};
#[cfg(not(feature = "std"))]
#[cfg(target_os = "none")]
use portable_atomic_util::Arc;

use crate::{client::MlsError, storage_provider::group_state::EpochData};
Expand Down
4 changes: 2 additions & 2 deletions mls-rs/src/storage_provider/in_memory/key_package_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Copyright by contributors to this project.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

#[cfg(feature = "std")]
#[cfg(not(target_os = "none"))]
use alloc::sync::Arc;

#[cfg(not(feature = "std"))]
#[cfg(target_os = "none")]
use portable_atomic_util::Arc;

use core::convert::Infallible;
Expand Down
4 changes: 2 additions & 2 deletions mls-rs/src/storage_provider/in_memory/psk_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Copyright by contributors to this project.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

#[cfg(feature = "std")]
#[cfg(not(target_os = "none"))]
use alloc::sync::Arc;

#[cfg(not(feature = "std"))]
#[cfg(target_os = "none")]
use portable_atomic_util::Arc;

use core::convert::Infallible;
Expand Down

0 comments on commit 468ffc5

Please sign in to comment.