- Workspace support (`[workspace]` with deps ordering)
- `clean --all` for workspace members
Changed:
- Project root discovery for `build/run/clean` (searches parent dirs)
- Workspace paths are excluded from root source scan
- Build output now uses a Cargo-style `Compiling <name> v<version>` line
- Build time now reports total time for the whole build stage (workspace included)
- Cache hits are silent (no compile line when nothing is rebuilt)
- Safer build cache: fingerprints include headers and resolved library files
This commit is contained in:
2026-03-06 21:58:54 +08:00
parent 617ba85442
commit 4ea6267a88
26 changed files with 1123 additions and 213 deletions

View File

@@ -24,6 +24,7 @@ Current DCR focuses on a simple, predictable workflow:
- `sharedlib`
- Optional custom output directory via `build.target`.
- Optional `build.platform` to pass architecture hints (`-march` / `/arch`).
- Workspace builds via `[workspace]` with per-project `dcr.toml`.
- Path dependencies with include/lib resolution and `dcr.lock` generation.
## Important behavior notes

View File

@@ -43,3 +43,4 @@ dcr build --release
- Unknown profile flags return an error.
- Incremental rebuild is based on source/object mtime comparison.
- For `language = "asm"` with `compiler = "as"`/`"gas"`, use `.s` files (no preprocessing). For `.S`, use `gcc` or `clang`.
- In workspace root, `dcr build` builds all members in dependency order.

View File

@@ -8,16 +8,18 @@ Removes build artifacts in `target/`.
dcr clean
dcr clean --debug
dcr clean --release
dcr clean --all
dcr clean --release --all
```
## Behavior
- Without arguments: removes entire `target/`.
- With profile: removes only `target/<profile>/`.
- With `--all`: also cleans all workspace members.
## Validation
- `dcr.toml` must exist.
- More than one argument is treated as error.
- Unknown profile is treated as error.
- Unknown flags are treated as error.
- If `target` or selected profile directory does not exist, command prints a warning.

View File

@@ -26,6 +26,9 @@ kind = "bin"
- `[build]`
- `[dependencies]`
Workspace-only root:
- `[workspace]` may be used instead of `[package]`/`[build]` for a workspace root.
## Required keys
- `package.name`
@@ -43,3 +46,5 @@ kind = "bin"
- `build.cflags`
- `build.ldflags`
- dependency fields (`include`, `lib`, `libs`, `system`)
- `[toolchain]` overrides (`cc`, `cxx`, `as`, `ar`, `ld`)
- `[workspace]` members

View File

@@ -37,6 +37,8 @@ Profile-only cleanup:
```sh
dcr clean --debug
dcr clean --release
dcr clean --all
dcr clean --release --all
```
## Notes
@@ -44,3 +46,4 @@ dcr clean --release
- `run` is unavailable for `build.kind = "staticlib"` and `build.kind = "sharedlib"`.
- Build profile flag is parsed from the first command argument.
- Unknown profile flags produce an error.
- In workspace root, `clean --all` cleans all member projects.

View File

@@ -7,7 +7,7 @@ dcr new <name>
dcr init
dcr build [--debug|--release]
dcr run [--debug|--release]
dcr clean [--debug|--release]
dcr clean [--debug|--release] [--all]
dcr --help
dcr --version
dcr --update
@@ -18,7 +18,7 @@ dcr --update
- Most commands parse profile from the first argument.
- `new` requires exactly one argument.
- `init` and `--update` do not accept extra arguments.
- `clean` accepts at most one argument.
- `clean` accepts `--debug|--release` and optional `--all`.
## Exit behavior overview

View File

@@ -24,6 +24,9 @@ as = "string" # optional
ar = "string" # optional
ld = "string" # optional
[workspace]
name = { path = "string", deps = ["string", "..."] }
[dependencies]
name = {
path = "string", # required for each dependency