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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 742 |
743 # Compile a xib or storyboard file and add it to a bundle_data so that it is | 743 # Compile a xib or storyboard file and add it to a bundle_data so that it is |
744 # available at runtime in the bundle. | 744 # available at runtime in the bundle. |
745 # | 745 # |
746 # Arguments | 746 # Arguments |
747 # | 747 # |
748 # source: | 748 # source: |
749 # string, path of the xib or storyboard to compile. | 749 # string, path of the xib or storyboard to compile. |
750 # | 750 # |
751 # Forwards all variables to the bundle_data target. | 751 # Forwards all variables to the bundle_data target. |
752 template("bundle_data_xib") { | 752 template("bundle_data_ib_file") { |
753 assert(defined(invoker.source), "source needs to be defined for $target_name") | 753 assert(defined(invoker.source), "source needs to be defined for $target_name") |
754 | 754 |
755 _source_extension = get_path_info(invoker.source, "extension") | 755 _source_extension = get_path_info(invoker.source, "extension") |
756 assert(_source_extension == "xib" || _source_extension == "storyboard", | 756 assert(_source_extension == "xib" || _source_extension == "storyboard", |
757 "source must be a .xib or .storyboard for $target_name") | 757 "source must be a .xib or .storyboard for $target_name") |
758 | 758 |
759 _target_name = target_name | 759 _target_name = target_name |
760 _compile_xib = target_name + "_compile_xib" | 760 if (_source_extension == "xib") { |
| 761 _compile_ib_file = target_name + "_compile_xib" |
| 762 _output_extension = "nib" |
| 763 } else { |
| 764 _compile_ib_file = target_name + "_compile_storyboard" |
| 765 _output_extension = "storyboardc" |
| 766 } |
761 | 767 |
762 compile_xibs(_compile_xib) { | 768 compile_ib_files(_compile_ib_file) { |
763 sources = [ | 769 sources = [ |
764 invoker.source, | 770 invoker.source, |
765 ] | 771 ] |
| 772 output_extension = _output_extension |
766 visibility = [ ":$_target_name" ] | 773 visibility = [ ":$_target_name" ] |
767 ibtool_flags = [ | 774 ibtool_flags = [ |
768 "--minimum-deployment-target", | 775 "--minimum-deployment-target", |
769 ios_deployment_target, | 776 ios_deployment_target, |
770 "--auto-activate-custom-fonts", | 777 "--auto-activate-custom-fonts", |
771 "--target-device", | 778 "--target-device", |
772 "iphone", | 779 "iphone", |
773 "--target-device", | 780 "--target-device", |
774 "ipad", | 781 "ipad", |
775 ] | 782 ] |
776 } | 783 } |
777 | 784 |
778 bundle_data(_target_name) { | 785 bundle_data(_target_name) { |
779 forward_variables_from(invoker, "*", [ "source" ]) | 786 forward_variables_from(invoker, "*", [ "source" ]) |
780 | 787 |
781 if (!defined(public_deps)) { | 788 if (!defined(public_deps)) { |
782 public_deps = [] | 789 public_deps = [] |
783 } | 790 } |
784 public_deps += [ ":$_compile_xib" ] | 791 public_deps += [ ":$_compile_ib_file" ] |
785 | 792 |
786 sources = get_target_outputs(":$_compile_xib") | 793 sources = get_target_outputs(":$_compile_ib_file") |
787 | 794 |
788 outputs = [ | 795 outputs = [ |
789 "{{bundle_resources_dir}}/{{source_file_part}}", | 796 "{{bundle_resources_dir}}/{{source_file_part}}", |
790 ] | 797 ] |
791 } | 798 } |
792 } | 799 } |
793 | 800 |
794 # Compile a strings file and add it to a bundle_data so that it is available | 801 # Compile a strings file and add it to a bundle_data so that it is available |
795 # at runtime in the bundle. | 802 # at runtime in the bundle. |
796 # | 803 # |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 "-rpath", | 1420 "-rpath", |
1414 "-Xlinker", | 1421 "-Xlinker", |
1415 "@loader_path/Frameworks", | 1422 "@loader_path/Frameworks", |
1416 ] | 1423 ] |
1417 } | 1424 } |
1418 } | 1425 } |
1419 | 1426 |
1420 set_defaults("ios_xctest_test") { | 1427 set_defaults("ios_xctest_test") { |
1421 configs = default_executable_configs | 1428 configs = default_executable_configs |
1422 } | 1429 } |
OLD | NEW |