Files
dcr/docs/commands/dcr-run.md
Dexoron 7969209eae Added:
- `build.kind = "efi"` — UEFI PE32+ executable support. Links with `-shared -nostdlib -Wl,-dll -Wl,--subsystem,10`, output via `efi_path()` with `.efi` extension, rejected by `dcr run`.
- `build.kind = "elf"` — bare-metal ELF executable support. Uses `elf_path()` output path, rejected by `dcr run`, no extra linker flags.

Fixed:

- `dcr run` with `--target` or `build.target` now correctly finds the binary in the arch-specific target directory.
- `dcr run` checks profile-specific `build.{profile}.kind` before rejecting library builds (previously only checked `build.kind`).
- `dcr clean` now reads `build.target` from `dcr.toml` when no `--target` flag is given.
- Linux: target directory is now consistent — `target/<arch>-unknown-linux-gnu/<profile>/` (no stale `target/<profile>/`).
- `dcr.lock` is now populated with all resolved dependencies (registry, path, git) instead of being always empty.
- Git dependencies are now properly recognized and recorded in `dcr.lock`.
- `is_registry_dep` correctly identifies version-based registry dependency tables (`{ version = "..." }`) and rejects tables with unknown keys.
- `dcr test` accepts `--debug`/`--release` flags (defaults to `debug` profile instead of always `release`).
- Build fingerprint cache (`build_cache_path`) now includes `target_dir` — different targets no longer share a single cache entry.
- `object_path` no longer hardcodes the `src/` prefix — works correctly with custom `build.roots` (e.g. `roots = ["lib"]`).
- `dcr update` now generates `.exe` candidates for all Windows targets, not just `x86_64-pc-windows-msvc`.
- Compiler existence is verified before starting the build (clear error if compiler is not found in PATH).
- Consolidated duplicate `OUTPUT_MUTEX` definitions — MSVC backend now uses the shared mutex from `common.rs`.
- Registry cache root directory is created if missing (prevents cryptic errors when `~/.dcr/` does not exist).
2026-05-26 16:38:23 +08:00

1.3 KiB

dcr run

Builds the project and runs the resulting binary.

Usage

dcr run
dcr run --debug
dcr run --release
dcr run --target linux --release
dcr run --release --force
dcr run --debug --clean

Behavior

  1. Validates dcr.toml.
  2. Reads package.name, build.kind, and optional build.target.
  3. Runs the same build flow as dcr build.
  4. Executes the built artifact path for the selected profile.
  5. If [run].cmd is set, runs that command instead of the built binary.

Restrictions

  • If build.kind (or build.{profile}.kind) is "staticlib" or "sharedlib", run exits with error.
  • The profile is selected from the first argument.
  • --target <triple> runs the binary for specified target (short names: linux, macos, windows).
  • --force skips build cache checks and recompiles.
  • --clean removes target/<profile> and build.clean paths before building.

run.cmd variables

run.cmd supports the same variables as build steps: {profile}, {version}, {version_major}, {version_minor}, {version_patch}, {version_suffix}, {version_suffix_dash}. The command runs via sh -c on Unix and cmd /C on Windows.

On build failure

dcr run attempts to launch an existing binary from the same profile if present; otherwise it reports that code errors must be fixed.