| 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 import("//build/config/mac/base_rules.gni") | 6 import("//build/config/mac/base_rules.gni") |
| 7 import("//build/config/mac/symbols.gni") | 7 import("//build/config/mac/symbols.gni") |
| 8 import("//build/toolchain/toolchain.gni") | 8 import("//build/toolchain/toolchain.gni") |
| 9 | 9 |
| 10 # Invokes lipo on multiple arch-specific binaries to create a fat binary. | 10 # Invokes lipo on multiple arch-specific binaries to create a fat binary. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 # (optional) string, base name of the binary generated by the | 150 # (optional) string, base name of the binary generated by the |
| 151 # bundle_binary_target target, defaults to the target name. | 151 # bundle_binary_target target, defaults to the target name. |
| 152 # | 152 # |
| 153 # extra_system_frameworks | 153 # extra_system_frameworks |
| 154 # (optional) list of system framework to copy to the bundle. | 154 # (optional) list of system framework to copy to the bundle. |
| 155 # | 155 # |
| 156 # enable_code_signing | 156 # enable_code_signing |
| 157 # (optional) boolean, control whether code signing is enabled or not, | 157 # (optional) boolean, control whether code signing is enabled or not, |
| 158 # default to ios_enable_code_signing if not defined. | 158 # default to ios_enable_code_signing if not defined. |
| 159 # | 159 # |
| 160 # entitlements_path: |
| 161 # (optional) path to the template to use to generate the application |
| 162 # entitlements by performing variable substitutions, defaults to |
| 163 # //build/config/ios/entitlements.plist. |
| 164 # |
| 165 # entitlements_target: |
| 166 # (optional) label of the target generating the application |
| 167 # entitlements (must generate a single file as output); cannot be |
| 168 # defined if entitlements_path is set. |
| 169 # |
| 160 template("create_signed_bundle") { | 170 template("create_signed_bundle") { |
| 161 assert(defined(invoker.product_type), | 171 assert(defined(invoker.product_type), |
| 162 "product_type must be defined for $target_name") | 172 "product_type must be defined for $target_name") |
| 163 assert(defined(invoker.bundle_extension), | 173 assert(defined(invoker.bundle_extension), |
| 164 "bundle_extension must be defined for $target_name") | 174 "bundle_extension must be defined for $target_name") |
| 165 assert(defined(invoker.bundle_binary_target), | 175 assert(defined(invoker.bundle_binary_target), |
| 166 "bundle_binary_target must be defined for $target_name") | 176 "bundle_binary_target must be defined for $target_name") |
| 167 | 177 |
| 168 _target_name = target_name | 178 _target_name = target_name |
| 169 _output_name = target_name | 179 _output_name = target_name |
| 170 if (defined(invoker.output_name)) { | 180 if (defined(invoker.output_name)) { |
| 171 _output_name = invoker.output_name | 181 _output_name = invoker.output_name |
| 172 } | 182 } |
| 173 | 183 |
| 174 _bundle_binary_target = invoker.bundle_binary_target | 184 _bundle_binary_target = invoker.bundle_binary_target |
| 175 _bundle_binary_output = get_label_info(_bundle_binary_target, "name") | 185 _bundle_binary_output = get_label_info(_bundle_binary_target, "name") |
| 176 if (defined(invoker.bundle_binary_output)) { | 186 if (defined(invoker.bundle_binary_output)) { |
| 177 _bundle_binary_output = invoker.bundle_binary_output | 187 _bundle_binary_output = invoker.bundle_binary_output |
| 178 } | 188 } |
| 179 | 189 |
| 180 _bundle_extension = invoker.bundle_extension | 190 _bundle_extension = invoker.bundle_extension |
| 181 _bundle_root_dir = "$root_out_dir/$_output_name$_bundle_extension" | 191 _bundle_root_dir = "$root_out_dir/$_output_name$_bundle_extension" |
| 182 | 192 |
| 183 _entitlements_path = "//build/config/ios/entitlements.plist" | 193 if (!defined(invoker.entitlements_target)) { |
| 184 if (defined(invoker.entitlements_path)) { | 194 _entitlements_path = "//build/config/ios/entitlements.plist" |
| 185 _entitlements_path = invoker.entitlements_path | 195 if (defined(invoker.entitlements_path)) { |
| 196 _entitlements_path = invoker.entitlements_path |
| 197 } |
| 198 } else { |
| 199 assert(!defined(invoker.entitlements_path), |
| 200 "Cannot define both entitlements_path and entitlements_target " + |
| 201 "for $target_name") |
| 202 |
| 203 _entitlements_target_outputs = |
| 204 get_target_outputs(invoker.entitlements_target) |
| 205 _entitlements_path = _entitlements_target_outputs[0] |
| 186 } | 206 } |
| 187 | 207 |
| 188 _enable_code_signing = ios_enable_code_signing | 208 _enable_code_signing = ios_enable_code_signing |
| 189 if (defined(invoker.enable_code_signing)) { | 209 if (defined(invoker.enable_code_signing)) { |
| 190 _enable_code_signing = invoker.enable_code_signing | 210 _enable_code_signing = invoker.enable_code_signing |
| 191 } | 211 } |
| 192 | 212 |
| 193 create_bundle(_target_name) { | 213 create_bundle(_target_name) { |
| 194 forward_variables_from(invoker, | 214 forward_variables_from(invoker, |
| 195 [ | 215 [ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 212 public_deps = [] | 232 public_deps = [] |
| 213 } | 233 } |
| 214 public_deps += [ _bundle_binary_target ] | 234 public_deps += [ _bundle_binary_target ] |
| 215 | 235 |
| 216 if (defined(invoker.bundle_deps)) { | 236 if (defined(invoker.bundle_deps)) { |
| 217 if (!defined(deps)) { | 237 if (!defined(deps)) { |
| 218 deps = [] | 238 deps = [] |
| 219 } | 239 } |
| 220 deps += invoker.bundle_deps | 240 deps += invoker.bundle_deps |
| 221 } | 241 } |
| 242 if (defined(invoker.entitlements_target)) { |
| 243 if (!defined(deps)) { |
| 244 deps = [] |
| 245 } |
| 246 deps += [ invoker.entitlements_target ] |
| 247 } |
| 222 | 248 |
| 223 code_signing_script = "//build/config/ios/codesign.py" | 249 code_signing_script = "//build/config/ios/codesign.py" |
| 224 code_signing_sources = [ | 250 code_signing_sources = [ |
| 225 _entitlements_path, | 251 _entitlements_path, |
| 226 get_label_info(_bundle_binary_target, "target_out_dir") + | 252 get_label_info(_bundle_binary_target, "target_out_dir") + |
| 227 "/$_bundle_binary_output", | 253 "/$_bundle_binary_output", |
| 228 ] | 254 ] |
| 229 code_signing_outputs = [ "$_bundle_root_dir/$_output_name" ] | 255 code_signing_outputs = [ "$_bundle_root_dir/$_output_name" ] |
| 230 if (_enable_code_signing) { | 256 if (_enable_code_signing) { |
| 231 code_signing_outputs += | 257 code_signing_outputs += |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 # info_plist_target: | 388 # info_plist_target: |
| 363 # (optional) string, if the info_plist is generated from an action, | 389 # (optional) string, if the info_plist is generated from an action, |
| 364 # rather than a regular source file, specify the target name in lieu | 390 # rather than a regular source file, specify the target name in lieu |
| 365 # of info_plist. The two arguments are mutually exclusive. | 391 # of info_plist. The two arguments are mutually exclusive. |
| 366 # | 392 # |
| 367 # entitlements_path: | 393 # entitlements_path: |
| 368 # (optional) path to the template to use to generate the application | 394 # (optional) path to the template to use to generate the application |
| 369 # entitlements by performing variable substitutions, defaults to | 395 # entitlements by performing variable substitutions, defaults to |
| 370 # //build/config/ios/entitlements.plist. | 396 # //build/config/ios/entitlements.plist. |
| 371 # | 397 # |
| 398 # entitlements_target: |
| 399 # (optional) label of the target generating the application |
| 400 # entitlements (must generate a single file as output); cannot be |
| 401 # defined if entitlements_path is set. |
| 402 # |
| 372 # bundle_extension: | 403 # bundle_extension: |
| 373 # (optional) bundle extension including the dot, default to ".app". | 404 # (optional) bundle extension including the dot, default to ".app". |
| 374 # | 405 # |
| 375 # product_type | 406 # product_type |
| 376 # (optional) string, product type for the generated Xcode project, | 407 # (optional) string, product type for the generated Xcode project, |
| 377 # default to "com.apple.product-type.application". Should generally | 408 # default to "com.apple.product-type.application". Should generally |
| 378 # not be overridden. | 409 # not be overridden. |
| 379 # | 410 # |
| 380 # enable_code_signing | 411 # enable_code_signing |
| 381 # (optional) boolean, control whether code signing is enabled or not, | 412 # (optional) boolean, control whether code signing is enabled or not, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 395 | 426 |
| 396 source_set(_arch_executable_source) { | 427 source_set(_arch_executable_source) { |
| 397 forward_variables_from(invoker, | 428 forward_variables_from(invoker, |
| 398 "*", | 429 "*", |
| 399 [ | 430 [ |
| 400 "bundle_deps", | 431 "bundle_deps", |
| 401 "bundle_deps_filter", | 432 "bundle_deps_filter", |
| 402 "bundle_extension", | 433 "bundle_extension", |
| 403 "enable_code_signing", | 434 "enable_code_signing", |
| 404 "entitlements_path", | 435 "entitlements_path", |
| 436 "entitlements_target", |
| 405 "extra_substitutions", | 437 "extra_substitutions", |
| 406 "extra_system_frameworks", | 438 "extra_system_frameworks", |
| 407 "info_plist", | 439 "info_plist", |
| 408 "info_plist_target", | 440 "info_plist_target", |
| 409 "output_name", | 441 "output_name", |
| 410 "product_type", | 442 "product_type", |
| 411 "visibility", | 443 "visibility", |
| 412 ]) | 444 ]) |
| 413 | 445 |
| 414 visibility = [ ":$_arch_executable_target" ] | 446 visibility = [ ":$_arch_executable_target" ] |
| 415 } | 447 } |
| 416 | 448 |
| 417 if (current_toolchain == default_toolchain || use_ios_simulator) { | 449 if (current_toolchain == default_toolchain || use_ios_simulator) { |
| 418 _generate_entitlements_target = _target_name + "_gen_entitlements" | 450 _generate_entitlements_target = _target_name + "_gen_entitlements" |
| 419 _generate_entitlements_output = | 451 _generate_entitlements_output = |
| 420 get_label_info(":$_generate_entitlements_target($default_toolchain)", | 452 get_label_info(":$_generate_entitlements_target($default_toolchain)", |
| 421 "target_out_dir") + "/$_output_name.xcent" | 453 "target_out_dir") + "/$_output_name.xcent" |
| 422 } | 454 } |
| 423 | 455 |
| 424 executable(_arch_executable_target) { | 456 executable(_arch_executable_target) { |
| 425 forward_variables_from(invoker, | 457 forward_variables_from(invoker, |
| 426 "*", | 458 "*", |
| 427 [ | 459 [ |
| 428 "bundle_deps", | 460 "bundle_deps", |
| 429 "bundle_deps_filter", | 461 "bundle_deps_filter", |
| 430 "bundle_extension", | 462 "bundle_extension", |
| 431 "enable_code_signing", | 463 "enable_code_signing", |
| 432 "entitlements_path", | 464 "entitlements_path", |
| 465 "entitlements_target", |
| 433 "extra_substitutions", | 466 "extra_substitutions", |
| 434 "extra_system_frameworks", | 467 "extra_system_frameworks", |
| 435 "info_plist", | 468 "info_plist", |
| 436 "info_plist_target", | 469 "info_plist_target", |
| 437 "output_name", | 470 "output_name", |
| 438 "product_type", | 471 "product_type", |
| 439 "sources", | 472 "sources", |
| 440 "visibility", | 473 "visibility", |
| 441 ]) | 474 ]) |
| 442 | 475 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 [ | 565 [ |
| 533 "extra_substitutions", | 566 "extra_substitutions", |
| 534 "info_plist", | 567 "info_plist", |
| 535 "info_plist_target", | 568 "info_plist_target", |
| 536 ]) | 569 ]) |
| 537 | 570 |
| 538 executable_name = _output_name | 571 executable_name = _output_name |
| 539 } | 572 } |
| 540 | 573 |
| 541 if (current_toolchain == default_toolchain) { | 574 if (current_toolchain == default_toolchain) { |
| 542 _entitlements_path = "//build/config/ios/entitlements.plist" | 575 if (!defined(invoker.entitlements_target)) { |
| 543 if (defined(invoker.entitlements_path)) { | 576 _entitlements_path = "//build/config/ios/entitlements.plist" |
| 544 _entitlements_path = invoker.entitlements_path | 577 if (defined(invoker.entitlements_path)) { |
| 578 _entitlements_path = invoker.entitlements_path |
| 579 } |
| 580 } else { |
| 581 assert(!defined(invoker.entitlements_path), |
| 582 "Cannot define both entitlements_path and entitlements_target" + |
| 583 "for $_target_name") |
| 584 |
| 585 _entitlements_target_outputs = |
| 586 get_target_outputs(invoker.entitlements_target) |
| 587 _entitlements_path = _entitlements_target_outputs[0] |
| 545 } | 588 } |
| 546 | 589 |
| 547 action(_generate_entitlements_target) { | 590 action(_generate_entitlements_target) { |
| 548 _gen_info_plist_outputs = get_target_outputs(":$_generate_info_plist") | 591 _gen_info_plist_outputs = get_target_outputs(":$_generate_info_plist") |
| 549 _info_plist_path = _gen_info_plist_outputs[0] | 592 _info_plist_path = _gen_info_plist_outputs[0] |
| 550 | 593 |
| 551 script = "//build/config/ios/codesign.py" | 594 script = "//build/config/ios/codesign.py" |
| 552 deps = [ | 595 deps = [ |
| 553 ":$_generate_info_plist", | 596 ":$_generate_info_plist", |
| 554 ] | 597 ] |
| 598 if (defined(invoker.entitlements_target)) { |
| 599 deps += [ invoker.entitlements_target ] |
| 600 } |
| 555 sources = [ | 601 sources = [ |
| 556 _entitlements_path, | 602 _entitlements_path, |
| 557 _info_plist_path, | 603 _info_plist_path, |
| 558 ] | 604 ] |
| 559 outputs = [ | 605 outputs = [ |
| 560 _generate_entitlements_output, | 606 _generate_entitlements_output, |
| 561 ] | 607 ] |
| 562 | 608 |
| 563 args = [] | 609 args = [] |
| 564 if (!use_system_xcode) { | 610 if (!use_system_xcode) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 591 create_signed_bundle(_target_name) { | 637 create_signed_bundle(_target_name) { |
| 592 forward_variables_from(invoker, | 638 forward_variables_from(invoker, |
| 593 [ | 639 [ |
| 594 "bundle_deps", | 640 "bundle_deps", |
| 595 "bundle_deps_filter", | 641 "bundle_deps_filter", |
| 596 "bundle_extension", | 642 "bundle_extension", |
| 597 "data_deps", | 643 "data_deps", |
| 598 "deps", | 644 "deps", |
| 599 "enable_code_signing", | 645 "enable_code_signing", |
| 600 "entitlements_path", | 646 "entitlements_path", |
| 647 "entitlements_target", |
| 601 "extra_system_frameworks", | 648 "extra_system_frameworks", |
| 602 "product_type", | 649 "product_type", |
| 603 "public_configs", | 650 "public_configs", |
| 604 "public_deps", | 651 "public_deps", |
| 605 "testonly", | 652 "testonly", |
| 606 "visibility", | 653 "visibility", |
| 607 ]) | 654 ]) |
| 608 | 655 |
| 609 output_name = _output_name | 656 output_name = _output_name |
| 610 bundle_binary_target = ":$_lipo_executable_target" | 657 bundle_binary_target = ":$_lipo_executable_target" |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 "-rpath", | 1412 "-rpath", |
| 1366 "-Xlinker", | 1413 "-Xlinker", |
| 1367 "@loader_path/Frameworks", | 1414 "@loader_path/Frameworks", |
| 1368 ] | 1415 ] |
| 1369 } | 1416 } |
| 1370 } | 1417 } |
| 1371 | 1418 |
| 1372 set_defaults("ios_xctest_test") { | 1419 set_defaults("ios_xctest_test") { |
| 1373 configs = default_executable_configs | 1420 configs = default_executable_configs |
| 1374 } | 1421 } |
| OLD | NEW |