Skip to content

feat(build): emit PIO-compatible build_info.json for downstream tooling (#297)#314

Closed
zackees wants to merge 1 commit into
mainfrom
feat/build-info-json-297
Closed

feat(build): emit PIO-compatible build_info.json for downstream tooling (#297)#314
zackees wants to merge 1 commit into
mainfrom
feat/build-info-json-297

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented May 30, 2026

Summary

New PIO-compatible build_info.json emitter 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.

  • New crates/fbuild-build/src/build_info.rs: BuildInfoMetadata mirroring PIO's pio 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.
  • Linker trait grows default ar_path() / objcopy_path() accessors (returns None); AVR / ESP32 / Teensy / generic ARM linkers implement them.
  • Orchestrators (AVR / ESP32 / Teensy / STM32 — the platforms behind the failing FastLED size-check workflows) snapshot the relevant BoardConfig + defines + include_dirs + sources before the compiler moves them, then call emit_build_info_for_orchestrator(...) after the link when params.emit_build_info is true.
  • CLI: new --emit-build-info / --example-name flags on fbuild build; threaded through BuildRequest (CLI ↔ daemon) and BuildParams.
  • Output path: <project>/.build/pio/<board>/build_info_<example>.json (mirrors what _find_build_info probes). Example name resolution: --example-namedefault_example_name(project_dir) (basename) → plain build_info.json fallback.

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

Notes

  • frameworks is hard-coded ["arduino"] for every supported orchestrator; matches every board in the issue's hot list.
  • link_flags / libs reflect overlay (extra-script / sketch-script) values; bulk-link state lives in MCU JSON which fbuild owns.

🤖 Generated with Claude Code

…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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Warning

Review limit reached

@zackees, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 41695ba5-a05b-4816-b822-67a010c47336

📥 Commits

Reviewing files that changed from the base of the PR and between 1a4d661 and f8e887c.

📒 Files selected for processing (29)
  • crates/fbuild-build/src/avr/avr_linker.rs
  • crates/fbuild-build/src/avr/orchestrator.rs
  • crates/fbuild-build/src/build_info.rs
  • crates/fbuild-build/src/compile_many.rs
  • crates/fbuild-build/src/esp32/esp32_linker.rs
  • crates/fbuild-build/src/esp32/orchestrator/build.rs
  • crates/fbuild-build/src/generic_arm/arm_linker.rs
  • crates/fbuild-build/src/lib.rs
  • crates/fbuild-build/src/linker.rs
  • crates/fbuild-build/src/stm32/orchestrator/mod.rs
  • crates/fbuild-build/src/teensy/orchestrator.rs
  • crates/fbuild-build/tests/avr_build.rs
  • crates/fbuild-build/tests/eh_frame_strip_esp32.rs
  • crates/fbuild-build/tests/esp32_build.rs
  • crates/fbuild-build/tests/stm32_acceptance.rs
  • crates/fbuild-build/tests/teensy30_acceptance.rs
  • crates/fbuild-build/tests/teensy_build.rs
  • crates/fbuild-build/tests/teensylc_acceptance.rs
  • crates/fbuild-cli/src/cli/args.rs
  • crates/fbuild-cli/src/cli/build.rs
  • crates/fbuild-cli/src/cli/clang_tools.rs
  • crates/fbuild-cli/src/cli/dispatch.rs
  • crates/fbuild-cli/src/daemon_client.rs
  • crates/fbuild-cli/src/mcp/tools.rs
  • crates/fbuild-daemon/src/handlers/emulator/select.rs
  • crates/fbuild-daemon/src/handlers/emulator/tests_process.rs
  • crates/fbuild-daemon/src/handlers/operations/build.rs
  • crates/fbuild-daemon/src/handlers/operations/deploy.rs
  • crates/fbuild-daemon/src/models.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/build-info-json-297

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
Copy link
Copy Markdown
Member Author

zackees commented May 30, 2026

Superseded by #309 which already landed emission on main. Closing as redundant; that implementation covers the same FastLED size-check unblock.

@zackees zackees closed this May 30, 2026
@zackees zackees deleted the feat/build-info-json-297 branch May 30, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fbuild deficiency vs PlatformIO: no build_info.json metadata emitter (blocks downstream size/symbol tooling)

1 participant