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") | |
| 6 | |
| 5 mac_app_script = "//build/config/mac/mac_app.py" | 7 mac_app_script = "//build/config/mac/mac_app.py" |
| 6 | 8 |
| 7 template("code_sign_mac") { | 9 template("code_sign_mac") { |
| 8 assert(defined(invoker.entitlements_path), | 10 assert(defined(invoker.entitlements_path), |
| 9 "The path to the entitlements .xcent file") | 11 "The path to the entitlements .xcent file") |
| 10 assert(defined(invoker.identity), "The code signing identity") | 12 assert(defined(invoker.identity), "The code signing identity") |
| 11 assert(defined(invoker.application_path), "The application to code sign") | 13 assert(defined(invoker.application_path), "The application to code sign") |
| 12 assert(defined(invoker.deps)) | 14 assert(defined(invoker.deps)) |
| 13 | 15 |
| 14 action(target_name) { | 16 action(target_name) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 } | 205 } |
| 204 | 206 |
| 205 # Top level group | 207 # Top level group |
| 206 | 208 |
| 207 group(group_gen_target_name) { | 209 group(group_gen_target_name) { |
| 208 deps = [ | 210 deps = [ |
| 209 ":$copy_all_target_name", | 211 ":$copy_all_target_name", |
| 210 ] | 212 ] |
| 211 } | 213 } |
| 212 } | 214 } |
| 215 | |
| 216 # Template to package a shared library into a Mac framework bundle. | |
| 217 # | |
| 218 # Arguments | |
| 219 # | |
| 220 # info_plist: | |
| 221 # string, path to the Info.plist file that will be used for the bundle. | |
| 222 # | |
| 223 # output_name: | |
| 224 # (optional) string, name of the generated framework without the | |
| 225 # .framework suffix. If omitted, defaults to target_name. | |
| 226 # | |
| 227 # framework_version: | |
| 228 # (optional) string, version of the framework. Typically this is a | |
| 229 # single letter, like "A". If omitted, the Versions/ subdirectory | |
| 230 # structure will not be created, and build output will go directly | |
| 231 # into the framework subdirectory. | |
| 232 template("mac_framework") { | |
| 233 assert(defined(invoker.deps), | |
| 234 "Dependencies must be specified for $target_name") | |
| 235 assert(defined(invoker.info_plist), | |
| 236 "The Info.plist file must be specified for $target_name") | |
| 237 | |
| 238 _target_name = target_name | |
| 239 _output_name = target_name | |
| 240 if (defined(invoker.output_name)) { | |
| 241 _output_name = invoker.output_name | |
| 242 } | |
| 243 _framework_name = _output_name + ".framework" | |
| 244 _framework_version = "" | |
| 245 if (defined(invoker.framework_version)) { | |
| 246 _framework_version = invoker.framework_version | |
| 247 } | |
| 248 _framework_target = _output_name + "_framework" | |
| 249 | |
| 250 _shared_library_target = target_name + "_shared_library" | |
| 251 _shared_library_bundle_data = _shared_library_target + "_bundle_data" | |
| 252 | |
| 253 shared_library(_shared_library_target) { | |
| 254 visibility = [ ":$_shared_library_bundle_data" ] | |
| 255 forward_variables_from(invoker, | |
| 256 "*", | |
| 257 [ | |
| 258 "assert_no_deps", | |
| 259 "data_deps", | |
| 260 "info_plist", | |
| 261 "output_name", | |
| 262 "visibility", | |
| 263 ]) | |
| 264 } | |
| 265 | |
| 266 bundle_data(_shared_library_bundle_data) { | |
| 267 visibility = [ ":$_framework_target" ] | |
| 268 forward_variables_from(invoker, [ "testonly" ]) | |
| 269 sources = [ | |
| 270 "$root_out_dir/${shlib_prefix}${_shared_library_target}${shlib_extension}" , | |
| 271 ] | |
| 272 outputs = [ | |
| 273 "{{bundle_executable_dir}}/$_output_name", | |
| 274 ] | |
| 275 public_deps = [ | |
| 276 ":$_shared_library_target", | |
| 277 ] | |
| 278 } | |
| 279 | |
| 280 _info_plist_target = target_name + "_info_plist" | |
| 281 | |
| 282 # TODO(rsesek): Process Info.plist variables. | |
| 283 | |
| 284 _info_plist_bundle_data = _info_plist_target + "_bundle_data" | |
| 285 | |
| 286 bundle_data(_info_plist_bundle_data) { | |
| 287 visibility = [ ":$_framework_target" ] | |
| 288 forward_variables_from(invoker, [ "testonly" ]) | |
| 289 sources = [ | |
| 290 invoker.info_plist, | |
| 291 ] | |
| 292 outputs = [ | |
| 293 "{{bundle_root_dir}}/Info.plist", | |
| 294 ] | |
| 295 } | |
| 296 | |
| 297 _package_target = target_name + "_package" | |
| 298 | |
| 299 create_bundle(_framework_target) { | |
| 300 visibility = [ ":$_package_target" ] | |
| 301 forward_variables_from(invoker, | |
| 302 [ | |
| 303 "data_deps", | |
| 304 "deps", | |
| 305 "public_deps", | |
| 306 "testonly", | |
| 307 "visibility", | |
| 308 ]) | |
| 309 | |
| 310 if (!defined(deps)) { | |
| 311 deps = [] | |
| 312 } | |
| 313 deps += [ | |
| 314 ":$_info_plist_bundle_data", | |
| 315 ":$_shared_library_bundle_data", | |
| 316 ] | |
| 317 | |
| 318 bundle_root_dir = "$root_out_dir/$_framework_name" | |
| 319 if (_framework_version != "") { | |
| 320 bundle_root_dir += "/Versions/$_framework_version" | |
| 321 } | |
| 322 bundle_resources_dir = "$bundle_root_dir/Resources" | |
| 323 bundle_executable_dir = "$bundle_root_dir" | |
| 324 } | |
| 325 | |
| 326 if (_framework_version != "") { | |
| 327 action(_package_target) { | |
| 328 visibility = [ ":$_target_name" ] | |
| 329 forward_variables_from(invoker, [ "testonly" ]) | |
| 330 script = "$root_out_dir/gyp-mac-tool" | |
| 331 outputs = [ | |
| 332 "$root_out_dir/$_framework_name/Versions/Current", | |
| 333 ] | |
| 334 args = [ | |
| 335 "package-framework", | |
| 336 "$_framework_name", | |
| 337 "$_framework_version", | |
| 338 ] | |
| 339 deps = [ | |
| 340 ":$_framework_target", | |
| 341 ] | |
| 342 } | |
| 343 } else { | |
| 344 group(_package_target) { | |
| 345 visibility = [ ":$_target_name" ] | |
| 346 forward_variables_from(invoker, [ "testonly" ]) | |
| 347 deps = [ | |
| 348 ":$_framework_target", | |
| 349 ] | |
| 350 } | |
| 351 } | |
| 352 | |
| 353 group(_target_name) { | |
|
brettw
2016/04/07 20:10:29
Can we just use target_name for the name of the gr
Robert Sesek
2016/04/07 20:50:13
Done.
| |
| 354 forward_variables_from(invoker, | |
| 355 [ | |
| 356 "visibility", | |
| 357 "testonly", | |
| 358 ]) | |
| 359 deps = [ | |
| 360 ":$_package_target", | |
| 361 ] | |
| 362 } | |
| 363 } | |
| OLD | NEW |