GN: forward_variables_from shouldn't clobber vars.
The documentation for forward_variables_from specifies that it will give an error if the variable already exists in the target scope. But this was not implemented. Instead, the value would be silently overwritten.
This change implements the error, and fixes the times this happens in the Linux and Android builds.
Review-Url: https://codereview.chromium.org/1943583002
Cr-Commit-Position: refs/heads/master@{#391136}
diff --git a/build/compiled_action.gni b/build/compiled_action.gni
index 855df7a..c7fb8c65 100644
--- a/build/compiled_action.gni
+++ b/build/compiled_action.gni
@@ -81,8 +81,6 @@
"compiled_action doesn't take a sources arg. Use inputs instead.")
action(target_name) {
- deps = []
- inputs = []
forward_variables_from(invoker,
[
"deps",
@@ -91,6 +89,12 @@
"testonly",
"visibility",
])
+ if (!defined(deps)) {
+ deps = []
+ }
+ if (!defined(inputs)) {
+ inputs = []
+ }
script = "//build/gn_run_binary.py"
@@ -124,8 +128,6 @@
assert(defined(invoker.args), "args must be defined for $target_name")
action_foreach(target_name) {
- deps = []
- inputs = []
forward_variables_from(invoker,
[
"deps",
@@ -135,6 +137,12 @@
"testonly",
"visibility",
])
+ if (!defined(deps)) {
+ deps = []
+ }
+ if (!defined(inputs)) {
+ inputs = []
+ }
script = "//build/gn_run_binary.py"