Chromium Code Reviews| 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/toolchain/toolchain.gni") | 5 import("//build/toolchain/toolchain.gni") |
| 6 | 6 |
| 7 # This is used as the base template for both iOS and Mac frameworks.. | 7 # This is used as the base template for both iOS and Mac frameworks.. |
| 8 # | 8 # |
| 9 # Arguments | 9 # Arguments |
| 10 # | 10 # |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 | 165 |
| 166 framework_bundle(target_name) { | 166 framework_bundle(target_name) { |
| 167 forward_variables_from(invoker, "*", [ "info_plist" ]) | 167 forward_variables_from(invoker, "*", [ "info_plist" ]) |
| 168 | 168 |
| 169 if (!defined(deps)) { | 169 if (!defined(deps)) { |
| 170 deps = [] | 170 deps = [] |
| 171 } | 171 } |
| 172 deps += [ ":$_info_plist_bundle_data" ] | 172 deps += [ ":$_info_plist_bundle_data" ] |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | |
| 176 # Template to create a Mac executable application bundle. | |
| 177 # | |
| 178 # Arguments | |
| 179 # | |
| 180 # info_plist: | |
| 181 # string, path to the Info.plist file that will be used for the bundle. | |
| 182 # | |
| 183 # output_name: | |
| 184 # (optional) string, name of the generated framework without the | |
| 185 # .framework suffix. If omitted, defaults to target_name. | |
|
Dirk Pranke
2016/04/15 18:19:24
This should be .app, not .framework, right?
Robert Sesek
2016/04/15 19:08:42
Done.
| |
| 186 template("mac_app_bundle") { | |
| 187 assert(defined(invoker.info_plist), | |
| 188 "The Info.plist file must be specified for $target_name") | |
| 189 | |
| 190 _target_name = target_name | |
| 191 _output_name = target_name | |
| 192 if (defined(invoker.output_name)) { | |
| 193 _output_name = invoker.output_name | |
| 194 } | |
| 195 | |
| 196 _executable_target = target_name + "_executable" | |
| 197 _executable_bundle_data = _executable_target + "_bundle_data" | |
| 198 | |
| 199 executable(_executable_target) { | |
| 200 visibility = [ ":$_executable_bundle_data" ] | |
| 201 forward_variables_from(invoker, | |
| 202 "*", | |
| 203 [ | |
| 204 "assert_no_deps", | |
| 205 "data_deps", | |
| 206 "info_plist", | |
| 207 "output_name", | |
| 208 "visibility", | |
| 209 ]) | |
| 210 output_name = _output_name | |
| 211 output_dir = "$target_out_dir/$_executable_target" | |
| 212 } | |
| 213 | |
| 214 bundle_data(_executable_bundle_data) { | |
| 215 visibility = [ ":$_target_name" ] | |
| 216 forward_variables_from(invoker, [ "testonly" ]) | |
| 217 sources = [ | |
| 218 "$target_out_dir/$_executable_target/$_output_name", | |
| 219 ] | |
| 220 outputs = [ | |
| 221 "{{bundle_executable_dir}}/$_output_name", | |
| 222 ] | |
| 223 public_deps = [ | |
| 224 ":$_executable_target", | |
| 225 ] | |
| 226 } | |
| 227 | |
| 228 _info_plist_target = target_name + "_info_plist" | |
| 229 | |
| 230 # TODO(rsesek): Process Info.plist variables. | |
| 231 | |
| 232 _info_plist_bundle_data = _info_plist_target + "_bundle_data" | |
| 233 | |
| 234 bundle_data(_info_plist_bundle_data) { | |
| 235 forward_variables_from(invoker, [ "testonly" ]) | |
| 236 visibility = [ ":$_target_name" ] | |
| 237 sources = [ | |
| 238 invoker.info_plist, | |
| 239 ] | |
| 240 outputs = [ | |
| 241 "{{bundle_root_dir}}/Info.plist", | |
| 242 ] | |
| 243 } | |
| 244 | |
| 245 create_bundle(_target_name) { | |
| 246 forward_variables_from(invoker, | |
| 247 [ | |
| 248 "data_deps", | |
| 249 "deps", | |
| 250 "public_deps", | |
| 251 "testonly", | |
| 252 ]) | |
| 253 if (!defined(deps)) { | |
| 254 deps = [] | |
| 255 } | |
| 256 deps += [ | |
| 257 ":$_executable_bundle_data", | |
| 258 ":$_info_plist_bundle_data", | |
| 259 ] | |
| 260 | |
| 261 bundle_root_dir = "$root_out_dir/${_output_name}.app/Contents" | |
| 262 bundle_resources_dir = "$bundle_root_dir/Resources" | |
| 263 bundle_executable_dir = "$bundle_root_dir/MacOS" | |
| 264 } | |
| 265 } | |
| OLD | NEW |