Skip to content

Commit

Permalink
Merge pull request #817 from CosmWasm/808-remove-circular-dependency
Browse files Browse the repository at this point in the history
Remove storage-plus dependency from storage-macro
  • Loading branch information
uint authored Sep 29, 2022
2 parents 7a32e5c + d037bf5 commit f5e9d13
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,11 @@ jobs:
name: Run unit tests (no iterator)
command: cargo test --locked --no-default-features
- run:
name: Build library for native target (with iterator)
command: cargo build --locked
name: Build library for native target (with iterator and macro)
command: cargo build --locked --all-features
- run:
name: Run unit tests (with iterator)
command: cargo test --locked
name: Run unit tests (with iterator and macro)
command: cargo test --locked --all-features
- save_cache:
paths:
- /usr/local/cargo/registry
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion packages/storage-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ proc-macro = true
syn = { version = "1.0.96", features = ["full"] }

[dev-dependencies]
cw-storage-plus = { version = "<=0.15.1, >=0.14.0", path = "../storage-plus" }
cosmwasm-std = { version = "1.1.0", default-features = false }
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
5 changes: 4 additions & 1 deletion packages/storage-plus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ license = "Apache-2.0"
repository = "https://github.com/CosmWasm/cw-plus"
homepage = "https://cosmwasm.com"

[package.metadata.docs.rs]
all-features = true # include macro feature when building docs

[features]
default = ["iterator"]
iterator = ["cosmwasm-std/iterator"]
Expand All @@ -24,7 +27,7 @@ serde = { version = "1.0.103", default-features = false, features = ["derive"] }
cw-storage-macro = { version = "0.15.1", optional = true, path = "../storage-macro" }

[dev-dependencies]
criterion = { version = "0.3", features = [ "html_reports" ] }
criterion = { version = "0.3", features = ["html_reports"] }
rand = "0.8"

[[bench]]
Expand Down
27 changes: 25 additions & 2 deletions packages/storage-plus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,32 @@ pub use prefix::{range_with_prefix, Prefix};
#[cfg(feature = "iterator")]
pub use snapshot::{SnapshotItem, SnapshotMap, Strategy};

// cw_storage_macro reexports
#[cfg(all(feature = "iterator", feature = "macro"))]
#[macro_use]
extern crate cw_storage_macro;
#[cfg(all(feature = "iterator", feature = "macro"))]
#[doc(hidden)]
pub use cw_storage_macro::*;
/// Auto generate an `IndexList` impl for your indexes struct.
///
/// # Example
///
/// ```rust
/// use cosmwasm_std::Addr;
/// use cw_storage_plus::{MultiIndex, UniqueIndex, index_list};
/// use serde::{Serialize, Deserialize};
///
/// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
/// struct TestStruct {
/// id: u64,
/// id2: u32,
/// addr: Addr,
/// }
///
/// #[index_list(TestStruct)] // <- Add this line right here.
/// struct TestIndexes<'a> {
/// id: MultiIndex<'a, u32, TestStruct, u64>,
/// addr: UniqueIndex<'a, Addr, TestStruct>,
/// }
/// ```
///
pub use cw_storage_macro::index_list;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(test)]
#[cfg(all(test, feature = "iterator", feature = "macro"))]
mod test {
use cosmwasm_std::{testing::MockStorage, Addr};
use cw_storage_macro::index_list;
Expand Down

0 comments on commit f5e9d13

Please sign in to comment.