mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-16 23:24:24 +00:00
cargo unifies features only over the packages a command selects, so a framework crate's tests, a domain crate's tests, the gallery and the story renderer each built their own copy of the framework and of wgpu. feature-root carries the gallery's dependencies with every domain crate; cl selects it beside every command's package and names the crate's own targets, so nothing of it builds. The per-crate feature anchors go; cl check also checks a crate's bins.
38 lines
2.4 KiB
Markdown
38 lines
2.4 KiB
Markdown
# craft
|
|
|
|
The craft libraries in one dependency. An app pins one revision of this crate and turns on features; everything is imported as `craft::<crate>`.
|
|
|
|
```toml
|
|
[workspace.dependencies]
|
|
craft = { git = "https://github.com/storytold/craft-libs", rev = "…" }
|
|
|
|
# crates/ui-egui/Cargo.toml
|
|
craft = { workspace = true, features = ["ui", "color", "draw", "imaging", "keymap", "platform-appearance"] }
|
|
```
|
|
|
|
## Always on
|
|
|
|
`craft::theme`, `craft::i18n`, `craft::host`.
|
|
|
|
## Features
|
|
|
|
- One feature per crate, named after the crate without `craft-`: `color` turns on `craft-color` and re-exports it as `craft::color`.
|
|
- `ui` turns on `craft-ui` (`craft::ui`), re-exports `egui` (`craft::egui`, the egui the library is built with) and forwards `ui` to every enabled crate.
|
|
- `screen-testing` implies `ui` and forwards to every enabled crate.
|
|
- Each crate feature is forwarded as `<crate>-<feature>` (`platform-appearance`, `text-hyphen`, `ui-window-frame`).
|
|
- A crate whose `ui` needs another family's `ui` turns that family's feature on (`draw` turns on `color`).
|
|
|
|
The `[features]` table in `Cargo.toml` is written by `tests/features.rs` from the member crates' manifests. After changing a member's features or adding a crate, run `UPDATE_FACADE=1 cargo test -p craft -- integration::features` and commit the result. A comment on a feature line marks a crate that does not build for `wasm32-unknown-unknown`.
|
|
|
|
Reached through other crates, not named in the facade: the six library crates (`craft-ui-contract` to `craft-ui-shell`), `craft-ui-macros` and `craft-behavior` through `craft-ui`, and `craft-win32` through `craft-window`.
|
|
|
|
Not in the facade, because they are tools or test harnesses: `craft-ui-gallery`, `story-render`, `feature-root` (the features local builds resolve with), `craft-ui-bench`, `craft-ui-test-kit`, `craft-fonts-build` (a build-script helper), `craft-design-lint`, `craft-plate-test`, `craft-media-testkit`.
|
|
|
|
## Family dependencies
|
|
|
|
`tests/families.rs` fails when one family crate's `ui` depends on another family crate's `ui`. `craft-color` is the base family that any family may use.
|
|
|
|
## egui fork
|
|
|
|
`craft::egui_fork::{GIT, REV}` name the egui fork the library is built with, and `check_lockfile(lock)` checks that an app's `Cargo.lock` takes every egui package from it. An app's xtask calls it in its `ci` and `check` commands. The app's workspace must also patch egui to this fork, since `[patch]` applies only at the workspace root.
|