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 import("//third_party/WebKit/Source/core/core_idl_files.gni") | 5 import("//third_party/WebKit/Source/core/core_idl_files.gni") |
6 import("//third_party/WebKit/Source/modules/modules_idl_files.gni") | 6 import("//third_party/WebKit/Source/modules/modules_idl_files.gni") |
7 | 7 |
8 bindings_scripts_dir = get_path_info(".", "abspath") | 8 bindings_scripts_dir = get_path_info(".", "abspath") |
9 bindings_scripts_output_dir = "$root_gen_dir/blink/bindings/scripts" | 9 bindings_scripts_output_dir = "$root_gen_dir/blink/bindings/scripts" |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 # | 135 # |
136 # Parameters: | 136 # Parameters: |
137 # sources = list of IDL files to compile | 137 # sources = list of IDL files to compile |
138 # output_dir = string containing the directory to put the output files. | 138 # output_dir = string containing the directory to put the output files. |
139 # output_name_suffix = a suffix after the basename of the output file names. | 139 # output_name_suffix = a suffix after the basename of the output file names. |
140 # target_component = component to generate code for. | 140 # target_component = component to generate code for. |
141 template("idl_compiler") { | 141 template("idl_compiler") { |
142 output_dir = invoker.output_dir | 142 output_dir = invoker.output_dir |
143 output_name_suffix = invoker.output_name_suffix | 143 output_name_suffix = invoker.output_name_suffix |
144 | 144 |
145 action_foreach(target_name) { | 145 # TODO(brettw): we used to add a "-S" before the script name to skip |
146 # TODO(brettw) GYP adds a "-S before the script name to skip "import site" t
o | 146 # "import site" to speed up startup. Figure out if we need this and do |
147 # speed up startup. Figure out if we need this and do something similar (not | 147 # something similar (not really expressible in GN now). |
148 # really expressible in GN now). | 148 _script = "//third_party/WebKit/Source/bindings/scripts/idl_compiler.py" |
149 script = "//third_party/WebKit/Source/bindings/scripts/idl_compiler.py" | 149 _inputs = idl_lexer_parser_files + idl_compiler_files # to be explicit (cover
ed by parsetab) |
| 150 _inputs += [ |
| 151 "$bindings_scripts_output_dir/lextab.py", |
| 152 "$bindings_scripts_output_dir/parsetab.pickle", |
| 153 "$bindings_scripts_output_dir/cached_jinja_templates.stamp", |
| 154 "$bindings_dir/IDLExtendedAttributes.txt", |
150 | 155 |
151 inputs = idl_lexer_parser_files + idl_compiler_files # to be explicit (cove
red by parsetab) | 156 # If the dependency structure or public interface info (e.g., |
152 inputs += [ | 157 # [ImplementedAs]) changes, we rebuild all files, since we're not |
153 "$bindings_scripts_output_dir/lextab.py", | 158 # computing dependencies file-by-file in the build. |
154 "$bindings_scripts_output_dir/parsetab.pickle", | 159 # This data is generally stable. |
155 "$bindings_scripts_output_dir/cached_jinja_templates.stamp", | 160 "$bindings_modules_output_dir/InterfacesInfoOverall.pickle", |
156 "$bindings_dir/IDLExtendedAttributes.txt", | 161 ] |
157 | 162 |
158 # If the dependency structure or public interface info (e.g., | 163 # Further, if any dependency (partial interface or implemented |
159 # [ImplementedAs]) changes, we rebuild all files, since we're not | 164 # interface) changes, rebuild everything, since every IDL potentially |
160 # computing dependencies file-by-file in the build. | 165 # depends on them, because we're not computing dependencies |
161 # This data is generally stable. | 166 # file-by-file. |
162 "$bindings_modules_output_dir/InterfacesInfoOverall.pickle", | 167 # FIXME: This is too conservative, and causes excess rebuilds: |
163 ] | 168 # compute this file-by-file. http://crbug.com/341748 |
| 169 # This should theoretically just be the IDL files passed in. |
| 170 _inputs += core_all_dependency_idl_files + modules_all_dependency_idl_files |
164 | 171 |
165 # Further, if any dependency (partial interface or implemented | 172 _public_deps = [ |
166 # interface) changes, rebuild everything, since every IDL potentially | 173 "//third_party/WebKit/Source/bindings/core:core_global_constructors_idls", |
167 # depends on them, because we're not computing dependencies | |
168 # file-by-file. | |
169 # FIXME: This is too conservative, and causes excess rebuilds: | |
170 # compute this file-by-file. http://crbug.com/341748 | |
171 # This should theoretically just be the IDL files passed in. | |
172 inputs += core_all_dependency_idl_files + modules_all_dependency_idl_files | |
173 | 174 |
174 sources = invoker.sources | 175 # FIXME: should be interfaces_info_core (w/o modules) |
175 outputs = [ | 176 # http://crbug.com/358074 |
176 "$output_dir/V8{{source_name_part}}${output_name_suffix}.cpp", | 177 "//third_party/WebKit/Source/bindings/modules:interfaces_info", |
177 "$output_dir/V8{{source_name_part}}${output_name_suffix}.h", | 178 "//third_party/WebKit/Source/bindings/modules:modules_core_global_constructo
rs_idls", |
178 ] | 179 "//third_party/WebKit/Source/bindings/modules:modules_global_constructors_id
ls", |
| 180 "//third_party/WebKit/Source/bindings/scripts:cached_jinja_templates", |
| 181 "//third_party/WebKit/Source/bindings/scripts:cached_lex_yacc_tables", |
| 182 "//third_party/WebKit/Source/core:generated_testing_idls", |
| 183 ] |
179 | 184 |
180 args = [ | 185 # On mac spawning a python process per IDL file is slow. Use a single action |
181 "--cache-dir", | 186 # instead. |
182 rebase_path(bindings_scripts_output_dir, root_build_dir), | 187 # TODO(bashi,tikuta): Use a pool when crbug.com/635308 is fixed. |
183 "--output-dir", | 188 if (is_mac) { |
184 rebase_path(output_dir, root_build_dir), | 189 action(target_name) { |
185 "--info-dir", | 190 script = _script |
186 rebase_path("$bindings_output_dir", root_build_dir), | 191 inputs = _inputs |
187 "--target-component", | 192 public_deps = _public_deps |
188 invoker.target_component, | |
189 "{{source}}", | |
190 ] | |
191 | 193 |
192 public_deps = [ | 194 sources = invoker.sources |
193 "//third_party/WebKit/Source/bindings/core:core_global_constructors_idls", | 195 outputs = [] |
| 196 foreach(_source, sources) { |
| 197 _name_part = get_path_info(_source, "name") |
| 198 outputs += [ |
| 199 "$output_dir/V8${_name_part}${output_name_suffix}.cpp", |
| 200 "$output_dir/V8${_name_part}${output_name_suffix}.h", |
| 201 ] |
| 202 } |
194 | 203 |
195 # FIXME: should be interfaces_info_core (w/o modules) | 204 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" |
196 # http://crbug.com/358074 | 205 write_file(idl_files_list, rebase_path(invoker.sources, root_build_dir)) |
197 "//third_party/WebKit/Source/bindings/modules:interfaces_info", | 206 inputs += [ idl_files_list ] |
198 "//third_party/WebKit/Source/bindings/modules:modules_core_global_construc
tors_idls", | 207 |
199 "//third_party/WebKit/Source/bindings/modules:modules_global_constructors_
idls", | 208 args = [ |
200 "//third_party/WebKit/Source/bindings/scripts:cached_jinja_templates", | 209 "--cache-dir", |
201 "//third_party/WebKit/Source/bindings/scripts:cached_lex_yacc_tables", | 210 rebase_path(bindings_scripts_output_dir, root_build_dir), |
202 "//third_party/WebKit/Source/core:generated_testing_idls", | 211 "--output-dir", |
203 ] | 212 rebase_path(output_dir, root_build_dir), |
| 213 "--info-dir", |
| 214 rebase_path("$bindings_output_dir", root_build_dir), |
| 215 "--target-component", |
| 216 invoker.target_component, |
| 217 "--read-idl-list-from-file", |
| 218 rebase_path(idl_files_list, root_build_dir), |
| 219 ] |
| 220 } |
| 221 } else { |
| 222 action_foreach(target_name) { |
| 223 script = _script |
| 224 inputs = _inputs |
| 225 public_deps = _public_deps |
| 226 |
| 227 sources = invoker.sources |
| 228 outputs = [ |
| 229 "$output_dir/V8{{source_name_part}}${output_name_suffix}.cpp", |
| 230 "$output_dir/V8{{source_name_part}}${output_name_suffix}.h", |
| 231 ] |
| 232 |
| 233 args = [ |
| 234 "--cache-dir", |
| 235 rebase_path(bindings_scripts_output_dir, root_build_dir), |
| 236 "--output-dir", |
| 237 rebase_path(output_dir, root_build_dir), |
| 238 "--info-dir", |
| 239 rebase_path("$bindings_output_dir", root_build_dir), |
| 240 "--target-component", |
| 241 invoker.target_component, |
| 242 "{{source}}", |
| 243 ] |
| 244 } |
204 } | 245 } |
205 } | 246 } |
206 | 247 |
207 # Runs the idl_compiler to generate IDL dictionary and union impl files. | 248 # Runs the idl_compiler to generate IDL dictionary and union impl files. |
208 # | 249 # |
209 # Parameters: | 250 # Parameters: |
210 # sources = a list of IDL files to process | 251 # sources = a list of IDL files to process |
211 # outputs = a list of files to write to | 252 # outputs = a list of files to write to |
212 # output_dir = the directory to put the output files | 253 # output_dir = the directory to put the output files |
213 # target_component = component to generate code for | 254 # target_component = component to generate code for |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 args += [ rebase_path(output_idl_file, root_build_dir) ] | 409 args += [ rebase_path(output_idl_file, root_build_dir) ] |
369 output_idl_files += [ output_idl_file ] | 410 output_idl_files += [ output_idl_file ] |
370 output_header_files += | 411 output_header_files += |
371 [ "$output_dir/${interface}${component}Constructors.h" ] | 412 [ "$output_dir/${interface}${component}Constructors.h" ] |
372 } | 413 } |
373 | 414 |
374 outputs = output_idl_files + output_header_files | 415 outputs = output_idl_files + output_header_files |
375 deps = invoker.deps | 416 deps = invoker.deps |
376 } | 417 } |
377 } | 418 } |
OLD | NEW |