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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 # default to ios_enable_code_signing if not defined. | 413 # default to ios_enable_code_signing if not defined. |
414 # | 414 # |
415 # For more information, see "gn help executable". | 415 # For more information, see "gn help executable". |
416 template("ios_app_bundle") { | 416 template("ios_app_bundle") { |
417 _output_name = target_name | 417 _output_name = target_name |
418 _target_name = target_name | 418 _target_name = target_name |
419 if (defined(invoker.output_name)) { | 419 if (defined(invoker.output_name)) { |
420 _output_name = invoker.output_name | 420 _output_name = invoker.output_name |
421 } | 421 } |
422 | 422 |
423 # TODO(sdefresne): some target downstream manually pack an PkgInfo, so | |
424 # allow controlling the generation of the PkgInfo file via an undocumented | |
425 # parameter until they are fixed. | |
426 _write_pkg_info = false | |
427 if (defined(invoker.write_pkg_info)) { | 423 if (defined(invoker.write_pkg_info)) { |
428 _write_pkg_info = invoker.write_pkg_info | 424 # TODO(sdefresne): remove once all downstream target have been fixed to |
| 425 # not override this variable anymore. |
| 426 assert(invoker.write_pkg_info, "write_pkg_info cannot be overridden") |
429 } | 427 } |
430 | 428 |
431 assert(_write_pkg_info || !_write_pkg_info, | |
432 "prevents 'Assignment had no effect.' errors") | |
433 | |
434 _arch_executable_source = _target_name + "_arch_executable_sources" | 429 _arch_executable_source = _target_name + "_arch_executable_sources" |
435 _arch_executable_target = _target_name + "_arch_executable" | 430 _arch_executable_target = _target_name + "_arch_executable" |
436 _lipo_executable_target = _target_name + "_executable" | 431 _lipo_executable_target = _target_name + "_executable" |
437 | 432 |
438 source_set(_arch_executable_source) { | 433 source_set(_arch_executable_source) { |
439 forward_variables_from(invoker, | 434 forward_variables_from(invoker, |
440 "*", | 435 "*", |
441 [ | 436 [ |
442 "bundle_deps", | 437 "bundle_deps", |
443 "bundle_deps_filter", | 438 "bundle_deps_filter", |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 | 633 |
639 sources = get_target_outputs(":$_generate_info_plist") | 634 sources = get_target_outputs(":$_generate_info_plist") |
640 outputs = [ | 635 outputs = [ |
641 "{{bundle_root_dir}}/Info.plist", | 636 "{{bundle_root_dir}}/Info.plist", |
642 ] | 637 ] |
643 public_deps = [ | 638 public_deps = [ |
644 ":$_generate_info_plist", | 639 ":$_generate_info_plist", |
645 ] | 640 ] |
646 } | 641 } |
647 | 642 |
| 643 _app_product_type = "com.apple.product-type.application" |
| 644 _product_type = _app_product_type |
| 645 if (defined(invoker.product_type)) { |
| 646 _product_type = invoker.product_type |
| 647 } |
| 648 |
| 649 _app_bundle_extension = ".app" |
| 650 _bundle_extension = _app_bundle_extension |
| 651 if (defined(invoker.bundle_extension)) { |
| 652 _bundle_extension = invoker.bundle_extension |
| 653 } |
| 654 |
| 655 # Only write PkgInfo for real application, not application extension (they |
| 656 # have the same product type but a different extension). |
| 657 _write_pkg_info = _product_type == _app_product_type && |
| 658 _bundle_extension == _app_bundle_extension |
| 659 |
648 if (_write_pkg_info) { | 660 if (_write_pkg_info) { |
649 _create_pkg_info = target_name + "_pkg_info" | 661 _create_pkg_info = target_name + "_pkg_info" |
650 action(_create_pkg_info) { | 662 action(_create_pkg_info) { |
651 forward_variables_from(invoker, [ "testonly" ]) | 663 forward_variables_from(invoker, [ "testonly" ]) |
652 script = "//build/config/mac/write_pkg_info.py" | 664 script = "//build/config/mac/write_pkg_info.py" |
653 sources = get_target_outputs(":$_generate_info_plist") | 665 sources = get_target_outputs(":$_generate_info_plist") |
654 outputs = [ | 666 outputs = [ |
655 "$target_gen_dir/$target_name", | 667 "$target_gen_dir/$target_name", |
656 ] | 668 ] |
657 args = [ "--plist" ] + rebase_path(sources, root_build_dir) + | 669 args = [ "--plist" ] + rebase_path(sources, root_build_dir) + |
(...skipping 14 matching lines...) Expand all Loading... |
672 ":$_create_pkg_info", | 684 ":$_create_pkg_info", |
673 ] | 685 ] |
674 } | 686 } |
675 } | 687 } |
676 | 688 |
677 create_signed_bundle(_target_name) { | 689 create_signed_bundle(_target_name) { |
678 forward_variables_from(invoker, | 690 forward_variables_from(invoker, |
679 [ | 691 [ |
680 "bundle_deps", | 692 "bundle_deps", |
681 "bundle_deps_filter", | 693 "bundle_deps_filter", |
682 "bundle_extension", | |
683 "data_deps", | 694 "data_deps", |
684 "deps", | 695 "deps", |
685 "enable_code_signing", | 696 "enable_code_signing", |
686 "entitlements_path", | 697 "entitlements_path", |
687 "entitlements_target", | 698 "entitlements_target", |
688 "extra_system_frameworks", | 699 "extra_system_frameworks", |
689 "product_type", | |
690 "public_configs", | 700 "public_configs", |
691 "public_deps", | 701 "public_deps", |
692 "testonly", | 702 "testonly", |
693 "visibility", | 703 "visibility", |
694 ]) | 704 ]) |
695 | 705 |
696 output_name = _output_name | 706 output_name = _output_name |
697 bundle_binary_target = ":$_lipo_executable_target" | 707 bundle_binary_target = ":$_lipo_executable_target" |
698 bundle_binary_output = _output_name | 708 bundle_binary_output = _output_name |
| 709 bundle_extension = _bundle_extension |
| 710 product_type = _product_type |
699 | 711 |
700 if (!defined(bundle_deps)) { | 712 if (!defined(bundle_deps)) { |
701 bundle_deps = [] | 713 bundle_deps = [] |
702 } | 714 } |
703 bundle_deps += [ ":$_bundle_data_info_plist" ] | 715 bundle_deps += [ ":$_bundle_data_info_plist" ] |
704 if (_write_pkg_info) { | 716 if (_write_pkg_info) { |
705 bundle_deps += [ ":$_bundle_data_pkg_info" ] | 717 bundle_deps += [ ":$_bundle_data_pkg_info" ] |
706 } | 718 } |
707 | 719 |
708 if (use_ios_simulator) { | 720 if (use_ios_simulator) { |
709 if (!defined(data_deps)) { | 721 if (!defined(data_deps)) { |
710 data_deps = [] | 722 data_deps = [] |
711 } | 723 } |
712 data_deps += [ "//testing/iossim" ] | 724 data_deps += [ "//testing/iossim" ] |
713 } | 725 } |
714 | |
715 if (!defined(product_type)) { | |
716 product_type = "com.apple.product-type.application" | |
717 } | |
718 | |
719 if (!defined(bundle_extension)) { | |
720 bundle_extension = ".app" | |
721 } | |
722 } | 726 } |
723 } | 727 } |
724 } | 728 } |
725 | 729 |
726 set_defaults("ios_app_bundle") { | 730 set_defaults("ios_app_bundle") { |
727 configs = default_executable_configs | 731 configs = default_executable_configs |
728 } | 732 } |
729 | 733 |
730 # Template to build an application extension bundle for iOS. | 734 # Template to build an application extension bundle for iOS. |
731 # | 735 # |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 "-rpath", | 1460 "-rpath", |
1457 "-Xlinker", | 1461 "-Xlinker", |
1458 "@loader_path/Frameworks", | 1462 "@loader_path/Frameworks", |
1459 ] | 1463 ] |
1460 } | 1464 } |
1461 } | 1465 } |
1462 | 1466 |
1463 set_defaults("ios_xctest_test") { | 1467 set_defaults("ios_xctest_test") { |
1464 configs = default_executable_configs | 1468 configs = default_executable_configs |
1465 } | 1469 } |
OLD | NEW |