commit | 77418b70b4856ba0b55497a016041b8a34efb54a | [log] [tgz] |
---|---|---|
author | Sasha Smundak <asmundak@google.com> | Tue Jan 21 13:31:06 2020 -0800 |
committer | Sasha Smundak <asmundak@google.com> | Thu Jan 23 13:32:43 2020 -0800 |
tree | f72a51a9c13ac0ff39a7c2b90243d58a9f8ef112 | |
parent | 0c4d1db0a0fd0affb77a9175872256ba4eea1524 [diff] |
Fix null pointer dereference printing an expression. Parser.parseVariable method should always set the value of the variable it creates. Failure to do so may end up in the following: ``` $ androidmk <(printf "FOO:=(X)\nFOO:=bar\n") parse error: <input>:3:1: variable already set, previous assignment: FOO@<input>:1:5 = %!s(PANIC=String method: runtime error: invalid memory address or nil pointer dereference) (%!s(PANIC=String method: runtime error: invalid memory address or nil pointer dereference)) false ``` The cause is that calling Parser.Parse to parse `FOO=abc` created a Variable instance with nil value, causing panic on print attempt. Test: m androidmk && androidmk <(printf "FOO:=(X)\nFOO:=bar\n") (should print: ERROR: parse error: <input>:3:1: variable already set, previous assignment: FOO@<input>:1:5 = X = Not Evaluated (X = Not Evaluated) false) Change-Id: I296d7984df6d8796e0075f9eb692b234f8c94f08
Blueprint is a meta-build system that reads in Blueprints files that describe modules that need to be built, and produces a Ninja manifest describing the commands that need to be run and their dependencies. Where most build systems use built-in rules or a domain-specific language to describe the logic for converting module descriptions to build rules, Blueprint delegates this to per-project build logic written in Go. For large, heterogenous projects this allows the inherent complexity of the build logic to be maintained in a high-level language, while still allowing simple changes to individual modules by modifying easy to understand Blueprints files.