Index: mojo/public/tools/bindings/mojom.gni |
diff --git a/mojo/public/tools/bindings/mojom.gni b/mojo/public/tools/bindings/mojom.gni |
index 7ee71b2e5ef1d33294d2a4ef2adf6feb3a86e4b2..eeb32bd6efb500b4cb023a031ca471d2cfaa6258 100644 |
--- a/mojo/public/tools/bindings/mojom.gni |
+++ b/mojo/public/tools/bindings/mojom.gni |
@@ -75,11 +75,18 @@ template("mojom") { |
"{{source_gen_dir}}/{{source_name_part}}_mojom.py", |
] |
- target_visibility = ":$target_name" |
+ if (defined(invoker.visibility)) { |
+ # Need to save this because the the target_name is overwritten inside the |
+ # action to be that of the action itself. Only define this in the case the |
+ # var is used to avoid unused var error. |
+ target_visibility = [ ":$target_name" ] |
+ } |
generator_target_name = target_name + "_generator" |
action_foreach(generator_target_name) { |
- visibility = target_visibility |
+ if (defined(invoker.visibility)) { |
+ visibility = target_visibility + invoker.visibility |
+ } |
script = generator_script |
inputs = generator_sources |
sources = invoker.sources |