#
pezkuwi_sdk_docs/reference_docs/
umbrella_crate.rs

    1//! # Umbrella Crate
    2//!
    3//! The Pezkuwi-SDK "umbrella" is a crate that re-exports all other published crates. This makes it
    4//! possible to have a very small `Cargo.toml` file that only has one dependency, the umbrella
    5//! crate. This helps with selecting the right combination of crate versions, since otherwise 3rd
    6//! party tools are needed to select a compatible set of versions.
    7//!
    8//!
    9//! ## Features
    10//!
    11//! The umbrella crate supports no-std builds and can therefore be used in the runtime and node.
    12//! There are two main features: `runtime` and `node`. The `runtime` feature enables all `no-std`
    13//! crates, while the `node` feature enables all `std` crates. It should be used like any other
    14//! crate in the repo, with `default-features = false`.
    15//!
    16//! For more fine-grained control, additionally, each crate can be enabled selectively. The umbrella
    17//! exposes one feature per dependency. For example, if you only want to use the `frame-support`
    18//! crate, you can enable the `frame-support` feature.
    19//!
    20//! The umbrella exposes a few more general features:
    21//! - `tuples-96`: Needs to be enabled for runtimes that have more than 64 pallets.
    22//! - `serde`: Specifically enable `serde` en/decoding support.
    23//! - `experimental`: Experimental enable experimental features - should not yet used in production.
    24//! - `with-tracing`: Enable tracing support.
    25//! - `try-runtime`, `runtime-benchmarks` and `std`: These follow the standard conventions.
    26//! - `runtime`: As described above, enable all `no-std` crates.
    27//! - `node`: As described above, enable all `std` crates.
    28//! - There does *not* exist a dedicated docs feature. To generate docs, enable the `runtime` and
    29//!   `node` feature. For `docs.rs` the manifest contains specific configuration to make it show up
    30//!   all re-exports.
    31//!
    32//! There is a specific [`zepter`](https://github.com/ggwpez/zepter) check in place to ensure that
    33//! the features of the umbrella are correctly configured. This check is run in CI and locally when
    34//! running `zepter`.
    35//!
    36//! ## Generation
    37//!
    38//! The umbrella crate needs to be updated every time when a new crate is added or removed from the
    39//! workspace. It is checked in CI by calling its generation script. The generation script is
    40//! located in `./scripts/generate-umbrella.py` and needs dependency `cargo_workspace`.
    41//!
    42//! Example: `python3 scripts/generate-umbrella.py --sdk . --version 1.9.0`
    43//!
    44//! ## Usage
    45//!
    46//! > Note: You can see a live example in the `staging-node-cli` and `kitchensink-runtime` crates.
    47//!
    48//! The umbrella crate can be added to your runtime crate like this:
    49//!
    50//! `pezkuwi-sdk = { path = "../../../../umbrella", features = ["runtime"], default-features =
    51//! false }`
    52//!
    53//! or for a node:
    54//!
    55//! `pezkuwi-sdk = { path = "../../../../umbrella", features = ["node"], default-features = false
    56//! }`
    57//!
    58//! In the code, it is then possible to bring all dependencies into scope via:
    59//!
    60//! `use pezkuwi_sdk::*;`
    61//!
    62//! ### Known Issues
    63//!
    64//! The only known issue so far is the fact that the `use` statement brings the dependencies only
    65//! into the outer module scope - not the global crate scope. For example, the following code would
    66//! need to be adjusted:
    67//!
    68//! ```rust
    69//! use pezkuwi_sdk::*;
    70//!
    71//! mod foo {
    72//!    // This does sadly not compile:
    73//!    frame_support::parameter_types! { }
    74//!
    75//!    // Instead, we need to do this (or add an equivalent `use` statement):
    76//!    pezkuwi_sdk::frame_support::parameter_types! { }
    77//! }
    78//! ```
    79//!
    80//! Apart from this, no issues are known. There could be some bugs with how macros locate their own
    81//! re-exports. Please [report issues](https://github.com/pezkuwichain/pezkuwi-sdk/issues) that arise from using this crate.
    82//!
    83//! ## Dependencies
    84//!
    85//! The umbrella crate re-exports all published crates, with a few exceptions:
    86//! - Runtime crates like `pezkuwichain-runtime` etc are not exported. This otherwise leads to very
    87//!   weird compile errors and should not be needed anyway.
    88//! - Example and fuzzing crates are not exported. This is currently detected by checking the name
    89//!   of the crate for these magic words. In the future, it will utilize custom metadata, as it is
    90//!   done in the `pezkuwichain-runtime` crate.
    91//! - The umbrella crate itself. Should be obvious :)