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/config.gni") | 5 import("//third_party/WebKit/Source/config.gni") |
6 | 6 |
7 # All paths in this file should be absolute so targets in any directory can use | 7 # All paths in this file should be absolute so targets in any directory can use |
8 # them without worrying about the current directory. | 8 # them without worrying about the current directory. |
9 _scripts_dir = "//third_party/WebKit/Source/build/scripts" | 9 _scripts_dir = "//third_party/WebKit/Source/build/scripts" |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 # We specify a preprocess so it happens locally and won't get | 69 # We specify a preprocess so it happens locally and won't get |
70 # distributed to goma. | 70 # distributed to goma. |
71 # FIXME: /usr/bin/gcc won't exist on OSX forever. We want to | 71 # FIXME: /usr/bin/gcc won't exist on OSX forever. We want to |
72 # use /usr/bin/clang once we require Xcode 4.x. | 72 # use /usr/bin/clang once we require Xcode 4.x. |
73 preprocessor = "--preprocessor \"/usr/bin/gcc -E -P -x c++\"" | 73 preprocessor = "--preprocessor \"/usr/bin/gcc -E -P -x c++\"" |
74 } | 74 } |
75 | 75 |
76 # Templates -------------------------------------------------------------------- | 76 # Templates -------------------------------------------------------------------- |
77 | 77 |
78 _blink_gen_dir = "$root_gen_dir/blink" | 78 _blink_gen_dir = "$root_gen_dir/blink" |
79 _rel_blink_gen_dir = rebase_path(_blink_gen_dir, root_build_dir) | |
80 | 79 |
81 # The GYP target make_core_generated has some deps and a bunch of actions on | 80 # The GYP target make_core_generated has some deps and a bunch of actions on |
82 # it, which means that the deps will be resolved before the actions run. Here | 81 # it, which means that the deps will be resolved before the actions run. Here |
83 # we have separate targets for each action. Its not clear which actions depend | 82 # we have separate targets for each action. Its not clear which actions depend |
84 # on these deps, so for GYP compatibility, all of the below actions should | 83 # on these deps, so for GYP compatibility, all of the below actions should |
85 # depend on the following deps. | 84 # depend on the following deps. |
86 make_core_generated_deps = [ | 85 make_core_generated_deps = [ |
87 "//third_party/WebKit/Source/core:generated_testing_idls", | 86 "//third_party/WebKit/Source/core:generated_testing_idls", |
88 "//third_party/WebKit/Source/bindings:core_bindings_generated", | 87 "//third_party/WebKit/Source/core:core_event_interfaces", |
89 ] | 88 ] |
90 | 89 |
91 # Template to run most of scripts that process "*.in" files. | 90 # Template to run most of scripts that process "*.in" files. |
92 # script: script to run. | 91 # script: script to run. |
93 # in_files: ".in" files to pass to the script | 92 # in_files: ".in" files to pass to the script |
94 # other_inputs: (optional) other input files the script depends on | 93 # other_inputs: (optional) other input files the script depends on |
95 # defaults to "scripts_for_in_files" (if specified, we assume | 94 # defaults to "scripts_for_in_files" (if specified, we assume |
96 # that the contents of "scripts_for_in_files" are included in | 95 # that the contents of "scripts_for_in_files" are included in |
97 # this list specified since this is how these lists are filled | 96 # this list specified since this is how these lists are filled |
98 # from the GYP build. | 97 # from the GYP build. |
99 # outputs: expected results relative to the blink_gen_dir | 98 # outputs: expected results. Note that the directory of the 0th item in this |
| 99 # list will be taken to be the output path. |
100 # other_args: (optional) other arguements to pass to the script. | 100 # other_args: (optional) other arguements to pass to the script. |
101 template("process_in_files") { | 101 template("process_in_files") { |
102 action(target_name) { | 102 action(target_name) { |
103 script = invoker.script | 103 script = invoker.script |
104 | 104 |
105 source_prereqs = invoker.in_files | 105 source_prereqs = invoker.in_files |
106 if (defined(invoker.other_inputs)) { | 106 if (defined(invoker.other_inputs)) { |
107 source_prereqs += invoker.other_inputs | 107 source_prereqs += invoker.other_inputs |
108 } else { | 108 } else { |
109 source_prereqs += scripts_for_in_files | 109 source_prereqs += scripts_for_in_files |
110 } | 110 } |
111 outputs = rebase_path(invoker.outputs, ".", _blink_gen_dir) | 111 outputs = invoker.outputs |
| 112 |
| 113 # Extract the directory to write files to. |
| 114 output_dir = get_path_info(outputs[0], "dir") |
112 | 115 |
113 args = rebase_path(invoker.in_files, root_build_dir) + [ | 116 args = rebase_path(invoker.in_files, root_build_dir) + [ |
114 "--output_dir", _rel_blink_gen_dir, | 117 "--output_dir", rebase_path(output_dir, root_build_dir), |
115 ] | 118 ] |
116 if (defined(invoker.other_args)) { | 119 if (defined(invoker.other_args)) { |
117 args += invoker.other_args | 120 args += invoker.other_args |
118 } | 121 } |
119 | 122 |
120 deps = make_core_generated_deps | 123 deps = make_core_generated_deps |
121 } | 124 } |
122 } | 125 } |
123 | 126 |
124 # Template to run the make_names script. This is a special case of | 127 # Template to run the make_names script. This is a special case of |
125 # process_in_files. | 128 # process_in_files. |
126 # in_files: files to pass to the script | 129 # in_files: files to pass to the script |
127 # outputs: expected results relative to the blink_gen_dir | 130 # outputs: expected results |
128 template("make_names") { | 131 template("make_names") { |
129 process_in_files(target_name) { | 132 process_in_files(target_name) { |
130 script = "//third_party/WebKit/Source/build/scripts/make_names.py" | 133 script = "//third_party/WebKit/Source/build/scripts/make_names.py" |
131 in_files = invoker.in_files | 134 in_files = invoker.in_files |
132 other_inputs = make_names_files | 135 other_inputs = make_names_files |
133 outputs = invoker.outputs | 136 outputs = invoker.outputs |
134 other_args = [ "--defines", feature_defines_string ] | 137 other_args = [ "--defines", feature_defines_string ] |
135 } | 138 } |
136 } | 139 } |
137 | 140 |
138 # Template to run the make_qualified_names script. This is a special case of | 141 # Template to run the make_qualified_names script. This is a special case of |
139 # process_in_files. | 142 # process_in_files. |
140 # in_files: list of ".in" files to process. | 143 # in_files: list of ".in" files to process. |
141 # outputs: list of output files relative to blink_gen_dir. | 144 # outputs: list of output files |
142 template("make_qualified_names") { | 145 template("make_qualified_names") { |
143 process_in_files(target_name) { | 146 process_in_files(target_name) { |
144 script = "//third_party/WebKit/Source/build/scripts/make_qualified_names.py" | 147 script = "//third_party/WebKit/Source/build/scripts/make_qualified_names.py" |
145 in_files = invoker.in_files | 148 in_files = invoker.in_files |
146 other_inputs = make_qualified_names_files | 149 other_inputs = make_qualified_names_files |
147 outputs = invoker.outputs | 150 outputs = invoker.outputs |
148 other_args = [ "--defines", feature_defines_string ] | 151 other_args = [ "--defines", feature_defines_string ] |
149 } | 152 } |
150 } | 153 } |
151 | 154 |
152 # Calls the make_event_factory script. This is a special case of | 155 # Calls the make_event_factory script. This is a special case of |
153 # process_in_files. | 156 # process_in_files. |
154 # in_files: list of ".in" files to process. | 157 # in_files: list of ".in" files to process. |
155 # outputs: list of output files relative to blink_gen_dir. | 158 # outputs: list of output files |
156 template("make_event_factory") { | 159 template("make_event_factory") { |
157 process_in_files(target_name) { | 160 process_in_files(target_name) { |
158 script = "//third_party/WebKit/Source/build/scripts/make_event_factory.py" | 161 script = "//third_party/WebKit/Source/build/scripts/make_event_factory.py" |
159 in_files = invoker.in_files | 162 in_files = invoker.in_files |
160 other_inputs = make_event_factory_files | 163 other_inputs = make_event_factory_files |
161 outputs = invoker.outputs | 164 outputs = invoker.outputs |
162 } | 165 } |
163 } | 166 } |
164 | 167 |
165 # Calls the make_token_matcher script. | 168 # Calls the make_token_matcher script. |
166 # input_file: The "*-in.cpp" file | 169 # input_file: The "*-in.cpp" file |
167 # output_file: The output file (relative to the build_gen_dir) | 170 # output_file: The output file |
168 template("make_token_matcher") { | 171 template("make_token_matcher") { |
169 action(target_name) { | 172 action(target_name) { |
170 script = "//third_party/WebKit/Source/build/scripts/make_token_matcher.py" | 173 script = "//third_party/WebKit/Source/build/scripts/make_token_matcher.py" |
171 | 174 |
172 source_prereqs = scripts_for_in_files + [ invoker.input_file ] | 175 source_prereqs = scripts_for_in_files + [ invoker.input_file ] |
173 outputs = [ | 176 outputs = [ invoker.output_file ] |
174 rebase_path(invoker.output_file, ".", _blink_gen_dir) | |
175 ] | |
176 | 177 |
177 args = [ | 178 args = [ |
178 rebase_path(invoker.input_file, root_build_dir), | 179 rebase_path(invoker.input_file, root_build_dir), |
179 rebase_path(invoker.output_file, root_build_dir, _blink_gen_dir), | 180 rebase_path(invoker.output_file, root_build_dir), |
180 ] | 181 ] |
181 | 182 |
182 deps = make_core_generated_deps | 183 deps = make_core_generated_deps |
183 } | 184 } |
184 } | 185 } |
185 | 186 |
186 # Calls generate_event_interfaces | |
187 # sources: A list of IDL files to process. | |
188 # output_file: The .in file to write, relative to the blink_gen_dir. | |
189 # suffix: (Optional) String to be passed to script via --suffix | |
190 template("generate_event_interfaces") { | |
191 action(target_name) { | |
192 # Write the file list to a unique temp file to avoid blowing out the | |
193 # command line length limit. | |
194 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" | |
195 write_file(idl_files_list, | |
196 rebase_path(invoker.sources, root_build_dir)) | |
197 | |
198 source_prereqs = [ | |
199 "//third_party/WebKit/Source/bindings/scripts/utilities.py", | |
200 idl_files_list, | |
201 ] + invoker.sources | |
202 | |
203 output_file = "$_blink_gen_dir/" + invoker.output_file | |
204 outputs = [ output_file ] | |
205 | |
206 script = "//third_party/WebKit/Source/bindings/scripts/generate_event_interf
aces.py" | |
207 args = [ | |
208 "--event-idl-files-list", | |
209 rebase_path(idl_files_list, root_build_dir), | |
210 "--event-interfaces-file", | |
211 rebase_path(output_file, root_build_dir), | |
212 "--write-file-only-if-changed=1", # Always true for Ninja. | |
213 ] | |
214 | |
215 if (defined(invoker.suffix)) { | |
216 args += [ "--suffix", invoker.suffix ] | |
217 } | |
218 } | |
219 } | |
OLD | NEW |