Repository navigation
feat(fqbn): expose FQBN resolution as fbuild fqbn (#1298) - #2228
Merged
Merged
Conversation
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.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
fbuild fqbn <FQBN> [--version <v>] [--arduino-data-dir <dir>] [--json]— theCLI 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.
key=valuelines (identity, thenboard.*sorted, thenplatform.*sorted) so it pipes:fbuild fqbn … | grep '^board.build.mcu='.--jsonemits one object withboard_properties/platform_properties.<data_dir>/packages/<vendor>/hardware/<arch>/<version>/, the layoutarduino-cli/ the Arduino IDE produce.--arduino-data-dirwins, thenARDUINO_DIRECTORIES_DATA, then theconventional 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 = c086d1b6the command does not exist, and a bare FQBN istaken as a project directory:
The first test run also failed on the data-dir rule above (
--arduino-data-dirpointing at a missing dir resolved
~/.arduino15instead:architecture 'dummy' is not installed for vendor 'Demo' (expected /home/…/.arduino15/…)),which is what
an_explicit_data_dir_wins_even_when_it_does_not_existnowpins. 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-25665d9de0b…fd784f= the indexchecksum), installed under
<data>/packages/Seeeduino/hardware/mbed/2.9.3:--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;board 'nosuch' is not defined … (4 defined: …);version '9.9.9' is not installed … (installed: 2.9.3);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.fqbnthroughResolutionContext) stays open — it can only land once a resolved FQBN mapsonto an orchestrator, because a vendor core's
build.mcucan be an ARM core(
cortex-m4) rather than a chip. The printed properties are exactly what thatmapping 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.mdgains### fbuild fqbn.