OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # This file introduces two related templates that act like action and | 5 # This file introduces two related templates that act like action and |
6 # action_foreach but instead of running a Python script, it will compile a | 6 # action_foreach but instead of running a Python script, it will compile a |
7 # given tool in the host toolchain and run that (either once or over the list | 7 # given tool in the host toolchain and run that (either once or over the list |
8 # of inputs, depending on the variant). | 8 # of inputs, depending on the variant). |
9 # | 9 # |
10 # Parameters | 10 # Parameters |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 # if (host_toolchain == current_toolchain) { | 59 # if (host_toolchain == current_toolchain) { |
60 # executable("mytool") { | 60 # executable("mytool") { |
61 # ... | 61 # ... |
62 # } | 62 # } |
63 # } | 63 # } |
64 # The if statement around the executable is optional. That says "I only care | 64 # The if statement around the executable is optional. That says "I only care |
65 # about this target in the host toolchain". Usually this is what you want, and | 65 # about this target in the host toolchain". Usually this is what you want, and |
66 # saves unnecessarily compiling your tool for the target platform. But if you | 66 # saves unnecessarily compiling your tool for the target platform. But if you |
67 # need a target build of your tool as well, just leave off the if statement. | 67 # need a target build of your tool as well, just leave off the if statement. |
68 | 68 |
69 if (host_os == "win") { | 69 if (build_os == "win") { |
70 _host_executable_suffix = ".exe" | 70 _host_executable_suffix = ".exe" |
71 } else { | 71 } else { |
72 _host_executable_suffix = "" | 72 _host_executable_suffix = "" |
73 } | 73 } |
74 | 74 |
75 template("compiled_action") { | 75 template("compiled_action") { |
76 assert(defined(invoker.tool), "tool must be defined for $target_name") | 76 assert(defined(invoker.tool), "tool must be defined for $target_name") |
77 assert(defined(invoker.outputs), "outputs must be defined for $target_name") | 77 assert(defined(invoker.outputs), "outputs must be defined for $target_name") |
78 assert(defined(invoker.args), "args must be defined for $target_name") | 78 assert(defined(invoker.args), "args must be defined for $target_name") |
79 | 79 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ] | 164 ] |
165 if (defined(invoker.deps)) { | 165 if (defined(invoker.deps)) { |
166 deps += invoker.deps | 166 deps += invoker.deps |
167 } | 167 } |
168 | 168 |
169 # The script takes as arguments the binary to run, and then the arguments | 169 # The script takes as arguments the binary to run, and then the arguments |
170 # to pass it. | 170 # to pass it. |
171 args = [ rebase_path(host_executable, root_build_dir) ] + invoker.args | 171 args = [ rebase_path(host_executable, root_build_dir) ] + invoker.args |
172 } | 172 } |
173 } | 173 } |
OLD | NEW |