| 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/mac/base_rules.gni") | 6 import("//build/config/mac/base_rules.gni") |
| 6 | 7 |
| 7 # Generates Info.plist files for Mac apps and frameworks. | 8 # Generates Info.plist files for Mac apps and frameworks. |
| 8 # | 9 # |
| 9 # Arguments | 10 # Arguments |
| 10 # | 11 # |
| 11 # info_plist: | 12 # info_plist: |
| 12 # (optional) string, path to the Info.plist file that will be used for | 13 # (optional) string, path to the Info.plist file that will be used for |
| 13 # the bundle. | 14 # the bundle. |
| 14 # | 15 # |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 # | 94 # |
| 94 # info_plist: | 95 # info_plist: |
| 95 # (optional) string, path to the Info.plist file that will be used for | 96 # (optional) string, path to the Info.plist file that will be used for |
| 96 # the bundle. | 97 # the bundle. |
| 97 # | 98 # |
| 98 # info_plist_target: | 99 # info_plist_target: |
| 99 # (optional) string, if the info_plist is generated from an action, | 100 # (optional) string, if the info_plist is generated from an action, |
| 100 # rather than a regular source file, specify the target name in lieu | 101 # rather than a regular source file, specify the target name in lieu |
| 101 # of info_plist. The two arguments are mutually exclusive. | 102 # of info_plist. The two arguments are mutually exclusive. |
| 102 # | 103 # |
| 104 # entitlements_path: |
| 105 # (optional) path to the template to use to generate the application |
| 106 # entitlements by performing variable substitutions, defaults to |
| 107 # $ios_sdk_path/Entitlements.plist. |
| 108 # |
| 103 # bundle_extension: | 109 # bundle_extension: |
| 104 # (optional) bundle extension including the dot, default to ".app". | 110 # (optional) bundle extension including the dot, default to ".app". |
| 105 # | 111 # |
| 106 # product_type | 112 # product_type |
| 107 # (optional) string, product type for the generated Xcode project, | 113 # (optional) string, product type for the generated Xcode project, |
| 108 # default to "com.apple.product-type.application". Should generally | 114 # default to "com.apple.product-type.application". Should generally |
| 109 # not be overridden. | 115 # not be overridden. |
| 110 # | 116 # |
| 111 # For more information, see "gn help executable". | 117 # For more information, see "gn help executable". |
| 112 template("ios_app_bundle") { | 118 template("ios_app_bundle") { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 135 sources = get_target_outputs(":$_generate_info_plist") | 141 sources = get_target_outputs(":$_generate_info_plist") |
| 136 outputs = [ | 142 outputs = [ |
| 137 "{{bundle_root_dir}}/Info.plist", | 143 "{{bundle_root_dir}}/Info.plist", |
| 138 ] | 144 ] |
| 139 public_deps = [ | 145 public_deps = [ |
| 140 ":$_generate_info_plist", | 146 ":$_generate_info_plist", |
| 141 ] | 147 ] |
| 142 } | 148 } |
| 143 | 149 |
| 144 _generate_executable = target_name + "_generate_executable" | 150 _generate_executable = target_name + "_generate_executable" |
| 145 _bundle_data_executable = target_name + "_bundle_data_executable" | 151 if (!ios_enable_code_signing) { |
| 152 _bundle_data_executable = target_name + "_bundle_data_executable" |
| 153 } |
| 146 | 154 |
| 147 executable(_generate_executable) { | 155 executable(_generate_executable) { |
| 148 visibility = [ ":$_bundle_data_executable" ] | 156 if (ios_enable_code_signing) { |
| 157 visibility = [ ":$_target_name" ] |
| 158 } else { |
| 159 visibility = [ ":$_bundle_data_executable" ] |
| 160 } |
| 149 forward_variables_from(invoker, | 161 forward_variables_from(invoker, |
| 150 "*", | 162 "*", |
| 151 [ | 163 [ |
| 152 "assert_no_deps", | 164 "assert_no_deps", |
| 153 "bundle_extension", | 165 "bundle_extension", |
| 154 "code_signing_identity", | |
| 155 "data_deps", | 166 "data_deps", |
| 156 "entitlements_path", | 167 "entitlements_path", |
| 157 "info_plist", | 168 "info_plist", |
| 158 "info_plist_target", | 169 "info_plist_target", |
| 159 "output_name", | 170 "output_name", |
| 160 "product_type", | 171 "product_type", |
| 161 "visibility", | 172 "visibility", |
| 162 ]) | 173 ]) |
| 163 | 174 |
| 164 output_name = rebase_path("$target_gen_dir/$_output_name", root_out_dir) | 175 output_name = rebase_path("$target_gen_dir/$_output_name", root_out_dir) |
| 165 if (!defined(libs)) { | 176 if (!defined(libs)) { |
| 166 libs = [] | 177 libs = [] |
| 167 } | 178 } |
| 168 libs += [ "UIKit.framework" ] | 179 libs += [ "UIKit.framework" ] |
| 169 if (!defined(ldflags)) { | 180 if (!defined(ldflags)) { |
| 170 ldflags = [] | 181 ldflags = [] |
| 171 } | 182 } |
| 172 ldflags += [ "-ObjC" ] | 183 ldflags += [ "-ObjC" ] |
| 173 } | 184 } |
| 174 | 185 |
| 175 bundle_data(_bundle_data_executable) { | 186 if (!ios_enable_code_signing) { |
| 176 forward_variables_from(invoker, [ "testonly" ]) | 187 bundle_data(_bundle_data_executable) { |
| 177 visibility = [ ":$_target_name" ] | 188 forward_variables_from(invoker, [ "testonly" ]) |
| 178 sources = [ | 189 visibility = [ ":$_target_name" ] |
| 179 "$target_gen_dir/$_output_name", | 190 sources = [ |
| 180 ] | 191 "$target_gen_dir/$_output_name", |
| 181 outputs = [ | 192 ] |
| 182 "{{bundle_executable_dir}}/$_output_name", | 193 outputs = [ |
| 183 ] | 194 "{{bundle_executable_dir}}/$_output_name", |
| 184 public_deps = [ | 195 ] |
| 185 ":$_generate_executable", | 196 public_deps = [ |
| 186 ] | 197 ":$_generate_executable", |
| 198 ] |
| 199 } |
| 187 } | 200 } |
| 188 | 201 |
| 189 create_bundle(target_name) { | 202 create_bundle(target_name) { |
| 190 forward_variables_from(invoker, | 203 forward_variables_from(invoker, |
| 191 [ | 204 [ |
| 192 "data_deps", | 205 "data_deps", |
| 193 "deps", | 206 "deps", |
| 194 "public_deps", | 207 "public_deps", |
| 195 "testonly", | 208 "testonly", |
| 196 "visibility", | 209 "visibility", |
| 197 ]) | 210 ]) |
| 198 | 211 |
| 199 if (!defined(deps)) { | 212 if (!defined(deps)) { |
| 200 deps = [] | 213 deps = [] |
| 201 } | 214 } |
| 202 deps += [ | 215 deps += [ ":$_bundle_data_info_plist" ] |
| 203 ":$_bundle_data_executable", | 216 if (ios_enable_code_signing) { |
| 204 ":$_bundle_data_info_plist", | 217 deps += [ ":$_generate_executable" ] |
| 205 ] | 218 } else { |
| 219 deps += [ ":$_bundle_data_executable" ] |
| 220 } |
| 206 | 221 |
| 207 if (use_ios_simulator) { | 222 if (use_ios_simulator) { |
| 208 if (!defined(data_deps)) { | 223 if (!defined(data_deps)) { |
| 209 data_deps = [] | 224 data_deps = [] |
| 210 } | 225 } |
| 211 data_deps += [ "//testing/iossim" ] | 226 data_deps += [ "//testing/iossim" ] |
| 212 } | 227 } |
| 213 | 228 |
| 214 if (defined(invoker.product_type)) { | 229 if (defined(invoker.product_type)) { |
| 215 product_type = invoker.product_type | 230 product_type = invoker.product_type |
| 216 } else { | 231 } else { |
| 217 product_type = "com.apple.product-type.application" | 232 product_type = "com.apple.product-type.application" |
| 218 } | 233 } |
| 219 | 234 |
| 220 if (defined(invoker.bundle_extension)) { | 235 if (defined(invoker.bundle_extension)) { |
| 221 _bundle_extension = invoker.bundle_extension | 236 _bundle_extension = invoker.bundle_extension |
| 222 } else { | 237 } else { |
| 223 _bundle_extension = ".app" | 238 _bundle_extension = ".app" |
| 224 } | 239 } |
| 225 | 240 |
| 226 bundle_root_dir = "$root_out_dir/$_output_name$_bundle_extension" | 241 bundle_root_dir = "$root_out_dir/$_output_name$_bundle_extension" |
| 227 bundle_resources_dir = bundle_root_dir | 242 bundle_resources_dir = bundle_root_dir |
| 228 bundle_executable_dir = bundle_root_dir | 243 bundle_executable_dir = bundle_root_dir |
| 229 bundle_plugins_dir = "$bundle_root_dir/PlugIns" | 244 bundle_plugins_dir = "$bundle_root_dir/PlugIns" |
| 245 |
| 246 if (defined(invoker.entitlements_path)) { |
| 247 _entitlements_path = invoker.entitlements_path |
| 248 } else { |
| 249 _entitlements_path = "$ios_sdk_path/Entitlements.plist" |
| 250 } |
| 251 |
| 252 if (ios_enable_code_signing) { |
| 253 code_signing_script = "//build/config/ios/codesign.py" |
| 254 code_signing_sources = [ |
| 255 _entitlements_path, |
| 256 "$target_gen_dir/$_output_name", |
| 257 ] |
| 258 code_signing_outputs = [ |
| 259 "$bundle_root_dir/$_output_name", |
| 260 "$bundle_root_dir/_CodeSignature/CodeResources", |
| 261 "$bundle_root_dir/embedded.mobileprovision", |
| 262 ] |
| 263 code_signing_args = [ |
| 264 "-i=" + ios_code_signing_identity, |
| 265 "-b=" + rebase_path("$target_gen_dir/$_output_name", root_build_dir), |
| 266 "-e=" + rebase_path(_entitlements_path, root_build_dir), |
| 267 rebase_path(bundle_root_dir, root_build_dir), |
| 268 ] |
| 269 } else { |
| 270 assert(_entitlements_path != "", |
| 271 "force usage of _entitlements_path to avoid unused variable error") |
| 272 } |
| 230 } | 273 } |
| 231 | |
| 232 # TODO(crbug.com/297668): | |
| 233 # - add support for codesigning, | |
| 234 # - find a way to make "ninja -C out/Default base_unittests.app" work as | |
| 235 # an alias to "ninja -C out/Default base_unittests" (for convenience | |
| 236 # and compatibility with gyp), | |
| 237 } | 274 } |
| 238 | 275 |
| 239 # Template to build an application extension bundle for iOS. | 276 # Template to build an application extension bundle for iOS. |
| 240 # | 277 # |
| 241 # This should be used instead of "executable" built-in target type on iOS. | 278 # This should be used instead of "executable" built-in target type on iOS. |
| 242 # As the template forward the generation of the application executable to | 279 # As the template forward the generation of the application executable to |
| 243 # an "executable" target, all arguments supported by "executable" targets | 280 # an "executable" target, all arguments supported by "executable" targets |
| 244 # are also supported by this template. | 281 # are also supported by this template. |
| 245 # | 282 # |
| 246 # Arguments | 283 # Arguments |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 [ | 564 [ |
| 528 "testonly", | 565 "testonly", |
| 529 "visibility", | 566 "visibility", |
| 530 ]) | 567 ]) |
| 531 public_deps = [ | 568 public_deps = [ |
| 532 ":$_framework_target+link", | 569 ":$_framework_target+link", |
| 533 ] | 570 ] |
| 534 } | 571 } |
| 535 } | 572 } |
| 536 } | 573 } |
| OLD | NEW |