OLD | NEW |
---|---|
(Empty) | |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 import("//third_party/WebKit/Source/bindings/core/v8/generated.gni") | |
6 import("//third_party/WebKit/Source/bindings/modules/idl.gni") | |
7 import("//third_party/WebKit/Source/bindings/modules/modules.gni") | |
8 | |
9 bindings_scripts_dir = get_path_info(".", "abspath") | |
10 bindings_scripts_output_dir = "$root_gen_dir/blink/bindings/scripts" | |
11 | |
12 # Replacing <(DEPTH) with "/" makes paths like "<(DEPTH)/foo" absolute. | |
13 _gypi = exec_script( | |
14 "//build/gypi_to_gn.py", | |
15 [ rebase_path("scripts.gypi"), | |
16 "--replace=<(DEPTH)=/" ], | |
17 "scope", | |
18 [ "scripts.gypi" ]) | |
19 | |
20 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_compiler_files = get_path_info(_gypi.idl_compiler_files, "abspath") | |
23 | |
24 # Calls the compute_interfaces_info_individual script. | |
25 # | |
26 # Parameters: | |
27 # sources_static = list of IDL files to pass as inputs | |
28 # sources_generated = list of generated IDL files to pass as inputs | |
29 # component_dir = name if subdirectory (one word, no slashes) of component. | |
30 # output_file = pickle file to write | |
31 # | |
32 # Note the static/generated split is for consistency with GYP. This split is | |
33 # not necessary in the GN build and could be combined into a single "sources". | |
Nils Barth (inactive)
2014/06/10 08:44:17
Could you add a FIXME for this?
| |
34 template("compute_interfaces_info_individual") { | |
35 action(target_name) { | |
36 script = "$bindings_scripts_dir/compute_interfaces_info_individual.py" | |
37 | |
38 # Save static list to temp file to avoid blowing out command-line length | |
39 # limit. | |
40 file_list = "$target_gen_dir/${target_name}_file_list.txt" | |
41 write_file(file_list, rebase_path(invoker.sources_static, root_build_dir)) | |
42 | |
43 source_prereqs = [ | |
44 "$bindings_scripts_dir/utilities.py", | |
45 file_list, | |
46 ] + invoker.sources_static + invoker.sources_generated | |
47 | |
48 outputs = [ | |
49 invoker.output_file | |
50 ] | |
51 | |
52 args = [ | |
53 "--component-dir", invoker.component_dir, | |
54 "--idl-files-list", rebase_path(file_list, root_build_dir), | |
55 "--interfaces-info-file", | |
56 rebase_path(invoker.output_file, root_build_dir), | |
57 "--write-file-only-if-changed=1", | |
58 "--", | |
59 ] + rebase_path(invoker.sources_generated, root_build_dir) | |
60 | |
61 deps = [ | |
62 # FIXME: should be {modules|core}_generated_idls | |
63 # http://crbug.com/358074 | |
64 "//third_party/WebKit/Source/bindings:generated_idls", | |
65 ] | |
66 } | |
67 } | |
68 | |
69 # Calls generate_event_interfaces | |
70 # | |
71 # Parameters: | |
72 # sources = A list of IDL files to process. | |
73 # output_file = The .in file to write, relative to the blink_gen_dir. | |
74 # suffix = (Optional) String to be passed to script via --suffix | |
75 template("generate_event_interfaces") { | |
76 action(target_name) { | |
77 # Write the file list to a unique temp file to avoid blowing out the | |
78 # command line length limit. | |
79 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" | |
80 write_file(idl_files_list, | |
81 rebase_path(invoker.sources, root_build_dir)) | |
82 | |
83 source_prereqs = [ | |
84 "//third_party/WebKit/Source/bindings/scripts/utilities.py", | |
85 idl_files_list, | |
86 ] + invoker.sources | |
87 | |
88 output_file = "$root_gen_dir/blink/" + invoker.output_file | |
89 outputs = [ output_file ] | |
90 | |
91 script = "//third_party/WebKit/Source/bindings/scripts/generate_event_interf aces.py" | |
92 args = [ | |
93 "--event-idl-files-list", | |
94 rebase_path(idl_files_list, root_build_dir), | |
95 "--event-interfaces-file", | |
96 rebase_path(output_file, root_build_dir), | |
97 "--write-file-only-if-changed=1", # Always true for Ninja. | |
98 ] | |
99 | |
100 if (defined(invoker.suffix)) { | |
101 args += [ "--suffix", invoker.suffix ] | |
102 } | |
103 } | |
104 } | |
105 | |
106 # Runs the idl_compiler script over a list of sources. | |
107 # | |
108 # Parameters: | |
109 # sources = list of IDL files to compile | |
110 # output_dir = string containing the directory to put the output files. | |
111 template("idl_compiler") { | |
112 output_dir = invoker.output_dir | |
113 | |
114 action_foreach(target_name) { | |
115 # TODO(brettw) GYP adds a "-S before the script name to skip "import site" t o | |
116 # speed up startup. Figure out if we need this and do something similar (not | |
117 # really expressible in GN now). | |
118 script = "//third_party/WebKit/Source/bindings/scripts/idl_compiler.py" | |
119 | |
120 source_prereqs = | |
121 idl_lexer_parser_files + # to be explicit (covered by parsetab) | |
122 idl_compiler_files | |
123 source_prereqs += [ | |
124 "$bindings_scripts_output_dir/lextab.py", | |
125 "$bindings_scripts_output_dir/parsetab.pickle", | |
126 "$bindings_scripts_output_dir/cached_jinja_templates.stamp", | |
127 "$bindings_dir/IDLExtendedAttributes.txt", | |
128 # If the dependency structure or public interface info (e.g., | |
129 # [ImplementedAs]) changes, we rebuild all files, since we're not | |
130 # computing dependencies file-by-file in the build. | |
131 # This data is generally stable. | |
132 "$bindings_modules_output_dir/InterfacesInfoModules.pickle", | |
133 ] | |
134 # Further, if any dependency (partial interface or implemented | |
135 # interface) changes, rebuild everything, since every IDL potentially | |
136 # depends on them, because we're not computing dependencies | |
137 # file-by-file. | |
138 # FIXME: This is too conservative, and causes excess rebuilds: | |
139 # compute this file-by-file. http://crbug.com/341748 | |
140 # This should theoretically just be the IDL files passed in. | |
141 source_prereqs += all_dependency_idl_files | |
142 | |
143 sources = invoker.sources | |
144 outputs = [ | |
145 "$output_dir/V8{{source_name_part}}.cpp", | |
146 "$output_dir/V8{{source_name_part}}.h", | |
147 ] | |
148 | |
149 args = [ | |
150 "--cache-dir", | |
151 rebase_path(bindings_scripts_output_dir, root_build_dir), | |
152 "--output-dir", | |
153 rebase_path(output_dir, root_build_dir), | |
154 "--interfaces-info", | |
155 rebase_path("$bindings_modules_output_dir/InterfacesInfoModules.pickle", | |
156 root_build_dir), | |
157 "--write-file-only-if-changed=1", # Always true for Ninja. | |
158 "{{source}}", | |
159 ] | |
160 | |
161 deps = [ | |
162 # FIXME: should be interfaces_info_core (w/o modules) | |
163 # http://crbug.com/358074 | |
164 "//third_party/WebKit/Source/bindings/modules:interfaces_info", | |
165 | |
166 "//third_party/WebKit/Source/bindings/scripts:cached_lex_yacc_tables", | |
167 "//third_party/WebKit/Source/bindings/scripts:cached_jinja_templates", | |
168 "//third_party/WebKit/Source/core:generated_testing_idls", | |
169 ] | |
170 } | |
171 } | |
172 | |
173 # Calls the aggregate_generated_bindings script. | |
174 # | |
175 # Parameters: | |
176 # sources = a list of source IDL files. | |
177 # component_dir = Name of directory for these files (one word, no slashes). | |
178 # outputs = a list of files to write to. | |
179 template("aggregate_generated_bindings") { | |
180 action(target_name) { | |
181 script = "//third_party/WebKit/Source/bindings/scripts/aggregate_generated_b indings.py" | |
182 | |
183 # Write lists of main IDL files to a file, so that the command lines don't | |
184 # exceed OS length limits. | |
185 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" | |
186 write_file(idl_files_list, rebase_path(invoker.sources, root_build_dir)) | |
187 | |
188 source_prereqs = [ idl_files_list ] + invoker.sources | |
189 outputs = invoker.outputs | |
190 | |
191 args = [ | |
192 invoker.component_dir, | |
193 rebase_path(idl_files_list, root_build_dir), | |
194 "--", | |
195 ] | |
196 args += rebase_path(invoker.outputs, root_build_dir) | |
197 } | |
198 } | |
199 | |
Nils Barth (inactive)
2014/06/10 08:44:17
nit
| |
OLD | NEW |