Uh oh!
There was an error while loading. Please reload this page.
feat(fbuild-config): resolve project-local boards/*.json (closes #515) - #516
Conversation
When the built-in board database has no entry for the requested board id, fall back to `<project_dir>/boards/<board_id>.json`. This matches PlatformIO's behavior of auto-discovering project-local board manifests next to platformio.ini, so well-formed PIO projects that ship a boards/ directory build under fbuild without per-board upstream changes. Lookup order (fallback-only — bundled wins): 1. bundled DB (compile-time `include_dir!`) 2. <project_dir>/boards/<id>.json (NEW — only consulted on miss) Explicit override of a bundled board via the project-local path is intentionally NOT supported in this PR. Open a separate FR if needed. Public API: + BoardConfig::from_board_id_in_project(board_id, overrides, project_dir) Existing `from_board_id` becomes a thin wrapper that passes None. + compile_many internally passes the first sketch's project_dir through to platform_for_board, so `fbuild build <dir> -e <env>` resolves <dir>/boards/<env_board>.json automatically. Format handling: flatten_board_entry now accepts BOTH enriched (top-level `mcu`, `fcpu`, `ram`, `rom`) and PIO-format (`build.mcu`, `build.f_cpu`, `upload.maximum_ram_size`, `upload.maximum_size`) JSON so project- local PIO board manifests work without an enrichment pre-pass. Tests: 6 new tests in `tests_project_local.rs` cover: - project-local hit when bundled misses - bundled wins over project-local (precedence) - project_dir=None disables the fallback - missing file returns unknown-board - unparseable JSON returns unknown-board (warns) - from_board_id == from_board_id_in_project(None) All 77 board-module tests pass (soldr cargo test); workspace builds. Closes#515 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughfbuild now discovers and resolves board definitions from project-local ChangesProject-local board resolution
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
✨ 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 |
Uh oh!
There was an error while loading. Please reload this page.
Closes#515.
Summary
When the built-in board database has no entry for the requested board id, fall back to
<project_dir>/boards/<board_id>.json. This matches PlatformIO's behavior of auto-discovering project-local board manifests next toplatformio.ini, so well-formed PIO projects that ship aboards/directory build under fbuild without per-board upstream changes.Why
Reproducer from #515:
A user's
platformio.inideclaredboard = lpc845brkwith aboards/lpc845brk.jsonsitting next to it. PlatformIO finds it automatically; fbuild didn't even look. After this PR fbuild does the same lookup.Lookup order
include_dir!)<project_dir>/boards/<id>.json(NEW — only consulted when (1) misses)Precedence is fallback-only. Bundled wins over project-local. Explicit override of a bundled board via the project-local path is intentionally not supported here — open a separate FR if you want that.
Public API
compile_manyinternally passes the first sketch's project_dir throughplatform_for_board, sofbuild build <dir> -e <env>resolves<dir>/boards/<env_board>.jsonautomatically.Format handling
flatten_board_entrywas extended to accept BOTH:mcu,fcpu,ram,rom)build.mcu,build.f_cpu,upload.maximum_ram_size,upload.maximum_size)so project-local PIO board manifests work without an
enrich_boardspre-pass.Tests
6 new tests in
tests_project_local.rscover:project_dir = Nonedisables the fallback (back-compat withfrom_board_id)tracing::warn!)from_board_id==from_board_id_in_project(None)(equivalence)All 77
boardmodule tests pass undersoldr cargo test -p fbuild-config board::; workspace builds cleanly undersoldr cargo build --workspace --tests --bins.Reproducer that motivated this
Failing fbuild CI run on the ArduinoCore-LPC8xx side:
https://github.com/zackees/ArduinoCore-LPC8xx/actions/runs/27172681316/job/80214987717
Out of scope
~/.platformio/boards/user-global resolution (separate path, easy to add later).🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
boards/directory, providing fallback definitions when built-in board information is unavailable. Built-in configurations take precedence.Tests