If the meson.build file is sufficiently "broken", even attempting to lex and parse it will totally fail, and we error out without getting the opportunity to evalaute the project() function. This can fairly easily happen if we add new grammar to the syntax, which old versions of meson cannot understand. Setting a minimum meson_version doesn't help, because people with a too-old version of meson get parser errors instead of advice about upgrading meson. Examples of this include adding dict support to meson. There are two general approaches to solving this issue, one of which projects are empowered to do: - refactor the project to place too-new syntax in a subdir() loaded build file, so the root file can be interpreted - teach meson to catch errors in building the initial AST, and just load enough of the AST to check for meson_version advice This implements the latter, allowing to future-proof the build grammar.pull/11466/head
parent
cc23996266
commit
878c1604e6
4 changed files with 41 additions and 7 deletions
@ -0,0 +1,3 @@ |
||||
project('invalid ast crash', meson_version: '0.1.0') |
||||
|
||||
= >%@ |
@ -0,0 +1,9 @@ |
||||
{ |
||||
"stdout": [ |
||||
{ |
||||
"match": "re", |
||||
"line": "test cases/failing/130 invalid ast/meson.build:1:44: ERROR: Meson version is [0-9.]+ but project requires 0.1.0" |
||||
} |
||||
] |
||||
} |
||||
|
Loading…
Reference in new issue