Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: build/compiled_action.gni

Issue 2944103003: Introduce dart_host_toolchain arg, remove '--checked' option from patch_sdk.py (Closed)
Patch Set: Add comment Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/dart_host_toolchain.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 import("dart_host_toolchain.gni")
70
69 if (host_os == "win") { 71 if (host_os == "win") {
70 _host_executable_suffix = ".exe" 72 _host_executable_suffix = ".exe"
71 } else { 73 } else {
72 _host_executable_suffix = "" 74 _host_executable_suffix = ""
73 } 75 }
74 76
75 _dart_root = rebase_path("..") 77 _dart_root = rebase_path("..")
76 78
77 template("compiled_action") { 79 template("compiled_action") {
78 assert(defined(invoker.tool), "tool must be defined for $target_name") 80 assert(defined(invoker.tool), "tool must be defined for $target_name")
(...skipping 11 matching lines...) Expand all
90 script = "$_dart_root/build/gn_run_binary.py" 92 script = "$_dart_root/build/gn_run_binary.py"
91 93
92 if (defined(invoker.inputs)) { 94 if (defined(invoker.inputs)) {
93 inputs = invoker.inputs 95 inputs = invoker.inputs
94 } else { 96 } else {
95 inputs = [] 97 inputs = []
96 } 98 }
97 outputs = invoker.outputs 99 outputs = invoker.outputs
98 100
99 # Constuct the host toolchain version of the tool. 101 # Constuct the host toolchain version of the tool.
100 host_tool = invoker.tool + "($host_toolchain)" 102 host_tool = invoker.tool + "($dart_host_toolchain)"
101 103
102 # Get the path to the executable. Currently, this assumes that the tool 104 # Get the path to the executable. Currently, this assumes that the tool
103 # does not specify output_name so that the target name is the name to use. 105 # does not specify output_name so that the target name is the name to use.
104 # If that's not the case, we'll need another argument to the script to 106 # If that's not the case, we'll need another argument to the script to
105 # specify this, since we can't know what the output name is (it might be in 107 # specify this, since we can't know what the output name is (it might be in
106 # another file not processed yet). 108 # another file not processed yet).
107 host_executable = 109 host_executable =
108 get_label_info(host_tool, "root_out_dir") + "/" + 110 get_label_info(host_tool, "root_out_dir") + "/" +
109 get_label_info(host_tool, "name") + _host_executable_suffix 111 get_label_info(host_tool, "name") + _host_executable_suffix
110 112
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 sources = invoker.sources 145 sources = invoker.sources
144 146
145 if (defined(invoker.inputs)) { 147 if (defined(invoker.inputs)) {
146 inputs = invoker.inputs 148 inputs = invoker.inputs
147 } else { 149 } else {
148 inputs = [] 150 inputs = []
149 } 151 }
150 outputs = invoker.outputs 152 outputs = invoker.outputs
151 153
152 # Constuct the host toolchain version of the tool. 154 # Constuct the host toolchain version of the tool.
153 host_tool = invoker.tool + "($host_toolchain)" 155 host_tool = invoker.tool + "($dart_host_toolchain)"
154 156
155 # Get the path to the executable. Currently, this assumes that the tool 157 # Get the path to the executable. Currently, this assumes that the tool
156 # does not specify output_name so that the target name is the name to use. 158 # does not specify output_name so that the target name is the name to use.
157 # If that's not the case, we'll need another argument to the script to 159 # If that's not the case, we'll need another argument to the script to
158 # specify this, since we can't know what the output name is (it might be in 160 # specify this, since we can't know what the output name is (it might be in
159 # another file not processed yet). 161 # another file not processed yet).
160 host_executable = 162 host_executable =
161 get_label_info(host_tool, "root_out_dir") + "/" + 163 get_label_info(host_tool, "root_out_dir") + "/" +
162 get_label_info(host_tool, "name") + _host_executable_suffix 164 get_label_info(host_tool, "name") + _host_executable_suffix
163 165
164 # Add the executable itself as an input. 166 # Add the executable itself as an input.
165 inputs += [ host_executable ] 167 inputs += [ host_executable ]
166 168
167 deps = [ 169 deps = [
168 host_tool, 170 host_tool,
169 ] 171 ]
170 if (defined(invoker.deps)) { 172 if (defined(invoker.deps)) {
171 deps += invoker.deps 173 deps += invoker.deps
172 } 174 }
173 175
174 # The script takes as arguments the binary to run, and then the arguments 176 # The script takes as arguments the binary to run, and then the arguments
175 # to pass it. 177 # to pass it.
176 args = [ 178 args = [
177 "compiled_action", 179 "compiled_action",
178 rebase_path(host_executable, root_build_dir) 180 rebase_path(host_executable, root_build_dir)
179 ] + invoker.args 181 ] + invoker.args
180 } 182 }
181 } 183 }
OLDNEW
« no previous file with comments | « no previous file | build/dart_host_toolchain.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698