feat(build): emit PIO-compatible build_info.json for downstream tooling (#297)#314
feat(build): emit PIO-compatible build_info.json for downstream tooling (#297)#314zackees wants to merge 1 commit into
Conversation
…ng (#297) FastLED's size-check pipeline (`ci/compiled_size.py` and friends) expects a `build_info.json` (or `build_info_<example>.json`) at `.build/pio/<board>/`, populated as `pio project metadata --json-output` would emit it. Fbuild had no equivalent, so ~10 binary-size CI workflows on FastLED master were failing the moment fbuild became the default backend. Add a `build_info` module to fbuild-build that owns the metadata struct, the `<env_name>: { ... }` envelope, the `.build/pio/<board>/...` path layout, and an orchestrator-facing helper that pulls tool paths / flags / defines / includes off of the existing compiler + linker + board config. Tool paths the trait doesn't natively expose (`objdump`, `addr2line`) are derived from the size tool's prefix when possible, matching FastLED's `insert_tool_aliases` fallback. Plumbing: - `BuildParams::emit_build_info` + `example_name` gate generation; off by default so non-CI builds skip the I/O. - `fbuild build --emit-build-info [--example-name <NAME>]` opts in from the CLI; flows through `BuildRequest` to the daemon's build handler and into the orchestrator. - AVR, ESP32, Teensy, and STM32 orchestrators snapshot the data before they hand off `defines` to the compiler, then emit after the link. Unit tests cover the metadata struct (PIO-keyed serialization, deterministic defines), the file-layout helper (matches the candidate paths the FastLED consumer probes), the env-name envelope, and the project-basename → example-name fallback. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 46 minutes and 43 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (29)
✨ Finishing Touches🧪 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 |
|
Superseded by #309 which already landed emission on main. Closing as redundant; that implementation covers the same FastLED size-check unblock. |
Summary
New PIO-compatible
build_info.jsonemitter so FastLED's size-check pipeline (ci/compiled_size.py,ci/inspect_binary.py, etc.) works under fbuild. Gated on--emit-build-info(+ optional--example-name) so non-CI users don't pay the I/O cost.crates/fbuild-build/src/build_info.rs:BuildInfoMetadatamirroring PIO'spio project metadata --json-output(prog_path, cc_path/cxx_path/ar_path/objcopy_path/objdump_path/addr2line_path/size_path, cc_flags/cxx_flags/link_flags/libs/defines/includes, extra_flags/srcs/frameworks/platform/board),BuildInfoBuilder,write_build_info_json,build_info_path,default_example_name.Linkertrait grows defaultar_path()/objcopy_path()accessors (returnsNone); AVR / ESP32 / Teensy / generic ARM linkers implement them.BoardConfig+defines+include_dirs+ sources before the compiler moves them, then callemit_build_info_for_orchestrator(...)after the link whenparams.emit_build_infois true.--emit-build-info/--example-nameflags onfbuild build; threaded throughBuildRequest(CLI ↔ daemon) andBuildParams.<project>/.build/pio/<board>/build_info_<example>.json(mirrors what_find_build_infoprobes). Example name resolution:--example-name→default_example_name(project_dir)(basename) → plainbuild_info.jsonfallback.Closes #297. Unblocks ~10 FastLED size-check workflows (check_uno_size, check_attiny85, check_teensy*_size, check_stm32f103c8_bluepill_size, esp32dev_binary_size, etc.).
Test plan
build_info::tests(path layout, metadata key serialization, write+roundtrip, default-example-name)soldr cargo check --workspace --all-targetscleansoldr cargo clippy --workspace --all-targets -- -D warningscleanNotes
frameworksis hard-coded["arduino"]for every supported orchestrator; matches every board in the issue's hot list.link_flags/libsreflect overlay (extra-script / sketch-script) values; bulk-link state lives in MCU JSON which fbuild owns.🤖 Generated with Claude Code