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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 bundle_executable_dir = bundle_root_dir | 160 bundle_executable_dir = bundle_root_dir |
161 bundle_plugins_dir = "$bundle_root_dir/Plugins" | 161 bundle_plugins_dir = "$bundle_root_dir/Plugins" |
162 } | 162 } |
163 | 163 |
164 # TODO(crbug.com/297668): | 164 # TODO(crbug.com/297668): |
165 # - add support for codesigning, | 165 # - add support for codesigning, |
166 # - find a way to make "ninja -C out/Default base_unittests.app" work as | 166 # - find a way to make "ninja -C out/Default base_unittests.app" work as |
167 # an alias to "ninja -C out/Default base_unittests" (for convenience | 167 # an alias to "ninja -C out/Default base_unittests" (for convenience |
168 # and compatibility with gyp), | 168 # and compatibility with gyp), |
169 } | 169 } |
| 170 |
| 171 # Compile a xib or storyboard file and add it to a bundle_data so that it is |
| 172 # available at runtime in the bundle. |
| 173 # |
| 174 # Arguments |
| 175 # |
| 176 # source: |
| 177 # string, path of the xib or storyboard to compile. |
| 178 # |
| 179 # Forwards all variables to the bundle_data target. |
| 180 template("bundle_data_xib") { |
| 181 assert(defined(invoker.source), "source needs to be defined for $target_name") |
| 182 |
| 183 _source_extension = get_path_info(invoker.source, "extension") |
| 184 assert(_source_extension == "xib" || _source_extension == "storyboard", |
| 185 "source must be a .xib or .storyboard for $target_name") |
| 186 |
| 187 _target_name = target_name |
| 188 _compile_xib = target_name + "_compile_xib" |
| 189 |
| 190 _nib_basename = get_path_info(invoker.source, "name") |
| 191 _nib_filename = "$_nib_basename.nib" |
| 192 |
| 193 action(_compile_xib) { |
| 194 visibility = [ ":$_target_name" ] |
| 195 script = "//build/config/ios/ios_compile_xib.py" |
| 196 sources = [ |
| 197 invoker.source, |
| 198 ] |
| 199 outputs = [ |
| 200 "$target_gen_dir/$_nib_filename/objects.nib", |
| 201 "$target_gen_dir/$_nib_filename/runtime.nib", |
| 202 ] |
| 203 args = [ |
| 204 "--minimum-deployment-target", |
| 205 ios_deployment_target, |
| 206 "--output", |
| 207 rebase_path("$target_gen_dir/$_nib_filename"), |
| 208 "--input", |
| 209 rebase_path(invoker.source, root_build_dir), |
| 210 ] |
| 211 } |
| 212 |
| 213 bundle_data(_target_name) { |
| 214 forward_variables_from(invoker, "*", [ "source" ]) |
| 215 |
| 216 if (!defined(public_deps)) { |
| 217 public_deps = [] |
| 218 } |
| 219 public_deps += [ ":$_compile_xib" ] |
| 220 |
| 221 sources = [ |
| 222 "$target_gen_dir/$_nib_filename/objects.nib", |
| 223 "$target_gen_dir/$_nib_filename/runtime.nib", |
| 224 ] |
| 225 outputs = [ |
| 226 "{{bundle_resources_dir}}/$_nib_filename/{{source_file_part}}", |
| 227 ] |
| 228 } |
| 229 } |
OLD | NEW |