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/bindings/core/v8/generated.gni") | 5 import("//third_party/WebKit/Source/bindings/core/v8/generated.gni") |
6 import("//third_party/WebKit/Source/bindings/modules/idl.gni") | 6 import("//third_party/WebKit/Source/bindings/modules/idl.gni") |
7 import("//third_party/WebKit/Source/bindings/modules/modules.gni") | 7 import("//third_party/WebKit/Source/bindings/modules/modules.gni") |
8 | 8 |
9 bindings_scripts_dir = get_path_info(".", "abspath") | 9 bindings_scripts_dir = get_path_info(".", "abspath") |
10 bindings_scripts_output_dir = "$root_gen_dir/blink/bindings/scripts" | 10 bindings_scripts_output_dir = "$root_gen_dir/blink/bindings/scripts" |
11 | 11 |
12 # Replacing <(DEPTH) with "/" makes paths like "<(DEPTH)/foo" absolute. | 12 # Replacing <(DEPTH) with "/" makes paths like "<(DEPTH)/foo" absolute. |
13 _gypi = exec_script( | 13 _gypi = exec_script("//build/gypi_to_gn.py", |
14 "//build/gypi_to_gn.py", | 14 [ |
15 [ rebase_path("scripts.gypi"), | 15 rebase_path("scripts.gypi"), |
16 "--replace=<(DEPTH)=/" ], | 16 "--replace=<(DEPTH)=/", |
17 "scope", | 17 ], |
18 [ "scripts.gypi" ]) | 18 "scope", |
| 19 [ "scripts.gypi" ]) |
19 | 20 |
20 jinja_module_files = get_path_info(_gypi.jinja_module_files, "abspath") | 21 jinja_module_files = get_path_info(_gypi.jinja_module_files, "abspath") |
21 idl_lexer_parser_files = get_path_info(_gypi.idl_lexer_parser_files, "abspath") | 22 idl_lexer_parser_files = get_path_info(_gypi.idl_lexer_parser_files, "abspath") |
22 idl_compiler_files = get_path_info(_gypi.idl_compiler_files, "abspath") | 23 idl_compiler_files = get_path_info(_gypi.idl_compiler_files, "abspath") |
23 | 24 |
24 # Calls the compute_interfaces_info_individual script. | 25 # Calls the compute_interfaces_info_individual script. |
25 # | 26 # |
26 # Parameters: | 27 # Parameters: |
27 # sources_static = list of IDL files to pass as inputs | 28 # sources_static = list of IDL files to pass as inputs |
28 # sources_generated = list of generated IDL files to pass as inputs | 29 # sources_generated = list of generated IDL files to pass as inputs |
(...skipping 11 matching lines...) Expand all Loading... |
40 if (defined(invoker.visibility)) { | 41 if (defined(invoker.visibility)) { |
41 visibility = invoker.visibility | 42 visibility = invoker.visibility |
42 } | 43 } |
43 | 44 |
44 # Save static list to temp file to avoid blowing out command-line length | 45 # Save static list to temp file to avoid blowing out command-line length |
45 # limit. | 46 # limit. |
46 file_list = "$target_gen_dir/${target_name}_file_list.txt" | 47 file_list = "$target_gen_dir/${target_name}_file_list.txt" |
47 write_file(file_list, rebase_path(invoker.sources_static, root_build_dir)) | 48 write_file(file_list, rebase_path(invoker.sources_static, root_build_dir)) |
48 | 49 |
49 inputs = [ | 50 inputs = [ |
50 "$bindings_scripts_dir/utilities.py", | 51 "$bindings_scripts_dir/utilities.py", |
51 file_list, | 52 file_list, |
52 ] + invoker.sources_static + invoker.sources_generated | 53 ] + invoker.sources_static + invoker.sources_generated |
53 | 54 |
54 outputs = [ | 55 outputs = [ |
55 invoker.interfaces_info_file, | 56 invoker.interfaces_info_file, |
56 invoker.component_info_file, | 57 invoker.component_info_file, |
57 ] | 58 ] |
58 | 59 |
59 args = [ | 60 args = [ |
60 "--cache-directory", | 61 "--cache-directory", |
61 rebase_path(bindings_scripts_output_dir, root_build_dir), | 62 rebase_path(bindings_scripts_output_dir, root_build_dir), |
62 "--idl-files-list", rebase_path(file_list, root_build_dir), | 63 "--idl-files-list", |
63 "--interfaces-info-file", | 64 rebase_path(file_list, root_build_dir), |
64 rebase_path(invoker.interfaces_info_file, root_build_dir), | 65 "--interfaces-info-file", |
65 "--component-info-file", | 66 rebase_path(invoker.interfaces_info_file, root_build_dir), |
66 rebase_path(invoker.component_info_file, root_build_dir), | 67 "--component-info-file", |
67 "--write-file-only-if-changed=1", | 68 rebase_path(invoker.component_info_file, root_build_dir), |
68 "--", | 69 "--write-file-only-if-changed=1", |
69 ] + rebase_path(invoker.sources_generated, root_build_dir) | 70 "--", |
| 71 ] + rebase_path(invoker.sources_generated, root_build_dir) |
70 | 72 |
71 deps = [ | 73 deps = [ "//third_party/WebKit/Source/bindings/scripts:cached_lex_yacc_table
s" ] + invoker.deps |
72 "//third_party/WebKit/Source/bindings/scripts:cached_lex_yacc_tables", | |
73 ] + invoker.deps | |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 # Calls generate_event_interfaces | 77 # Calls generate_event_interfaces |
78 # | 78 # |
79 # Parameters: | 79 # Parameters: |
80 # sources = A list of IDL files to process. | 80 # sources = A list of IDL files to process. |
81 # output_file = The .in file to write, relative to the blink_gen_dir. | 81 # output_file = The .in file to write, relative to the blink_gen_dir. |
82 # suffix = (Optional) String to be passed to script via --suffix | 82 # suffix = (Optional) String to be passed to script via --suffix |
83 template("generate_event_interfaces") { | 83 template("generate_event_interfaces") { |
84 action(target_name) { | 84 action(target_name) { |
85 # Write the file list to a unique temp file to avoid blowing out the | 85 # Write the file list to a unique temp file to avoid blowing out the |
86 # command line length limit. | 86 # command line length limit. |
87 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" | 87 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" |
88 write_file(idl_files_list, | 88 write_file(idl_files_list, rebase_path(invoker.sources, root_build_dir)) |
89 rebase_path(invoker.sources, root_build_dir)) | |
90 | 89 |
91 inputs = [ | 90 inputs = [ |
92 "//third_party/WebKit/Source/bindings/scripts/utilities.py", | 91 "//third_party/WebKit/Source/bindings/scripts/utilities.py", |
93 idl_files_list, | 92 idl_files_list, |
94 ] + invoker.sources | 93 ] + invoker.sources |
95 | 94 |
96 output_file = "$root_gen_dir/blink/" + invoker.output_file | 95 output_file = "$root_gen_dir/blink/" + invoker.output_file |
97 outputs = [ output_file ] | 96 outputs = [ |
| 97 output_file, |
| 98 ] |
98 | 99 |
99 script = "//third_party/WebKit/Source/bindings/scripts/generate_event_interf
aces.py" | 100 script = "//third_party/WebKit/Source/bindings/scripts/generate_event_interf
aces.py" |
100 args = [ | 101 args = [ |
101 "--event-idl-files-list", | 102 "--event-idl-files-list", |
102 rebase_path(idl_files_list, root_build_dir), | 103 rebase_path(idl_files_list, root_build_dir), |
103 "--event-interfaces-file", | 104 "--event-interfaces-file", |
104 rebase_path(output_file, root_build_dir), | 105 rebase_path(output_file, root_build_dir), |
105 "--write-file-only-if-changed=1", # Always true for Ninja. | 106 "--write-file-only-if-changed=1", # Always true for Ninja. |
106 ] | 107 ] |
107 | 108 |
108 if (defined(invoker.suffix)) { | 109 if (defined(invoker.suffix)) { |
109 args += [ "--suffix", invoker.suffix ] | 110 args += [ |
| 111 "--suffix", |
| 112 invoker.suffix, |
| 113 ] |
110 } | 114 } |
111 } | 115 } |
112 } | 116 } |
113 | 117 |
114 # Runs the idl_compiler script over a list of sources. | 118 # Runs the idl_compiler script over a list of sources. |
115 # | 119 # |
116 # Parameters: | 120 # Parameters: |
117 # sources = list of IDL files to compile | 121 # sources = list of IDL files to compile |
118 # output_dir = string containing the directory to put the output files. | 122 # output_dir = string containing the directory to put the output files. |
119 # output_name_suffix = a suffix after the basename of the output file names. | 123 # output_name_suffix = a suffix after the basename of the output file names. |
120 # target_component = component to generate code for. | 124 # target_component = component to generate code for. |
121 template("idl_compiler") { | 125 template("idl_compiler") { |
122 output_dir = invoker.output_dir | 126 output_dir = invoker.output_dir |
123 output_name_suffix = invoker.output_name_suffix | 127 output_name_suffix = invoker.output_name_suffix |
124 | 128 |
125 action_foreach(target_name) { | 129 action_foreach(target_name) { |
126 # TODO(brettw) GYP adds a "-S before the script name to skip "import site" t
o | 130 # TODO(brettw) GYP adds a "-S before the script name to skip "import site" t
o |
127 # speed up startup. Figure out if we need this and do something similar (not | 131 # speed up startup. Figure out if we need this and do something similar (not |
128 # really expressible in GN now). | 132 # really expressible in GN now). |
129 script = "//third_party/WebKit/Source/bindings/scripts/idl_compiler.py" | 133 script = "//third_party/WebKit/Source/bindings/scripts/idl_compiler.py" |
130 | 134 |
131 inputs = | 135 inputs = idl_lexer_parser_files + idl_compiler_files # to be explicit (cove
red by parsetab) |
132 idl_lexer_parser_files + # to be explicit (covered by parsetab) | |
133 idl_compiler_files | |
134 inputs += [ | 136 inputs += [ |
135 "$bindings_scripts_output_dir/lextab.py", | 137 "$bindings_scripts_output_dir/lextab.py", |
136 "$bindings_scripts_output_dir/parsetab.pickle", | 138 "$bindings_scripts_output_dir/parsetab.pickle", |
137 "$bindings_scripts_output_dir/cached_jinja_templates.stamp", | 139 "$bindings_scripts_output_dir/cached_jinja_templates.stamp", |
138 "$bindings_dir/IDLExtendedAttributes.txt", | 140 "$bindings_dir/IDLExtendedAttributes.txt", |
| 141 |
139 # If the dependency structure or public interface info (e.g., | 142 # If the dependency structure or public interface info (e.g., |
140 # [ImplementedAs]) changes, we rebuild all files, since we're not | 143 # [ImplementedAs]) changes, we rebuild all files, since we're not |
141 # computing dependencies file-by-file in the build. | 144 # computing dependencies file-by-file in the build. |
142 # This data is generally stable. | 145 # This data is generally stable. |
143 "$bindings_modules_output_dir/InterfacesInfoOverall.pickle", | 146 "$bindings_modules_output_dir/InterfacesInfoOverall.pickle", |
144 ] | 147 ] |
| 148 |
145 # Further, if any dependency (partial interface or implemented | 149 # Further, if any dependency (partial interface or implemented |
146 # interface) changes, rebuild everything, since every IDL potentially | 150 # interface) changes, rebuild everything, since every IDL potentially |
147 # depends on them, because we're not computing dependencies | 151 # depends on them, because we're not computing dependencies |
148 # file-by-file. | 152 # file-by-file. |
149 # FIXME: This is too conservative, and causes excess rebuilds: | 153 # FIXME: This is too conservative, and causes excess rebuilds: |
150 # compute this file-by-file. http://crbug.com/341748 | 154 # compute this file-by-file. http://crbug.com/341748 |
151 # This should theoretically just be the IDL files passed in. | 155 # This should theoretically just be the IDL files passed in. |
152 inputs += all_dependency_idl_files | 156 inputs += all_dependency_idl_files |
153 | 157 |
154 sources = invoker.sources | 158 sources = invoker.sources |
(...skipping 10 matching lines...) Expand all Loading... |
165 "--info-dir", | 169 "--info-dir", |
166 rebase_path("$bindings_output_dir", root_build_dir), | 170 rebase_path("$bindings_output_dir", root_build_dir), |
167 "--write-file-only-if-changed=1", # Always true for Ninja. | 171 "--write-file-only-if-changed=1", # Always true for Ninja. |
168 "--target-component", | 172 "--target-component", |
169 invoker.target_component, | 173 invoker.target_component, |
170 "{{source}}", | 174 "{{source}}", |
171 ] | 175 ] |
172 | 176 |
173 public_deps = [ | 177 public_deps = [ |
174 "//third_party/WebKit/Source/bindings/core:core_global_constructors_idls", | 178 "//third_party/WebKit/Source/bindings/core:core_global_constructors_idls", |
| 179 |
175 # FIXME: should be interfaces_info_core (w/o modules) | 180 # FIXME: should be interfaces_info_core (w/o modules) |
176 # http://crbug.com/358074 | 181 # http://crbug.com/358074 |
177 "//third_party/WebKit/Source/bindings/modules:interfaces_info", | 182 "//third_party/WebKit/Source/bindings/modules:interfaces_info", |
178 "//third_party/WebKit/Source/bindings/modules:modules_core_global_construc
tors_idls", | 183 "//third_party/WebKit/Source/bindings/modules:modules_core_global_construc
tors_idls", |
179 "//third_party/WebKit/Source/bindings/modules:modules_global_constructors_
idls", | 184 "//third_party/WebKit/Source/bindings/modules:modules_global_constructors_
idls", |
180 | 185 |
181 "//third_party/WebKit/Source/bindings/scripts:cached_lex_yacc_tables", | 186 "//third_party/WebKit/Source/bindings/scripts:cached_lex_yacc_tables", |
182 "//third_party/WebKit/Source/bindings/scripts:cached_jinja_templates", | 187 "//third_party/WebKit/Source/bindings/scripts:cached_jinja_templates", |
183 "//third_party/WebKit/Source/core:generated_testing_idls", | 188 "//third_party/WebKit/Source/core:generated_testing_idls", |
184 ] | 189 ] |
185 } | 190 } |
186 } | 191 } |
187 | 192 |
188 # Runs the idl_compiler to generate IDL dictionary and union impl files. | 193 # Runs the idl_compiler to generate IDL dictionary and union impl files. |
189 # | 194 # |
190 # Parameters: | 195 # Parameters: |
191 # sources = a list of IDL files to process | 196 # sources = a list of IDL files to process |
192 # outputs = a list of files to write to | 197 # outputs = a list of files to write to |
193 # output_dir = the directory to put the output files | 198 # output_dir = the directory to put the output files |
194 # target_component = component to generate code for | 199 # target_component = component to generate code for |
195 template("idl_impl") { | 200 template("idl_impl") { |
196 dictionary_impl_output_dir = "$root_gen_dir/blink/" | 201 dictionary_impl_output_dir = "$root_gen_dir/blink/" |
197 | 202 |
198 action(target_name) { | 203 action(target_name) { |
199 script = "//third_party/WebKit/Source/bindings/scripts/idl_compiler.py" | 204 script = "//third_party/WebKit/Source/bindings/scripts/idl_compiler.py" |
200 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" | 205 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" |
201 write_file(idl_files_list, rebase_path(invoker.sources, root_build_dir)) | 206 write_file(idl_files_list, rebase_path(invoker.sources, root_build_dir)) |
202 | 207 |
203 inputs = | 208 inputs = idl_lexer_parser_files + idl_compiler_files # to be explicit (cove
red by parsetab) |
204 idl_lexer_parser_files + # to be explicit (covered by parsetab) | |
205 idl_compiler_files | |
206 inputs += [ | 209 inputs += [ |
207 "$bindings_scripts_output_dir/lextab.py", | 210 "$bindings_scripts_output_dir/lextab.py", |
208 "$bindings_scripts_output_dir/parsetab.pickle", | 211 "$bindings_scripts_output_dir/parsetab.pickle", |
209 "$bindings_scripts_output_dir/cached_jinja_templates.stamp", | 212 "$bindings_scripts_output_dir/cached_jinja_templates.stamp", |
210 "$bindings_dir/IDLExtendedAttributes.txt", | 213 "$bindings_dir/IDLExtendedAttributes.txt", |
211 ] | 214 ] |
212 inputs += [ idl_files_list ] + invoker.sources | 215 inputs += [ idl_files_list ] + invoker.sources |
213 outputs = invoker.outputs | 216 outputs = invoker.outputs |
214 | 217 |
215 args = [ | 218 args = [ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 272 |
270 # Calls the compute_global_objects script. | 273 # Calls the compute_global_objects script. |
271 # | 274 # |
272 # Parameters: | 275 # Parameters: |
273 # sources = a list of source IDL files. | 276 # sources = a list of source IDL files. |
274 # sources_generated = a list of generated pickle sources. | 277 # sources_generated = a list of generated pickle sources. |
275 # output_file = a pickle file to write to (need to specify directory) | 278 # output_file = a pickle file to write to (need to specify directory) |
276 # | 279 # |
277 template("compute_global_objects") { | 280 template("compute_global_objects") { |
278 action(target_name) { | 281 action(target_name) { |
279 script = "//third_party/WebKit/Source/bindings/scripts/compute_global_object
s.py" | 282 script = |
| 283 "//third_party/WebKit/Source/bindings/scripts/compute_global_objects.py" |
280 | 284 |
281 # Write the file list to a unique temp file to avoid blowing out the | 285 # Write the file list to a unique temp file to avoid blowing out the |
282 # command line length limit. | 286 # command line length limit. |
283 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" | 287 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" |
284 write_file(idl_files_list, | 288 write_file(idl_files_list, rebase_path(invoker.sources, root_build_dir)) |
285 rebase_path(invoker.sources, root_build_dir)) | |
286 | 289 |
287 inputs = [ | 290 inputs = [ |
288 "//third_party/WebKit/Source/bindings/scripts/utilities.py", | 291 "//third_party/WebKit/Source/bindings/scripts/utilities.py", |
289 idl_files_list, | 292 idl_files_list, |
290 ] + invoker.sources_generated + invoker.sources | 293 ] + invoker.sources_generated + invoker.sources |
291 | 294 |
292 outputs = [ invoker.output_file ] | 295 outputs = [ |
| 296 invoker.output_file, |
| 297 ] |
293 | 298 |
294 args = [ | 299 args = [ |
295 "--idl-files-list", | 300 "--idl-files-list", |
296 rebase_path(idl_files_list, root_build_dir), | 301 rebase_path(idl_files_list, root_build_dir), |
297 "--write-file-only-if-changed=1", # Always true for Ninja. | 302 "--write-file-only-if-changed=1", # Always true for Ninja. |
298 "--", | 303 "--", |
299 ] | 304 ] |
300 args += rebase_path(invoker.sources_generated, root_build_dir) | 305 args += rebase_path(invoker.sources_generated, root_build_dir) |
301 args += [ rebase_path(invoker.output_file, root_build_dir) ] | 306 args += [ rebase_path(invoker.output_file, root_build_dir) ] |
302 | 307 |
(...skipping 11 matching lines...) Expand all Loading... |
314 # output_dir = output directory to generate idl files and header files. | 319 # output_dir = output directory to generate idl files and header files. |
315 # deps = dependencies | 320 # deps = dependencies |
316 # | 321 # |
317 template("generate_global_constructors") { | 322 template("generate_global_constructors") { |
318 action(target_name) { | 323 action(target_name) { |
319 script = "//third_party/WebKit/Source/bindings/scripts/generate_global_const
ructors.py" | 324 script = "//third_party/WebKit/Source/bindings/scripts/generate_global_const
ructors.py" |
320 | 325 |
321 # Write the file list to a unique temp file to avoid blowing out the | 326 # Write the file list to a unique temp file to avoid blowing out the |
322 # command line length limit. | 327 # command line length limit. |
323 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" | 328 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" |
324 write_file(idl_files_list, | 329 write_file(idl_files_list, rebase_path(invoker.sources, root_build_dir)) |
325 rebase_path(invoker.sources, root_build_dir)) | |
326 | 330 |
327 inputs = [ | 331 inputs = [ |
328 "//third_party/WebKit/Source/bindings/scripts/utilities.py", | 332 "//third_party/WebKit/Source/bindings/scripts/utilities.py", |
329 idl_files_list, | 333 idl_files_list, |
330 invoker.global_objects_file, | 334 invoker.global_objects_file, |
331 ] + invoker.sources | 335 ] + invoker.sources |
332 | 336 |
333 args = [ | 337 args = [ |
334 "--idl-files-list", | 338 "--idl-files-list", |
335 rebase_path(idl_files_list, root_build_dir), | 339 rebase_path(idl_files_list, root_build_dir), |
336 "--global-objects-file", | 340 "--global-objects-file", |
337 rebase_path(invoker.global_objects_file, root_build_dir), | 341 rebase_path(invoker.global_objects_file, root_build_dir), |
338 "--write-file-only-if-changed=1", # Always true for Ninja. | 342 "--write-file-only-if-changed=1", # Always true for Ninja. |
339 "--", | 343 "--", |
340 ] | 344 ] |
341 | 345 |
342 output_dir = invoker.output_dir | 346 output_dir = invoker.output_dir |
343 component = invoker.component | 347 component = invoker.component |
344 | 348 |
345 # generate outputs from invoker.interfaces. | 349 # generate outputs from invoker.interfaces. |
346 output_idl_files = [] | 350 output_idl_files = [] |
347 output_header_files = [] | 351 output_header_files = [] |
348 foreach(interface, invoker.interfaces) { | 352 foreach(interface, invoker.interfaces) { |
349 args += [ interface ] | 353 args += [ interface ] |
350 output_idl_file = "$output_dir/${interface}${component}Constructors.idl" | 354 output_idl_file = "$output_dir/${interface}${component}Constructors.idl" |
351 args += [ rebase_path(output_idl_file, root_build_dir) ] | 355 args += [ rebase_path(output_idl_file, root_build_dir) ] |
352 output_idl_files += [ output_idl_file ] | 356 output_idl_files += [ output_idl_file ] |
353 output_header_files += [ | 357 output_header_files += |
354 "$output_dir/${interface}${component}Constructors.h" | 358 [ "$output_dir/${interface}${component}Constructors.h" ] |
355 ] | |
356 } | 359 } |
357 | 360 |
358 outputs = output_idl_files + output_header_files | 361 outputs = output_idl_files + output_header_files |
359 deps = invoker.deps | 362 deps = invoker.deps |
360 } | 363 } |
361 } | 364 } |
362 | |
OLD | NEW |