Repository navigation
feat(fqbn): expand a resolved FQBN's build recipe into an argv (#1298) - #2235
Merged
Merged
Conversation
Adds `fqbn_recipe::expand_recipe` and `fbuild fqbn --recipe <key> --prop k=v`:
one platform.txt recipe (e.g. recipe.c.o.pattern) is expanded for the resolved
board into the command it names, exposed as text and as a shell-free argv, with
nothing executed.
Rules: nothing unset is invented (builder-derived values such as build.arch,
runtime.ide.version, build.core.path, source_file are caller properties);
a --prop never overrides a boards.txt/platform.txt property; quoting is `"`
only so a backslash stays literal.
Fixes the pre-existing {..} expander, which budgeted expansion passes and
replaced one reference per pass, so any template naming more than 8 references
was misreported as a cycle. A pass now expands every reference at its level.
Measured on arduino:[email protected] and Seeeduino:[email protected] installed from their
published indexes: both expanded recipes spawned an ELF32 object (Atmel AVR /
ARM) with no hand-written flags.
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 this adds
fbuild fqbn <FQBN> --recipe <key> --prop k=v— expand oneplatform.txtbuildrecipe for a resolved board into the command it names, and print it without
executing it. This is the expansion half of #1298's follow-up 4 (the design
doc's new "Follow-up 4a" section);
fbuild build --fqbnstays the remainingcell.
--jsonaddsrecipe{key, template, command, argv[]};argvis the shell-freesplit. A recipe that cannot expand is reported in-band as
recipe_error=besidea successful resolution, like
orchestrator_error=/toolchain_error=.Three rules, all refusals
platform.txt+ the board record(
build.arch,runtime.ide.version,build.core.path,build.variant.path,source_file,object_file,includes,build.path) are caller propertieswhen a recipe names them; an unset one is an error naming the reference.
Deriving
build.archfrom aPlatformwould be the secondmcu → Platformrule this work already refused to add.
--propnever overrides the package — it is refused naming both sides,because a silent override compiles for a different target.
"only; a backslash stays literal ("-IC:\Arduino\libraries"survives). An unterminated quote is refused, not guessed.
A real defect found by the real recipes
The pre-existing
{…}expander budgeted expansion passes and replaced exactlyone reference per pass, so any template naming more than 8 references was
reported as a
{…}cycle. Every earlier template had two references; the realrecipe.c.o.patternnames thirteen. A pass now expands every reference at itslevel, so the bound counts nesting — which is what a cycle is. Proved RED by
restoring the one-reference-per-pass loop:
does not finish expanding after 8 passes (a {…} cycle …), test exit 101.Measured, on published packages (no arduino-cli anywhere)
The AVR run is also the acceptance control for "not Seeed-specific": second
vendor, second architecture (
avr), second tool family (.tar.bz2avr-gcc),and a
unorecord with no menus at all. The Seeed run refuses{build.core.path}/{build.variant.path}until they are passed — the honestrefusal, verified.
Gates (all real output)
fqbn_recipe8/8; engine--lib671 passed, 0 failed (59fqbn*);fbuild-cli --bin fbuild575 passed, 0 failed (26fqbn*, 4 new).cargo fmt --all -- --checkclean;clippy -p fbuild-build-engine -p fbuild-cli --all-targets -- -D warningsexit 0; cross-targetx86_64-pc-windows-msvcclippy exit 0 andaarch64-apple-darwincheck exit 0(ci-full-only lints).
ci/enforce_platform_boundary.py --print-totals→rows=0; dylint_rows=0.collision guard disabled → shadowing test fails (exit 101).
Deliberately not done
{includes}contents, no
recipe.hooks.*(executed, not expanded — still undecided).build --fqbnwiring, and no change to the PlatformIO resolution path.Docs:
docs/reference/cli.md(fbuild fqbnsection + summary row) anddocs/design/fqbn-resolution.md("Follow-up 4a", follow-up list item 4).#1298 stays open.