一键导入
build-cadmus-native
Build Cadmus on Linux and macOS hosts using xtask. Use when asked how to compile, test, lint, or run the project locally.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build Cadmus on Linux and macOS hosts using xtask. Use when asked how to compile, test, lint, or run the project locally.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run clippy locally and report only issues in the current diff, matching the CI reviewdog flow. Use when asked how to lint changed code or get clippy feedback on a branch before pushing.
Build the full Cadmus documentation website (mdBook + cargo doc + Storybook + Next.js). Use this when asked to build, preview, or update the documentation site.
Regenerate `.sqlx/` cached metadata when adding or modifying `sqlx::query!`, `sqlx::query_as!`, or `sqlx::query_scalar!` macros.
Cross-compile Cadmus for Kobo e-reader devices (ARM Linux). Use this when asked to build a Kobo release, cross-compile for ARM, or prepare a device binary.
Check or apply rustfmt formatting across the workspace. Use this when asked to format code, check formatting, or fix rustfmt issues.
Regenerate the translations POT file after modifying English documentation sources. Use when docs/src/**/*.md files are changed.
| name | build-cadmus-native |
| description | Build Cadmus on Linux and macOS hosts using xtask. Use when asked how to compile, test, lint, or run the project locally. |
cadmus-core embeds the user documentation at compile time via rust-embed.
The macro points to docs/book/epub/Cadmus Documentation.epub. If that file
is missing, every cargo check, cargo build, or cargo test that
touches cadmus-core will fail with:
error: #[derive(RustEmbed)] folder '…/docs/book/epub/' does not exist.
error[E0599]: no associated function named `get` found for struct `DocumentationAssets`
cargo xtask docs --mdbook-only
This installs mdBook and mdbook-epub (if missing), builds the mdBook sources,
and writes docs/book/epub/Cadmus Documentation.epub. You only need to rerun
it when documentation sources change.
Required for Kobo builds — run both before cargo xtask build-kobo:
cargo xtask download-assets
cargo xtask download-fonts
download-assets pulls Plato runtime directories (bin/, resources/,
hyphenation-patterns/). download-fonts assembles the fonts/.
Native dependencies (MuPDF, libwebp, and the C wrapper) are now built
automatically by build.rs when you run any Cargo command that compiles
cadmus-core.
| Goal | Command |
|---|---|
| Check formatting | cargo xtask fmt |
| Run clippy | cargo xtask clippy |
| Run tests (default features) | cargo xtask test --features default |
| Run tests with coverage | cadmus-test-coverage --features default (devenv) |
| View coverage (project-wide) | cadmus-coverage-show (after test-coverage) |
| View coverage (patch diff) | cadmus-coverage-diff (after test-coverage) |
| Run tests with telemetry | cargo xtask test --features "profiling + test + tracing" |
| Run the emulator | cargo xtask run-emulator (builds the EPUB first if missing) |
| Install the importer CLI | cargo xtask install-importer |
| Build docs portal (full) | cargo xtask docs |
The full feature matrix is large and slow. Run the complete matrix only in CI. Locally, test the feature combination you are actively working with:
# Default features — fastest, covers most code
cargo xtask test --features default
# Specific feature you are adding or modifying
cargo xtask test --features "profiling + test + tracing"
[!NOTE] The
telemetryfeature is excluded from the xtask matrix because it aliasestracing + profilingwith no separatecfgbranches. Use the expanded form (profiling + test + tracing) instead.
Use cargo xtask ci matrix to see all available feature combinations if you
need to verify a specific one.
In a devenv shell (cadmus-test-coverage, cadmus-coverage-show, cadmus-coverage-diff):
cadmus-test-coverage
cadmus-coverage-show
cadmus-coverage-diff
Without devenv:
cargo xtask test --coverage --features default
This writes target/coverage/lcov.info. Project HTML uses cargo llvm-cov report --html.
Patch HTML uses diff-cover (see devenv.nix scripts).
fmt — runs cargo fmt --check (or --apply in CI) across the workspaceclippy — iterates the full feature matrix; use --features to narrow ittest — iterates the test feature matrix; --coverage enables llvm-cov instrumentationrun-emulator — ensures the documentation EPUB exists, then runs cargo run -p cadmus --features emulatorinstall-importer — runs cargo install --path crates/importer| Mistake | Result | Fix |
|---|---|---|
Running cargo check before cargo xtask docs --mdbook-only | RustEmbed folder-not-found error | Generate the EPUB first |
Running bare cargo clippy / cargo test directly | May miss feature-gated code or use wrong feature combinations | Prefer cargo xtask clippy and cargo xtask test |
Running cargo xtask test without --features | Runs the full (slow) CI matrix locally | Pass --features default or the specific combo you need |
build.rs; ensure gcc, make, cmake, and standard build tools are installed.build.rs; Xcode Command Line Tools must be installed. Full support including Kobo cross-compilation.build-kobo command cross-compiles for ARM and is available on both Linux and macOS; it runs inside a containerised CI action in the main workflow.