feat(builder): Add an optional CLI build log #453

Merged
Matt-Mc merged 1 commit from builder/build-logging into main 2026-11-08 19:22:24 +00:00
Matt-Mc commented 2026-11-08 03:22:26 +00:00 (Migrated from github.com)

CLI builds currently leave their output only in the terminal. Add --log FILE to save a UTF-8 build log while keeping stdout and stderr visible. For example:

python -I nx2/make_game.py --nup "C:\path\game.nup" --out "C:\Games\Hookshot" --log "C:\Logs\build.log"

The log replaces an existing file and flushes as output arrives. Opening it fails before the build starts if the destination is unavailable. Regular subprocess output, nonfatal shader-census diagnostics, automatic compiler-selection messages, unexpected tracebacks, and string-valued SystemExit errors are captured. Shader-census failure remains nonfatal. The README documents the option and file behavior.

Eight new game-free tests cover successful output, child stdout/stderr, Unicode paths and content, live flushing, overwrite behavior, failed child processes, nonfatal diagnostics, unexpected exceptions, SystemExit messages, unusable destinations, normal operation without logging, and real CLI validation failures. The new suite is wired into both Windows and Linux source-regression CI.

Validation on Windows:

  • python -I -B tests/test_build_log.py — 8 tests passed.
  • tests/test_failure_reason.py — 6 passed.
  • tests/test_child_unicode.py — passed, including its legacy encoding negative control.
  • tests/test_shader_census_cmd.py — 3 passed.
  • tests/test_make_game_cache.py — 6 passed.
  • tests/test_builder_status.py — 4 passed.
  • git diff --check — passed.

Tests use temporary authored fixtures and dummy subprocesses; no game build or game files are needed. Native Linux execution remains for CI.

Refs #267. This addresses the request to save CLI build output; interactive setup and dependency-download scripts remain separate work.

CLI builds currently leave their output only in the terminal. Add `--log FILE` to save a UTF-8 build log while keeping stdout and stderr visible. For example: ```powershell python -I nx2/make_game.py --nup "C:\path\game.nup" --out "C:\Games\Hookshot" --log "C:\Logs\build.log" ``` The log replaces an existing file and flushes as output arrives. Opening it fails before the build starts if the destination is unavailable. Regular subprocess output, nonfatal shader-census diagnostics, automatic compiler-selection messages, unexpected tracebacks, and string-valued SystemExit errors are captured. Shader-census failure remains nonfatal. The README documents the option and file behavior. Eight new game-free tests cover successful output, child stdout/stderr, Unicode paths and content, live flushing, overwrite behavior, failed child processes, nonfatal diagnostics, unexpected exceptions, SystemExit messages, unusable destinations, normal operation without logging, and real CLI validation failures. The new suite is wired into both Windows and Linux source-regression CI. Validation on Windows: - `python -I -B tests/test_build_log.py` — 8 tests passed. - `tests/test_failure_reason.py` — 6 passed. - `tests/test_child_unicode.py` — passed, including its legacy encoding negative control. - `tests/test_shader_census_cmd.py` — 3 passed. - `tests/test_make_game_cache.py` — 6 passed. - `tests/test_builder_status.py` — 4 passed. - `git diff --check` — passed. Tests use temporary authored fixtures and dummy subprocesses; no game build or game files are needed. Native Linux execution remains for CI. Refs #267. This addresses the request to save CLI build output; interactive setup and dependency-download scripts remain separate work.
Commenting is not possible because the repository is archived.
No description provided.