Unexpanded properties no longer deleted from recipe.preproc.macros
#2261
Labels
conclusion: resolved
Issue was resolved
topic: build-process
Related to the sketch build process
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Milestone
Describe the problem
The Arduino "properties" data format used by the boards platform configuration files provides a templating (AKA "pattern" or "recipe") system where properties can be referenced using a
{<property name>}
syntax. These references are "expanded" to the value of the referenced property.If no property of the referenced name was set, the reference is left in the string following the expansion (e.g., if a property named
bar
was not set, expanding the string"foo {bar} baz"
will result in"foo {bar} baz"
), but it is also possible to delete any unexpanded references from a string (e.g., adding a deletion operation to the previous example would result in"foo baz"
).Although unexpanded references are generally not deleted by the platform system, deletion is done on the commands generated by certain command patterns (AKA "recipes"). Previously this was done for the
recipe.preproc.macros
pattern.🐛 Unexpanded reference deletion is no longer done for the
recipe.preproc.macros
pattern. This will break platforms that relied on the deletion for some reason.To reproduce
🐛 Compilation now fails when there is a reference to a nonexistent property in the platform's
recipe.preproc.macros
property.Expected behavior
Document change in handling of
recipe.preproc.macros
in upgrading guide and changelog.-OR-
Restore historical behavior by going back to deleting unexpanded properties in the command generated from
recipe.preproc.macros
Arduino CLI version
246adf9
Operating system
All
Operating system version
Any
Additional context
I bisected the regression to 0585435 (does not occur when using the build from the previous commit 9ce2904).
0585435 is described as a refactoring that is not expected to change behavior or be breaking (#2194), which leads me to believe this was unintentional.
A significant real world example of a platform impacted by this change is the
teensy:avr
boards platform (CC: @PaulStoffregen).Its
recipe.preproc.macros
property:references a nonexistent property
compiler.cpp.flags
, which causes compilation for any Teensy board to fail:The presence of this reference could be considered a bug in the
teensy:avr
platform and could easily be fixed either by removing the reference from the property:Or if there is use of this reference as an "extra flags" type of application, where users are using it to inject arbitrary flags into the generated command, by adding a fallback property value to
platform.txt
:Workaround
Remove references to nonexistent properties from the
recipe.preproc.macros
property in yourplatform.txt
file.Issue checklist
The text was updated successfully, but these errors were encountered: