OLD | NEW |
---|---|
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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("//build/config/ios/ios_sdk.gni") | 5 import("//build/config/ios/ios_sdk.gni") |
6 | 6 |
7 # TODO(crbug.com/297668): refactor this template to extract common behaviour | 7 # TODO(crbug.com/297668): refactor this template to extract common behaviour |
8 # between OS X and iOS bundle generation, then create a generic "app" template | 8 # between OS X and iOS bundle generation, then create a generic "app" template |
9 # that forward to "executable" on all platform except iOS/OS X. | 9 # that forward to "executable" on all platform except iOS/OS X. |
10 | 10 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 bundle_executable_dir = bundle_root_dir | 179 bundle_executable_dir = bundle_root_dir |
180 bundle_plugins_dir = "$bundle_root_dir/Plugins" | 180 bundle_plugins_dir = "$bundle_root_dir/Plugins" |
181 } | 181 } |
182 | 182 |
183 # TODO(crbug.com/297668): | 183 # TODO(crbug.com/297668): |
184 # - add support for codesigning, | 184 # - add support for codesigning, |
185 # - find a way to make "ninja -C out/Default base_unittests.app" work as | 185 # - find a way to make "ninja -C out/Default base_unittests.app" work as |
186 # an alias to "ninja -C out/Default base_unittests" (for convenience | 186 # an alias to "ninja -C out/Default base_unittests" (for convenience |
187 # and compatibility with gyp), | 187 # and compatibility with gyp), |
188 } | 188 } |
189 | |
190 # Compile a xib or storyboard file and add it to a bundle_data so that it is | |
191 # available at runtime in the bundle. | |
192 # | |
193 # Arguments | |
194 # | |
195 # source: | |
196 # string, path of the xib or storyboard to compile. | |
197 # | |
198 # Forwards all variables to the bundle_data target. | |
199 template("bundle_data_xib") { | |
200 assert(defined(invoker.source), "source needs to be defined for $target_name") | |
201 | |
202 _source_extension = get_path_info(invoker.source, "extension") | |
203 assert(_source_extension == "xib" || _source_extension == "storyboard", | |
204 "source must be a .xib or .storyboard for $target_name") | |
205 | |
206 _target_name = target_name | |
Dirk Pranke
2016/03/16 22:00:17
why bother with _target_name here?
sdefresne
2016/03/17 17:53:14
I want the following:
${target_name} -> ${targe
Dirk Pranke
2016/03/18 02:19:59
Ah, right. I forgot about this. Sorry!
| |
207 _compile_xib = target_name + "_compile_xib" | |
208 | |
209 _nib_basename = get_path_info(invoker.source, "name") | |
210 _nib_filename = "$_nib_basename.nib" | |
211 | |
212 action(_compile_xib) { | |
213 visibility = [ ":$_target_name" ] | |
214 script = "//build/config/ios/ios_compile_xib.py" | |
215 sources = [ | |
216 invoker.source, | |
217 ] | |
218 outputs = [ | |
219 "$target_gen_dir/$_nib_filename/objects.nib", | |
220 "$target_gen_dir/$_nib_filename/runtime.nib", | |
221 ] | |
222 args = [ | |
223 "--minimum-deployment-target", | |
224 ios_deployment_target, | |
225 "--output", | |
226 rebase_path("$target_gen_dir/$_nib_filename"), | |
227 "--input", | |
228 rebase_path(invoker.source, root_build_dir), | |
229 ] | |
230 } | |
231 | |
232 bundle_data(_target_name) { | |
233 forward_variables_from(invoker, "*", [ "source" ]) | |
234 | |
235 if (!defined(public_deps)) { | |
236 public_deps = [] | |
237 } | |
238 public_deps += [ ":$_compile_xib" ] | |
239 | |
240 sources = [ | |
241 "$target_gen_dir/$_nib_filename/objects.nib", | |
242 "$target_gen_dir/$_nib_filename/runtime.nib", | |
243 ] | |
244 outputs = [ | |
245 "{{bundle_resources_dir}}/$_nib_filename/{{source_file_part}}", | |
246 ] | |
247 } | |
248 } | |
OLD | NEW |