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