Skip to content

feat(fqbn): expose FQBN resolution as fbuild fqbn (#1298) - #2228

Merged
zackees merged 1 commit into
mainfrom
agent/1298-cli-surface
Dec 1, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/1298-cli-surface

Conversation

@zackees

@zackees zackees commented Dec 1, 2026

Copy link
Copy Markdown
Member

What

fbuild fqbn <FQBN> [--version <v>] [--arduino-data-dir <dir>] [--json] — the
CLI surface of the FQBN resolver delivered in #2227 (#1298).

The resolver worked but had zero production callers (only its own tests),
so the identity it produces was unreachable without writing Rust. This adds the
query surface and proves it end to end against a real published vendor package.

$ fbuild fqbn Seeeduino:mbed:xiaonRF52840Plus --arduino-data-dir <data>
fqbn=Seeeduino:mbed:xiaonRF52840Plus
package=<data>/packages/Seeeduino/hardware/mbed/2.9.3
vendor=Seeeduino
architecture=mbed
board_id=xiaonRF52840Plus
package_version=2.9.3
# board properties (boards.txt, with the FQBN's menus applied)
board.build.board=SEEED_XIAO_NRF52840_PLUS
board.build.crossprefix=arm-none-eabi-
board.build.mcu=cortex-m4
board.build.variant=SEEED_XIAO_NRF52840_PLUS
...
# platform properties (platform.txt, verbatim)
platform.compiler.c.cmd={build.crossprefix}gcc
platform.name=Seeed nRF52 mbed-enabled Boards
platform.version=2.9.3
  • Deterministic key=value lines (identity, then board.* sorted, then
    platform.* sorted) so it pipes: fbuild fqbn … | grep '^board.build.mcu='.
  • --json emits one object with board_properties / platform_properties.
  • Nothing is downloaded: it reads
    <data_dir>/packages/<vendor>/hardware/<arch>/<version>/, the layout
    arduino-cli / the Arduino IDE produce.
  • --arduino-data-dir wins, then ARDUINO_DIRECTORIES_DATA, then the
    conventional install location (%LOCALAPPDATA%\Arduino15, ~/.arduino15).
    A flag/environment value is authoritative even when the path does not
    exist
    , so the diagnostic names what the caller asked for instead of
    silently resolving a different install (this host has a real ~/.arduino15,
    which is how the bug showed up).

RED evidence

At origin/main = c086d1b6 the command does not exist, and a bare FQBN is
taken as a project directory:

$ fbuild fqbn Seeeduino:mbed:xiaonRF52840Plus
error: unexpected argument 'Seeeduino:mbed:xiaonRF52840Plus' found
Usage: fbuild [OPTIONS] [PROJECT_DIR] [COMMAND]

The first test run also failed on the data-dir rule above (--arduino-data-dir
pointing at a missing dir resolved ~/.arduino15 instead: architecture 'dummy' is not installed for vendor 'Demo' (expected /home/…/.arduino15/…)),
which is what an_explicit_data_dir_wins_even_when_it_does_not_exist now
pins. Proved RED by re-introducing the "must exist" guard: 1 failed / 0
passed; restored → 12/12.

Real output (this host, real published package)

Seeeduino:[email protected] (34,722,259 B, SHA-256 65d9de0b…fd784f = the index
checksum), installed under <data>/packages/Seeeduino/hardware/mbed/2.9.3:

  • no --version → resolves (only one version installed);
  • board.build.mcu=cortex-m4, board.build.variant=SEEED_XIAO_NRF52840_PLUS,
    board.build.crossprefix=arm-none-eabi-, platform.name=Seeed nRF52 mbed-enabled Boards, platform.version=2.9.3;
  • unknown board → exit 1, board 'nosuch' is not defined … (4 defined: …);
  • uninstalled version → exit 1, version '9.9.9' is not installed … (installed: 2.9.3);
  • malformed arduino:avr → exit 1, expected at least three colon-separated fields.

Scope

Additive: a new subcommand plus docs; no existing resolution path changes. The
build-side input (fbuild build --fqbn, board_build.fqbn through
ResolutionContext) stays open — it can only land once a resolved FQBN maps
onto an orchestrator, because a vendor core's build.mcu can be an ARM core
(cortex-m4) rather than a chip. The printed properties are exactly what that
mapping consumes. #1298 stays open for follow-ups 2-4.

Design record: docs/design/fqbn-resolution.md (status + follow-up 1 updated).
Reference: docs/reference/cli.md gains ### fbuild fqbn.

The resolver from #2227 had zero production callers: an installed vendor
package could only be resolved from Rust tests. Add the query surface.

  fbuild fqbn <FQBN> [--version <v>] [--arduino-data-dir <dir>] [--json]

Prints the identity plus both property maps deterministically (`board.*`
with the FQBN's menus applied, `platform.*` verbatim), so it pipes; --json
emits the same as one object. Nothing is downloaded: the package is read
from <data_dir>/packages/<vendor>/hardware/<arch>/<version>/.

Data dir: --arduino-data-dir, then ARDUINO_DIRECTORIES_DATA, then the
conventional install location. A flag/environment value is authoritative
even when the path is missing, so the diagnostic names what the caller
asked for instead of silently resolving another install.

Real run against the published Seeeduino:[email protected] package: mcu
cortex-m4, variant SEEED_XIAO_NRF52840_PLUS, platform "Seeed nRF52
mbed-enabled Boards" 2.9.3. Building from an FQBN remains follow-up 2.

Tests: fqbn_cmd 12/12, cli bin 561/561, clippy -D warnings 0, fmt 0,
platform boundary rows=0. RED proved: subcommand absent at c086d1b, and
the data-dir precedence test fails with the "must exist" guard restored.
@zackees
zackees added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 481eaa5 Dec 1, 2026
44 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant