Previously, undefined Grit variables in
<if expr="..."> statements would silently be treated as
False (see code
here)
The previous behavior is fragile and has been the source of several bugs over time. Example types of bugs that were previously not caught at build time:
Example error (condensed)
[12492/32900] ACTION //chrome/browser:resources_grit(//build/toolchain/linux:clang_x64)
...
AssertionError: undefined Grit variable found: foo
As a follow-up, I plan to improve the error message to also mention the name of the file that contains the undefined variable, but that requires a bit of plumbing and I did not want to block the addition of the new check on it. The path to the failing target is already a good indication of where to look for the undefined variable.
I expect the new behavior to prevent <if expr>-related bugs from entering the codebase as well as save time that would previously be spent on debugging why a certain string/resource/piece-of-code is missing unexpectedly on a certain platform. Feel free to comment on the bug or here if you have any concerns or questions.
Thank you,
Demetrios