Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: build/config/ios/rules.gni

Issue 2209973002: Stop sharing code between ios_framework_bundle & mac_framework_bundle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on iOS (variable name collision & public_* forwarding) Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/config/mac/base_rules.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 _toolchain_suffix = ""
10 _is_fat_build = additional_toolchains != []
11 if (_is_fat_build) {
12 _toolchain_suffix = "($default_toolchain)"
13 _is_fat_build_main_target = current_toolchain == default_toolchain
14 }
15
9 # Generates Info.plist files for Mac apps and frameworks. 16 # Generates Info.plist files for Mac apps and frameworks.
10 # 17 #
11 # Arguments 18 # Arguments
12 # 19 #
13 # info_plist: 20 # info_plist:
14 # (optional) string, path to the Info.plist file that will be used for 21 # (optional) string, path to the Info.plist file that will be used for
15 # the bundle. 22 # the bundle.
16 # 23 #
17 # info_plist_target: 24 # info_plist_target:
18 # (optional) string, if the info_plist is generated from an action, 25 # (optional) string, if the info_plist is generated from an action,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 # 146 #
140 # The target for the default toolchain of a multi-architecture build will 147 # The target for the default toolchain of a multi-architecture build will
141 # build the executable for current_cpu in a temporary location. The real 148 # build the executable for current_cpu in a temporary location. The real
142 # fat binary will be created by "lipo" command from all those "executable" 149 # fat binary will be created by "lipo" command from all those "executable"
143 # target (including those of the non-default toolchains). This additional 150 # target (including those of the non-default toolchains). This additional
144 # target has the same role as the "executable" target of a thin build. 151 # target has the same role as the "executable" target of a thin build.
145 # 152 #
146 # The rest of the build, including the codesigning step, are the same for 153 # The rest of the build, including the codesigning step, are the same for
147 # thin and fat builds. 154 # thin and fat builds.
148 155
149 _is_fat_build = additional_toolchains != []
150 if (_is_fat_build) {
151 _is_fat_build_main_target = current_toolchain == default_toolchain
152 }
153
154 _executable_extra_deps = [] 156 _executable_extra_deps = []
155 _executable_extra_inputs = [] 157 _executable_extra_inputs = []
156 _executable_extra_ldflags = [] 158 _executable_extra_ldflags = []
157 159
158 # Embeds the entitlements file if building for simulator. This is optional 160 # Embeds the entitlements file if building for simulator. This is optional
159 # with Xcode 7 or older but required with Xcode 8. This is not necessary for 161 # with Xcode 7 or older but required with Xcode 8. This is not necessary for
160 # device build as the entitlement is embedded via the codesigning step. 162 # device build as the entitlement is embedded via the codesigning step.
161 # 163 #
162 # As the generation of the entitlement depends on the 164 # As the generation of the entitlement depends on the
163 if (use_ios_simulator) { 165 if (use_ios_simulator) {
164 _toolchain_suffix = ""
165 if (_is_fat_build && !_is_fat_build_main_target) {
166 _toolchain_suffix = "($default_toolchain)"
167 }
168
169 _generate_entitlements_target = _target_name + "_gen_entitlements" 166 _generate_entitlements_target = _target_name + "_gen_entitlements"
170 _generate_entitlements_target_with_toolchain_suffix = 167 _generate_entitlements_target_with_toolchain_suffix =
171 "$_generate_entitlements_target$_toolchain_suffix" 168 "$_generate_entitlements_target$_toolchain_suffix"
172 169
173 _generate_entitlements_output = 170 _generate_entitlements_output =
174 get_label_info(_generate_entitlements_target_with_toolchain_suffix, 171 get_label_info(_generate_entitlements_target_with_toolchain_suffix,
175 "target_gen_dir") + "/$_output_name.xcent" 172 "target_gen_dir") + "/$_output_name.xcent"
176 173
177 _executable_extra_inputs += [ _generate_entitlements_output ] 174 _executable_extra_inputs += [ _generate_entitlements_output ]
178 _executable_extra_deps += 175 _executable_extra_deps +=
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 sources = get_target_outputs(":$_convert_target") 753 sources = get_target_outputs(":$_convert_target")
757 754
758 outputs = [ 755 outputs = [
759 invoker.output, 756 invoker.output,
760 ] 757 ]
761 } 758 }
762 } 759 }
763 760
764 # Template to package a shared library into an iOS framework bundle. 761 # Template to package a shared library into an iOS framework bundle.
765 # 762 #
766 # This template provides two targets to control whether the framework is 763 # By default, the bundle target this template generates does not link the
767 # merely built when targets depend on it, or whether it is linked as well: 764 # resulting framework into anything that depends on it. If a dependency wants
768 # "$target_name" and "$target_name+link". 765 # a link-time (as well as build-time) dependency on the framework bundle,
769 # 766 # depend against "$target_name+link". If only the build-time dependency is
770 # See the //build/config/mac/base_rules.gni:framework_bundle for a discussion 767 # required (e.g., for copying into another bundle), then use "$target_name".
771 # and examples.
772 # 768 #
773 # Arguments 769 # Arguments
774 # 770 #
775 # output_name: 771 # output_name:
776 # (optional) string, name of the generated framework without the 772 # (optional) string, name of the generated framework without the
777 # .framework suffix. If omitted, defaults to target_name. 773 # .framework suffix. If omitted, defaults to target_name.
778 # 774 #
779 # framework_version: 775 # framework_version:
780 # (optional) string, version of the framework. Typically this is a 776 # (optional) string, version of the framework. Typically this is a
781 # single letter, like "A". If omitted, the Versions/ subdirectory 777 # single letter, like "A". If omitted, the Versions/ subdirectory
782 # structure will not be created, and build output will go directly 778 # structure will not be created, and build output will go directly
783 # into the framework subdirectory. 779 # into the framework subdirectory.
784 # 780 #
785 # public_headers: 781 # public_headers:
786 # (optional) list of paths to header file that needs to be copied 782 # (optional) list of paths to header file that needs to be copied
787 # into the framework bundle Headers subdirectory. If omitted or 783 # into the framework bundle Headers subdirectory. If omitted or
788 # empty then the Headers subdirectory is not created. 784 # empty then the Headers subdirectory is not created.
789 # 785 #
790 # sources 786 # sources
791 # (optional) list of files. Needs to be defined and non-empty if 787 # (optional) list of files. Needs to be defined and non-empty if
792 # public_headers is defined and non-empty. 788 # public_headers is defined and non-empty.
793 # 789 #
790 # This template provides two targets for the resulting framework bundle. The
791 # link-time behavior varies depending on which of the two targets below is
792 # added as a dependency:
793 # - $target_name only adds a build-time dependency. Targets that depend on
794 # it will not link against the framework.
795 # - $target_name+link adds a build-time and link-time dependency. Targets
796 # that depend on it will link against the framework.
797 #
798 # The build-time-only dependency is used for when a target needs to use the
799 # framework either only for resources, or because the target loads it at run-
800 # time, via dlopen() or NSBundle. The link-time dependency will cause the
801 # dependee to have the framework loaded by dyld at launch.
802 #
803 # Example of build-time only dependency:
804 #
805 # framework_bundle("CoreTeleportation") {
806 # sources = [ ... ]
807 # }
808 #
809 # bundle_data("core_teleportation_bundle_data") {
810 # deps = [ ":CoreTeleportation" ]
811 # sources = [ "$root_out_dir/CoreTeleportation.framework" ]
812 # outputs = [ "{{bundle_root_dir}}/Frameworks/{{source_file_part}}" ]
813 # }
814 #
815 # app_bundle("GoatTeleporter") {
816 # sources = [ ... ]
817 # deps = [
818 # ":core_teleportation_bundle_data",
819 # ]
820 # }
821 #
822 # The GoatTeleporter.app will not directly link against
823 # CoreTeleportation.framework, but it will be included in the bundle's
824 # Frameworks directory.
825 #
826 # Example of link-time dependency:
827 #
828 # framework_bundle("CoreTeleportation") {
829 # sources = [ ... ]
830 # ldflags = [
831 # "-install_name",
832 # "@executable_path/../Frameworks/$target_name.framework"
833 # ]
834 # }
835 #
836 # bundle_data("core_teleportation_bundle_data") {
837 # deps = [ ":CoreTeleportation+link" ]
838 # sources = [ "$root_out_dir/CoreTeleportation.framework" ]
839 # outputs = [ "{{bundle_root_dir}}/Frameworks/{{source_file_part}}" ]
840 # }
841 #
842 # app_bundle("GoatTeleporter") {
843 # sources = [ ... ]
844 # deps = [
845 # ":core_teleportation_bundle_data",
846 # ]
847 # }
848 #
849 # Note that the framework is still copied to the app's bundle, but dyld will
850 # load this library when the app is launched because it uses the "+link"
851 # target as a dependency. This also requires that the framework set its
852 # install_name so that dyld can locate it.
853 #
794 # See "gn help shared_library" for more information on arguments supported 854 # See "gn help shared_library" for more information on arguments supported
795 # by shared library target. 855 # by shared library target.
796 template("ios_framework_bundle") { 856 template("ios_framework_bundle") {
797 _target_name = target_name 857 _target_name = target_name
798 _output_name = target_name 858 _output_name = target_name
799 if (defined(invoker.output_name)) { 859 if (defined(invoker.output_name)) {
800 _output_name = invoker.output_name 860 _output_name = invoker.output_name
801 } 861 }
802 _framework_target = _target_name
803 862
804 _has_public_headers = 863 _has_public_headers =
805 defined(invoker.public_headers) && invoker.public_headers != [] 864 defined(invoker.public_headers) && invoker.public_headers != []
806 865
807 _is_fat_build = additional_toolchains != [] 866 if (_has_public_headers) {
808 if (_is_fat_build) { 867 _framework_headers_target = _target_name + "_framework_headers"
809 _is_fat_build_main_target = current_toolchain == default_toolchain 868 _framework_headers_config = _target_name + "_framework_headers_config"
869 _headers_map_config = _target_name + "_headers_map"
810 } 870 }
811 871
812 # This template has a different expansion depending on whether public headers 872 # The expansion of the template is different for fat and thin builds. For
813 # are defined or not. If no public headers are speficied, then is forwards to 873 # thin build (and default toolchain of a fat build), the template expands
814 # the generic "framework_bundle" target, otherwise if expands to targets that 874 # to a "shared_library" target to create the bundle shared library and a
815 # create header map mapping and corresponding config and configure them as 875 # "create_bundle" target (the main target) to create the bundle structure.
816 # dependencies of the generic "framework_bundle" target.
817 # 876 #
818 # The expansion is a bit different for multi-architecture builds (aka fat 877 # For a fat build, the template just expands to the "shared_library" target
819 # binary builds). Then the targets build for the non-default toolchain uses 878 # for the non-default toolchain, while the final library is created using
820 # the same header map (if available) as the one used by the default toolchain. 879 # "lipo" in the expansion of the template for the default toolchain.
880 #
881 # The "$target_name+link" group for the non-default toolchain depends on the
882 # target of the same name from the default toolchain as this is the target
883 # that defines the real framework bundle (it will support the current cpu
884 # as it is a fat framework).
821 885
822 _toolchain_suffix = ""
823 if (_is_fat_build && !_is_fat_build_main_target) { 886 if (_is_fat_build && !_is_fat_build_main_target) {
824 _toolchain_suffix = "($default_toolchain)" 887 shared_library(_target_name) {
825 } 888 forward_variables_from(invoker,
889 "*",
890 [
891 "assert_no_deps",
892 "bundle_deps",
893 "code_signing_enabled",
894 "data_deps",
895 "info_plist",
896 "info_plist_target",
897 "output_name",
898 ])
899 if (defined(visibility)) {
900 visibility += [ ":${_target_name}_shared_library($default_toolchain)" ]
901 }
902 output_name = _output_name
903 output_prefix_override = true
904 output_extension = ""
905 output_dir = "$target_out_dir/$_target_name"
826 906
827 if (_has_public_headers) { 907 if (_has_public_headers) {
828 _framework_headers_target = _target_name + "_framework_headers" 908 configs += [
829 _framework_public_config = _target_name + "_ios_public_config" 909 ":$_framework_headers_config$_toolchain_suffix",
830 _framework_target = target_name + "_internal" 910 ":$_headers_map_config$_toolchain_suffix",
831 _headers_map_config = _target_name + "_headers_map" 911 ]
832 912
833 if (!_is_fat_build || _is_fat_build_main_target) { 913 if (!defined(deps)) {
914 deps = []
915 }
916 deps += [ ":$_framework_headers_target$_toolchain_suffix" ]
917 }
918 }
919
920 group(_target_name + "+link") {
921 forward_variables_from(invoker,
922 [
923 "visibility",
924 "testonly",
925 ])
926 public_deps = [
927 ":$_target_name+link($default_toolchain)",
928 ]
929 }
930
931 if (defined(invoker.bundle_deps)) {
932 assert(invoker.bundle_deps != [], "mark bundle_deps as used")
933 }
934 } else {
935 if (_has_public_headers) {
834 _public_headers = invoker.public_headers 936 _public_headers = invoker.public_headers
835 _framework_name = _output_name + ".framework" 937 _framework_name = _output_name + ".framework"
836 _framework_root = "$root_out_dir/$_framework_name" 938 _framework_root = "$root_out_dir/$_framework_name"
837 939
838 _header_map_filename = "$target_gen_dir/$_output_name.headers.hmap" 940 _header_map_filename = "$target_gen_dir/$_output_name.headers.hmap"
839 941
840 _compile_headers_map_target = _target_name + "_compile_headers_map" 942 _compile_headers_map_target = _target_name + "_compile_headers_map"
841 action(_compile_headers_map_target) { 943 action(_compile_headers_map_target) {
842 visibility = [ ":$_framework_headers_target" ] 944 visibility = [ ":$_framework_headers_target" ]
843 script = "//build/config/ios/write_framework_hmap.py" 945 script = "//build/config/ios/write_framework_hmap.py"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 } 996 }
895 997
896 group(_framework_headers_target) { 998 group(_framework_headers_target) {
897 deps = [ 999 deps = [
898 ":$_compile_headers_map_target", 1000 ":$_compile_headers_map_target",
899 ":$_copy_public_headers_target", 1001 ":$_copy_public_headers_target",
900 ":$_create_module_map_target", 1002 ":$_create_module_map_target",
901 ] 1003 ]
902 } 1004 }
903 1005
904 config(_framework_public_config) { 1006 config(_framework_headers_config) {
905 # The link settings are inherited from the framework_bundle config. 1007 # The link settings are inherited from the framework_bundle config.
906 cflags = [ 1008 cflags = [
907 "-F", 1009 "-F",
908 rebase_path("$root_out_dir/.", root_build_dir), 1010 rebase_path("$root_out_dir/.", root_build_dir),
909 ] 1011 ]
910 } 1012 }
911 } 1013 }
912 }
913 1014
914 if (!_is_fat_build || _is_fat_build_main_target) { 1015 _code_signing_enabled = ios_enable_code_signing
1016 if (defined(invoker.code_signing_enabled)) {
1017 _code_signing_enabled =
1018 invoker.code_signing_enabled && _code_signing_enabled
1019 }
1020
1021 # If the framework is unversioned, the final _target_name will be the
1022 # create_bundle(_framework_target), otherwise an action with the name
1023 # _target_name will depends on the the create_bundle() in order to prepare
1024 # the versioned directory structure.
1025 _framework_target = _target_name
1026 _framework_name = _output_name + ".framework"
1027 _framework_root_dir = "$root_out_dir/$_framework_name"
1028 if (defined(invoker.framework_version) && invoker.framework_version != "") {
1029 _framework_version = invoker.framework_version
1030 _framework_root_dir += "/Versions/$_framework_version"
1031 _framework_target = _target_name + "_create_bundle"
1032 }
1033
1034 _link_shared_library_target = target_name + "_shared_library"
1035 _shared_library_dir = "$target_out_dir/$_link_shared_library_target"
1036
1037 if (_code_signing_enabled) {
1038 _link_shared_library_visibility = [ ":$_framework_target" ]
1039 } else {
1040 _shared_library_bundle_data = target_name + "_shared_library_bundle_data"
1041 _link_shared_library_visibility = [ ":$_shared_library_bundle_data" ]
1042 }
1043
1044 if (_is_fat_build) {
1045 _lipo_shared_library_target = _link_shared_library_target
1046 _lipo_shared_library_visibility = _link_shared_library_visibility
1047
1048 _link_shared_library_visibility = []
1049 _link_shared_library_visibility = [ ":$_lipo_shared_library_target" ]
1050 _link_shared_library_target = target_name + "_arch_shared_library"
1051
1052 _arch_shared_library_dir = "$target_out_dir/$_link_shared_library_target"
1053 _shared_library_dir = "$target_out_dir/$_lipo_shared_library_target"
1054 }
1055
1056 shared_library(_link_shared_library_target) {
1057 forward_variables_from(invoker,
1058 "*",
1059 [
1060 "assert_no_deps",
1061 "bundle_deps",
1062 "code_signing_enabled",
1063 "data_deps",
1064 "info_plist",
1065 "info_plist_target",
1066 "output_name",
1067 "visibility",
1068 ])
1069 visibility = _link_shared_library_visibility
1070 output_name = _output_name
1071 output_prefix_override = true
1072 output_extension = ""
1073
1074 if (!_is_fat_build) {
1075 output_dir = _shared_library_dir
1076 } else {
1077 output_dir = _arch_shared_library_dir
1078 }
1079
1080 if (_has_public_headers) {
1081 configs += [ ":$_headers_map_config$_toolchain_suffix" ]
1082
1083 if (!defined(deps)) {
1084 deps = []
1085 }
1086 deps += [ ":$_framework_headers_target$_toolchain_suffix" ]
1087 }
1088 }
1089
1090 if (_is_fat_build) {
1091 action(_lipo_shared_library_target) {
1092 forward_variables_from(invoker, [ "testonly" ])
1093 visibility = _lipo_shared_library_visibility
1094 script = "//build/toolchain/mac/linker_driver.py"
1095 outputs = [
1096 "$_shared_library_dir/$_output_name",
1097 ]
1098 inputs = [
1099 "$_arch_shared_library_dir/$_output_name",
1100 ]
1101 deps = [
1102 ":$_link_shared_library_target",
1103 ]
1104 foreach(_additional_toolchain, additional_toolchains) {
1105 _additional_toolchain_target = "$_target_name($_additional_toolchain)"
1106 deps += [ ":$_additional_toolchain_target" ]
1107 inputs += [ get_label_info(_additional_toolchain_target,
1108 "target_out_dir") + "/$_output_name" ]
1109 }
1110 args = [
1111 "xcrun",
1112 "lipo",
1113 "-create",
1114 "-output",
1115 rebase_path(outputs[0], root_build_dir),
1116 ] + rebase_path(inputs, root_build_dir)
1117
1118 if (enable_dsyms) {
1119 outputs += [ "$root_out_dir/$_output_name.dSYM/" ]
1120 args +=
1121 [ "-Wcrl,dsym," + rebase_path("$root_out_dir/.", root_build_dir) ]
1122 }
1123
1124 if (enable_stripping) {
1125 # Check whether //build/config/mac:strip_all has been removed from
1126 # the configs variable (as this is how stripping is disabled for a
1127 # single target).
1128 _strip_all_in_config = false
1129 if (defined(invoker.configs)) {
1130 foreach(_config, invoker.configs) {
1131 if (_config == "//build/config/mac:strip_all") {
1132 _strip_all_in_config = true
1133 }
1134 }
1135 }
1136
1137 if (_strip_all_in_config) {
1138 args += [ "-Wcrl,strip,-x,-S" ]
1139
1140 if (save_unstripped_output) {
1141 outputs += [ outputs[0] + ".unstripped" ]
1142 args += [ "-Wcrl,unstripped," +
1143 rebase_path(get_path_info(outputs[0], "dir"),
1144 root_build_dir) ]
1145 }
1146 }
1147 }
1148 }
1149 }
1150
1151 if (!_code_signing_enabled) {
1152 bundle_data(_shared_library_bundle_data) {
1153 visibility = [ ":$_framework_target" ]
1154 forward_variables_from(invoker, [ "testonly" ])
1155 sources = [
1156 "$_shared_library_dir/$_output_name",
1157 ]
1158 outputs = [
1159 "{{bundle_executable_dir}}/$_output_name",
1160 ]
1161 if (_is_fat_build) {
1162 public_deps = [
1163 ":$_lipo_shared_library_target",
1164 ]
1165 } else {
1166 public_deps = [
1167 ":$_link_shared_library_target",
1168 ]
1169 }
1170 }
1171 }
1172
1173 _framework_public_config = _target_name + "_public_config"
1174 config(_framework_public_config) {
1175 # TODO(sdefresne): should we have a framework_dirs similar to lib_dirs
1176 # and include_dirs to avoid duplicate values on the command-line.
1177 visibility = [ ":$_framework_target" ]
1178 ldflags = [
1179 "-F",
1180 rebase_path("$root_out_dir/.", root_build_dir),
1181 ]
1182 lib_dirs = [ root_out_dir ]
1183 libs = [ _framework_name ]
1184 }
1185
915 _info_plist_target = _target_name + "_info_plist" 1186 _info_plist_target = _target_name + "_info_plist"
916 _info_plist_bundle = _target_name + "_info_plist_bundle" 1187 _info_plist_bundle = _target_name + "_info_plist_bundle"
917 ios_info_plist(_info_plist_target) { 1188 ios_info_plist(_info_plist_target) {
918 visibility = [ ":$_info_plist_bundle" ] 1189 visibility = [ ":$_info_plist_bundle" ]
919 executable_name = _output_name 1190 executable_name = _output_name
920 forward_variables_from(invoker, 1191 forward_variables_from(invoker,
921 [ 1192 [
922 "extra_substitutions", 1193 "extra_substitutions",
923 "info_plist", 1194 "info_plist",
924 "info_plist_target", 1195 "info_plist_target",
925 ]) 1196 ])
926 } 1197 }
927 1198
928 bundle_data(_info_plist_bundle) { 1199 bundle_data(_info_plist_bundle) {
929 visibility = [ ":$_framework_target" ] 1200 visibility = [ ":$_target_name" ]
930 forward_variables_from(invoker, [ "testonly" ]) 1201 forward_variables_from(invoker, [ "testonly" ])
931 sources = get_target_outputs(":$_info_plist_target") 1202 sources = get_target_outputs(":$_info_plist_target")
932 outputs = [ 1203 outputs = [
933 "{{bundle_root_dir}}/Info.plist", 1204 "{{bundle_root_dir}}/Info.plist",
934 ] 1205 ]
935 public_deps = [ 1206 public_deps = [
936 ":$_info_plist_target", 1207 ":$_info_plist_target",
937 ] 1208 ]
938 } 1209 }
939 }
940 1210
941 framework_bundle(_framework_target) { 1211 create_bundle(_framework_target) {
942 forward_variables_from(invoker, 1212 forward_variables_from(invoker,
943 "*", 1213 [
944 [ 1214 "data_deps",
945 "output_name", 1215 "deps",
946 "public_headers", 1216 "public_configs",
947 "visibility", 1217 "public_deps",
948 ]) 1218 "testonly",
949 output_name = _output_name 1219 ])
950 1220
951 if (!_is_fat_build || _is_fat_build_main_target) { 1221 if (defined(_framework_version)) {
952 if (!defined(bundle_deps)) { 1222 visibility = [ ":$_target_name" ]
953 bundle_deps = [] 1223 } else {
1224 if (defined(invoker.visibility)) {
1225 visibility = invoker.visibility
1226 visibility += [ ":$_target_name+link" ]
1227 }
954 } 1228 }
955 bundle_deps += [ ":$_info_plist_bundle" ]
956 }
957
958 if (_has_public_headers) {
959 if (!defined(public_configs)) {
960 public_configs = []
961 }
962 public_configs += [ ":$_framework_public_config$_toolchain_suffix" ]
963 }
964
965 if (_has_public_headers) {
966 visibility = [
967 ":$_target_name$_toolchain_suffix",
968 ":$_target_name+link$_toolchain_suffix",
969 ":$_target_name+bundle$_toolchain_suffix",
970 ]
971 configs += [ ":$_headers_map_config$_toolchain_suffix" ]
972 1229
973 if (!defined(deps)) { 1230 if (!defined(deps)) {
974 deps = [] 1231 deps = []
975 } 1232 }
976 deps += [ ":$_framework_headers_target$_toolchain_suffix" ] 1233 deps += [ ":$_info_plist_bundle" ]
977 } else { 1234
978 if (defined(invoker.visibility)) { 1235 if (defined(invoker.bundle_deps)) {
979 visibility = invoker.visibility 1236 if (!defined(deps)) {
980 visibility += [ ":$_target_name+link$_toolchain_suffix" ] 1237 deps = []
1238 }
1239 deps += invoker.bundle_deps
1240 }
1241
1242 if (!_code_signing_enabled) {
1243 if (!defined(public_deps)) {
1244 public_deps = []
1245 }
1246 public_deps += [ ":$_shared_library_bundle_data" ]
1247 }
1248
1249 bundle_root_dir = _framework_root_dir
1250 bundle_resources_dir = "$bundle_root_dir/Resources"
1251 bundle_executable_dir = "$bundle_root_dir"
1252
1253 if (_code_signing_enabled) {
1254 if (!defined(deps)) {
1255 deps = []
1256 }
1257
1258 if (_is_fat_build) {
1259 deps += [ ":$_lipo_shared_library_target" ]
1260 } else {
1261 deps += [ ":$_link_shared_library_target" ]
1262 }
1263
1264 _entitlements_path = "//build/config/ios/entitlements.plist"
1265 if (defined(invoker.entitlements_path)) {
1266 _entitlements_path = invoker.entitlements_path
1267 }
1268
1269 code_signing_script = "//build/config/ios/codesign.py"
1270 code_signing_sources = [
1271 _entitlements_path,
1272 "$_shared_library_dir/$_output_name",
1273 ]
1274 code_signing_outputs = [
1275 "$bundle_root_dir/$_output_name",
1276 "$bundle_root_dir/_CodeSignature/CodeResources",
1277 "$bundle_root_dir/embedded.mobileprovision",
1278 ]
1279 code_signing_args = [
1280 "-e=" + rebase_path(_entitlements_path, root_build_dir),
1281 "code-sign-bundle",
1282 "-i=" + ios_code_signing_identity,
1283 "-b=" +
1284 rebase_path("$_shared_library_dir/$_output_name", root_build_dir),
1285 rebase_path(bundle_root_dir, root_build_dir),
1286 ]
981 } 1287 }
982 } 1288 }
983 }
984 1289
985 if (_has_public_headers) { 1290 if (defined(_framework_version)) {
986 group(_target_name) { 1291 action(_target_name) {
987 forward_variables_from(invoker, 1292 forward_variables_from(invoker, [ "testonly" ])
988 [
989 "testonly",
990 "public_configs",
991 ])
992 1293
993 if (defined(invoker.visibility)) { 1294 if (defined(invoker.visibility)) {
994 visibility = invoker.visibility 1295 visibility = invoker.visibility
995 visibility += [ ":$_target_name+link" ] 1296 visibility += [ ":$_target_name+link" ]
1297 }
1298
1299 script = "//build/config/mac/package_framework.py"
1300 outputs = [
1301 "$root_out_dir/$_framework_name/Versions/Current",
1302 ]
1303 args = [
1304 "$_framework_name",
1305 "$_framework_version",
1306 ]
1307 public_deps = [
1308 ":$_framework_target",
1309 ]
996 } 1310 }
997
998 public_deps = [
999 ":$_framework_target$_toolchain_suffix",
1000 ]
1001 } 1311 }
1002 1312
1003 group(_target_name + "+link") { 1313 group(_target_name + "+link") {
1004 forward_variables_from(invoker, 1314 forward_variables_from(invoker,
1005 [ 1315 [
1316 "public_deps",
1317 "public_configs",
1006 "testonly", 1318 "testonly",
1007 "visibility", 1319 "visibility",
1008 ]) 1320 ])
1009 public_deps = [ 1321 if (!defined(public_deps)) {
1010 ":$_framework_target+link$_toolchain_suffix", 1322 public_deps = []
1011 ] 1323 }
1324 public_deps += [ ":$_target_name" ]
1325 if (!defined(public_configs)) {
1326 public_configs = []
1327 }
1328 public_configs += [ ":$_framework_public_config" ]
1329
1330 if (_has_public_headers) {
1331 public_configs += [ ":$_framework_headers_config" ]
1332 }
1012 } 1333 }
1013 }
1014 1334
1015 if (!_is_fat_build || _is_fat_build_main_target) {
1016 bundle_data(_target_name + "+bundle") { 1335 bundle_data(_target_name + "+bundle") {
1017 forward_variables_from(invoker, 1336 forward_variables_from(invoker,
1018 [ 1337 [
1019 "testonly", 1338 "testonly",
1020 "visibility", 1339 "visibility",
1021 ]) 1340 ])
1022 public_deps = [ 1341 public_deps = [
1023 ":$_framework_target", 1342 ":$_target_name",
1024 ] 1343 ]
1025 sources = [ 1344 sources = [
1026 "$root_out_dir/$_output_name.framework", 1345 "$root_out_dir/$_output_name.framework",
1027 ] 1346 ]
1028 outputs = [ 1347 outputs = [
1029 "{{bundle_resources_dir}}/Frameworks/$_output_name.framework", 1348 "{{bundle_resources_dir}}/Frameworks/$_output_name.framework",
1030 ] 1349 ]
1031 } 1350 }
1032 } 1351 }
1033 } 1352 }
1034 1353
1035 set_defaults("ios_framework_bundle") { 1354 set_defaults("ios_framework_bundle") {
1036 configs = default_shared_library_configs 1355 configs = default_shared_library_configs
1037 } 1356 }
1038 1357
1039 # For Chrome on iOS we want to run XCTests for all our build configurations 1358 # For Chrome on iOS we want to run XCTests for all our build configurations
1040 # (Debug, Release, ...). In addition, the symbols visibility is configured to 1359 # (Debug, Release, ...). In addition, the symbols visibility is configured to
1041 # private by default. To simplify testing with those constraints, our tests are 1360 # private by default. To simplify testing with those constraints, our tests are
1042 # compiled in the TEST_HOST target instead of the .xctest bundle. 1361 # compiled in the TEST_HOST target instead of the .xctest bundle.
1043 template("ios_xctest_test") { 1362 template("ios_xctest_test") {
1044 _target_name = target_name 1363 _target_name = target_name
1045 _output_name = target_name 1364 _output_name = target_name
1046 if (defined(invoker.output_name)) { 1365 if (defined(invoker.output_name)) {
1047 _output_name = invoker.output_name 1366 _output_name = invoker.output_name
1048 } 1367 }
1049 1368
1050 _is_fat_build = additional_toolchains != []
1051 if (_is_fat_build) {
1052 _is_fat_build_main_target = current_toolchain == default_toolchain
1053 }
1054
1055 _xctest_target = _target_name 1369 _xctest_target = _target_name
1056 _xctest_output = _output_name 1370 _xctest_output = _output_name
1057 1371
1058 _host_target = _target_name + "_host" 1372 _host_target = _target_name + "_host"
1059 _host_output = _output_name + "_host" 1373 _host_output = _output_name + "_host"
1060 1374
1061 if (_is_fat_build && !_is_fat_build_main_target) { 1375 if (_is_fat_build && !_is_fat_build_main_target) {
1062 loadable_module(_xctest_target) { 1376 loadable_module(_xctest_target) {
1063 visibility = [ ":${_xctest_target}_loadable_module($default_toolchain)" ] 1377 visibility = [ ":${_xctest_target}_loadable_module($default_toolchain)" ]
1064 sources = [ 1378 sources = [
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 "-rpath", 1621 "-rpath",
1308 "-Xlinker", 1622 "-Xlinker",
1309 "@loader_path/Frameworks", 1623 "@loader_path/Frameworks",
1310 ] 1624 ]
1311 } 1625 }
1312 } 1626 }
1313 1627
1314 set_defaults("ios_xctest_test") { 1628 set_defaults("ios_xctest_test") {
1315 configs = default_executable_configs 1629 configs = default_executable_configs
1316 } 1630 }
OLDNEW
« no previous file with comments | « no previous file | build/config/mac/base_rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698