Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

Add an opt-in low-disk Cargo profile (#951)

cyfung1031575f99f9be10
diff --git a/Cargo.toml b/Cargo.toml
index 0214a7bf4..1312fedc0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -89,6 +89,11 @@ debug = "line-tables-only"
[profile.dev]
opt-level = 1
+[profile.low-disk]
+inherits = "dev"
+debug = "line-tables-only"
+incremental = false
+
[profile.release]
lto = "thin"
codegen-units = 1
diff --git a/docs/development.md b/docs/development.md
index c682d4f00..4bf3cc570 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -3,6 +3,25 @@
Working instructions for agents and contributors are in `AGENTS.md` and `CLAUDE.md`. This page
collects what the desktop app reads from its environment and where it writes its diagnostics.
+## Low-disk Cargo profile
+
+When local build storage is constrained, select the opt-in `low-disk` profile explicitly:
+
+```sh
+cargo build --profile low-disk -p pdfcraft-cli
+cargo test --profile low-disk -p pdfcraft-cos --lib
+```
+
+The profile inherits the normal development settings, including debug assertions and overflow
+checks. It uses line-table-only debug information for workspace code, which keeps file and line
+numbers in backtraces but omits local-variable and parameter details, and it disables incremental
+compilation for this profile only. Ordinary `cargo build`, `cargo test`, and release builds keep
+their existing profiles.
+
+Cargo stores custom-profile artifacts separately under `target/low-disk`. Switching between the
+normal and low-disk profiles can therefore leave both sets of artifacts on disk. To remove only
+the low-disk artifacts, run `cargo clean --profile low-disk`.
+
The UI crate and complete desktop/web builds require Rust 1.95 or later, matching the pinned
`craft-ui` dependency. The workspace's core-crate minimum is unchanged.