feat(build-info): emit build_info_<env>.json after link (fixes #297)#309
Conversation
…ixes #297) Adds a post-link emitter that writes a PlatformIO-compatible build_info_<env>.json (and the no-example-fallback build_info.json) to the project directory after a successful sequential build. Outer dict is keyed by env name (matching `pio project metadata --json-output`); inner dict carries prog_path plus toolchain binaries (cc/cxx/ar/objcopy /size) and the compile/link flags fbuild already knows. This unblocks every FastLED size-check and symbol-analysis workflow that was silently failing because fbuild compiles succeeded but downstream _find_build_info() calls couldn't locate the metadata file. Same shape as `pio project metadata --json-output` so FastLED's ci/compiled_size.py::_create_board_info accepts it unmodified. Hooked into pipeline/sequential.rs only -- covers AVR, Teensy, RP2040, STM32, NRF52, SAM, Renesas, Apollo3, CH32V, ESP8266. ESP32 (different pipeline) and WASM (no firmware.elf) intentionally deferred to a follow-up. Linker trait gains three optional accessors (ar_tool_path, objcopy_tool_path, link_driver_path) defaulting to None -- per-platform linkers override to expose the toolchain binaries they already hold. Closes #297.
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis pull request implements PlatformIO-compatible build metadata emission for fbuild, enabling downstream CI tooling (size checks, symbol analysis) to consume build configuration without depending on PlatformIO's CLI. The feature extends the ChangesBuild Metadata Emission and Platform Linker Path Exposure
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #297. fbuild now emits a PlatformIO-shape
build_info_<env>.jsonnext to the project's other build artifacts at the end of a successful sequential build. FastLED's existingci/compiled_size.py,ci/inspect_binary.py,ci/symbol_analysis_runner.pyetc. consume this file unmodified.Coverage
Wired into
pipeline/sequential.rs, which covers AVR, Teensy, RP2040, STM32, NRF52, SAM, Renesas, Apollo3, CH32V, ESP8266. ESP32 uses a different (parallel-compile) pipeline and is intentionally deferred -- same is true for WASM (no firmware.elf). All linkers (including the ESP32 one) already override the new trait accessors, so wiring ESP32 into the emitter in a follow-up PR is a one-call addition.Schema
{ "<env>": { "prog_path": "...", "cc_path": "...", "cxx_path": "...", "ar_path": "...", "objcopy_path": "...", "size_path": "...", "cc_flags": ["..."], "cxx_flags": ["..."], "link_flags": ["..."], "defines": ["..."], "includes": ["..."], "libs": ["..."], "platform": "...", "board": "...", "env": "..." } }Writes both
build_info_<env>.json(example-specific) andbuild_info.json(generic fallback) per FastLED's_find_build_infolookup order.Linker trait change
Added three optional accessors with
Nonedefaults so non-overriding linkers compile unchanged:All 10 per-platform linkers override these to return the toolchain binary paths they already hold (
gcc_path,ar_path,objcopy_path).Out of scope
insert_tool_aliasespost-processor (lives on the FastLED side, not in this PR).Verification
soldr cargo check -p fbuild-build-- clean.soldr cargo clippy -p fbuild-build --all-targets -- -D warnings-- clean (only pre-existing MSRV-mismatch warning in clippy.toml unrelated to this change).soldr cargo test -p fbuild-build --lib build_info-- 7 unit tests pass (schema round-trip, dual-file write, env-key wrapping, prog-path priority, define/include extraction).Summary by CodeRabbit
New Features
build_info.jsonmetadata files containing toolchain paths, compiler flags, defines, includes, and firmware image information for improved IDE and build tool integration.Chores