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 | 8 |
9 _is_fat_build = additional_toolchains != [] | 9 _is_secondary_build = |
10 if (_is_fat_build) { | 10 additional_toolchains != [] && current_toolchain != default_toolchain |
11 _is_fat_build_main_target = current_toolchain == default_toolchain | |
12 } | |
13 | 11 |
14 _code_signing_script_path = "//build/config/ios/codesign.py" | 12 _code_signing_script_path = "//build/config/ios/codesign.py" |
15 _default_entitlements_path = "//build/config/ios/entitlements.plist" | 13 _default_entitlements_path = "//build/config/ios/entitlements.plist" |
16 | 14 |
17 # Generates Info.plist files for Mac apps and frameworks. | 15 # Generates Info.plist files for Mac apps and frameworks. |
18 # | 16 # |
19 # Arguments | 17 # Arguments |
20 # | 18 # |
21 # info_plist: | 19 # info_plist: |
22 # (optional) string, path to the Info.plist file that will be used for | 20 # (optional) string, path to the Info.plist file that will be used for |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 "-sectcreate", | 176 "-sectcreate", |
179 "-Xlinker", | 177 "-Xlinker", |
180 "__TEXT", | 178 "__TEXT", |
181 "-Xlinker", | 179 "-Xlinker", |
182 "__entitlements", | 180 "__entitlements", |
183 "-Xlinker", | 181 "-Xlinker", |
184 rebase_path(_generate_entitlements_output, root_build_dir), | 182 rebase_path(_generate_entitlements_output, root_build_dir), |
185 ] | 183 ] |
186 } | 184 } |
187 | 185 |
188 if (_is_fat_build && !_is_fat_build_main_target) { | 186 if (_is_secondary_build) { |
189 # For the non-default toolchain of a fat-build, the template expands to a | 187 # For the non-default toolchain of a fat-build, the template expands to a |
190 # single "executable" target that creates "$root_out_dir/$_output_name". | 188 # single "executable" target that creates "$root_out_dir/$_output_name". |
191 executable(_target_name) { | 189 executable(_target_name) { |
192 forward_variables_from(invoker, | 190 forward_variables_from(invoker, |
193 "*", | 191 "*", |
194 [ | 192 [ |
195 "bundle_deps", | 193 "bundle_deps", |
196 "bundle_deps_filter", | 194 "bundle_deps_filter", |
197 "bundle_extension", | 195 "bundle_extension", |
198 "entitlements_path", | 196 "entitlements_path", |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 _generate_entitlements_output, | 283 _generate_entitlements_output, |
286 ] | 284 ] |
287 args = [ | 285 args = [ |
288 "generate-entitlements", | 286 "generate-entitlements", |
289 "-e=" + rebase_path(_entitlements_path, root_build_dir), | 287 "-e=" + rebase_path(_entitlements_path, root_build_dir), |
290 "-p=" + rebase_path(_info_plist_path, root_build_dir), | 288 "-p=" + rebase_path(_info_plist_path, root_build_dir), |
291 ] + rebase_path(outputs, root_build_dir) | 289 ] + rebase_path(outputs, root_build_dir) |
292 } | 290 } |
293 } | 291 } |
294 | 292 |
295 _link_executable = _target_name + "_executable" | 293 _link_executable = _target_name + "_arch_executable" |
296 _link_executable_visibility = [ ":$_target_name" ] | 294 _lipo_executable = _target_name + "_executable" |
297 | 295 |
298 # For a fat-build, the different "executable" outputs will be used to | 296 _link_executable_visibility = [ ":$_lipo_executable" ] |
299 # create the final binary using "lipo". As the corresponding target has | 297 _lipo_executable_visibility = [ ":$_target_name" ] |
300 # the same role as the "executable" target in a thin build, copy the | |
301 # visibility and redefine some variables. | |
302 if (_is_fat_build) { | |
303 _lipo_executable = _link_executable | |
304 _lipo_executable_visibility = _link_executable_visibility | |
305 | |
306 _link_executable_visibility = [] | |
307 _link_executable_visibility = [ ":$_lipo_executable" ] | |
308 _link_executable = _target_name + "_arch_executable" | |
309 } | |
310 | 298 |
311 executable(_link_executable) { | 299 executable(_link_executable) { |
312 forward_variables_from(invoker, | 300 forward_variables_from(invoker, |
313 "*", | 301 "*", |
314 [ | 302 [ |
315 "bundle_deps", | 303 "bundle_deps", |
316 "bundle_deps_filter", | 304 "bundle_deps_filter", |
317 "bundle_extension", | 305 "bundle_extension", |
318 "data_deps", | 306 "data_deps", |
319 "entitlements_path", | 307 "entitlements_path", |
320 "extra_substitutions", | 308 "extra_substitutions", |
321 "extra_system_frameworks", | 309 "extra_system_frameworks", |
322 "info_plist", | 310 "info_plist", |
323 "info_plist_target", | 311 "info_plist_target", |
324 "output_name", | 312 "output_name", |
325 "product_type", | 313 "product_type", |
326 "visibility", | 314 "visibility", |
327 ]) | 315 ]) |
328 | 316 |
329 visibility = _link_executable_visibility | 317 visibility = _link_executable_visibility |
330 | 318 |
331 output_name = _output_name | 319 output_name = _output_name |
332 output_prefix_override = true | 320 output_prefix_override = true |
333 if (_is_fat_build) { | 321 output_dir = "$target_out_dir/$current_cpu" |
334 output_dir = "$target_out_dir/$current_cpu" | |
335 } else { | |
336 output_dir = target_out_dir | |
337 } | |
338 | 322 |
339 if (!defined(deps)) { | 323 if (!defined(deps)) { |
340 deps = [] | 324 deps = [] |
341 } | 325 } |
342 deps += _executable_extra_deps | 326 deps += _executable_extra_deps |
343 | 327 |
344 if (!defined(ldflags)) { | 328 if (!defined(ldflags)) { |
345 ldflags = [] | 329 ldflags = [] |
346 } | 330 } |
347 ldflags += _executable_extra_ldflags | 331 ldflags += _executable_extra_ldflags |
348 | 332 |
349 if (!defined(inputs)) { | 333 if (!defined(inputs)) { |
350 inputs = [] | 334 inputs = [] |
351 } | 335 } |
352 inputs += _executable_extra_inputs | 336 inputs += _executable_extra_inputs |
353 | 337 |
354 if (!defined(libs)) { | 338 if (!defined(libs)) { |
355 libs = [] | 339 libs = [] |
356 } | 340 } |
357 libs += [ "UIKit.framework" ] | 341 libs += [ "UIKit.framework" ] |
358 } | 342 } |
359 | 343 |
360 if (_is_fat_build) { | 344 # Create the multi-architecture binary from all the single architecture |
361 # Create the multi-architecture binary from all the single architecture | 345 # binaries using "lipo". This target exists for the default toolchain |
362 # binaries using "lipo". This target exists for the default toolchain | 346 # of a fat-build only and depends on the expansion of "ios_app_bundle" |
363 # of a fat-build only and depends on the expansion of "ios_app_bundle" | 347 # for the other toolchains (i.e. a single "executable" target). |
364 # for the other toolchains (i.e. a single "executable" target). | 348 # |
365 # | 349 # This action only happens once per "ios_app_bundle" template (for the |
366 # This action only happens once per "ios_app_bundle" template (for the | 350 # main toolchain). |
367 # main toolchain). | 351 action(_lipo_executable) { |
368 action(_lipo_executable) { | 352 forward_variables_from(invoker, [ "testonly" ]) |
369 forward_variables_from(invoker, [ "testonly" ]) | 353 visibility = _lipo_executable_visibility |
370 visibility = _lipo_executable_visibility | 354 script = "//build/toolchain/mac/linker_driver.py" |
371 script = "//build/toolchain/mac/linker_driver.py" | 355 outputs = [ |
372 outputs = [ | 356 "$target_out_dir/$_output_name", |
373 "$target_out_dir/$_output_name", | 357 ] |
| 358 inputs = [ |
| 359 "$target_out_dir/$current_cpu/$_output_name", |
| 360 ] |
| 361 deps = [ |
| 362 ":$_link_executable", |
| 363 ] |
| 364 foreach(_additional_toolchain, additional_toolchains) { |
| 365 _additional_toolchain_target = "$_target_name($_additional_toolchain)" |
| 366 deps += [ ":$_additional_toolchain_target" ] |
| 367 inputs += [ get_label_info(_additional_toolchain_target, |
| 368 "root_out_dir") + "/$_output_name" ] |
| 369 } |
| 370 args = [ |
| 371 "xcrun", |
| 372 "lipo", |
| 373 "-create", |
| 374 "-output", |
| 375 rebase_path(outputs[0], root_build_dir), |
| 376 ] + rebase_path(inputs, root_build_dir) |
| 377 |
| 378 if (enable_dsyms) { |
| 379 _dsyms_dir = "$root_out_dir/$_output_name.dSYM/" |
| 380 outputs += [ |
| 381 "$_dsyms_dir/", |
| 382 "$_dsyms_dir/Contents/Info.plist", |
| 383 "$_dsyms_dir/Contents/Resources/DWARF/$_output_name", |
374 ] | 384 ] |
375 inputs = [ | 385 args += |
376 "$target_out_dir/$current_cpu/$_output_name", | 386 [ "-Wcrl,dsym," + rebase_path("$root_out_dir/.", root_build_dir) ] |
377 ] | 387 } |
378 deps = [ | |
379 ":$_link_executable", | |
380 ] | |
381 foreach(_additional_toolchain, additional_toolchains) { | |
382 _additional_toolchain_target = "$_target_name($_additional_toolchain)" | |
383 deps += [ ":$_additional_toolchain_target" ] | |
384 inputs += [ get_label_info(_additional_toolchain_target, | |
385 "root_out_dir") + "/$_output_name" ] | |
386 } | |
387 args = [ | |
388 "xcrun", | |
389 "lipo", | |
390 "-create", | |
391 "-output", | |
392 rebase_path(outputs[0], root_build_dir), | |
393 ] + rebase_path(inputs, root_build_dir) | |
394 | 388 |
395 if (enable_dsyms) { | 389 if (enable_stripping) { |
396 _dsyms_dir = "$root_out_dir/$_output_name.dSYM/" | 390 # Check whether //build/config/mac:strip_all has been removed from |
397 outputs += [ | 391 # the configs variable (as this is how stripping is disabled for a |
398 "$_dsyms_dir/", | 392 # single target). |
399 "$_dsyms_dir/Contents/Info.plist", | 393 _strip_all_in_config = false |
400 "$_dsyms_dir/Contents/Resources/DWARF/$_output_name", | 394 if (defined(invoker.configs)) { |
401 ] | 395 foreach(_config, invoker.configs) { |
402 args += | 396 if (_config == "//build/config/mac:strip_all") { |
403 [ "-Wcrl,dsym," + rebase_path("$root_out_dir/.", root_build_dir) ] | 397 _strip_all_in_config = true |
404 } | |
405 | |
406 if (enable_stripping) { | |
407 # Check whether //build/config/mac:strip_all has been removed from | |
408 # the configs variable (as this is how stripping is disabled for a | |
409 # single target). | |
410 _strip_all_in_config = false | |
411 if (defined(invoker.configs)) { | |
412 foreach(_config, invoker.configs) { | |
413 if (_config == "//build/config/mac:strip_all") { | |
414 _strip_all_in_config = true | |
415 } | |
416 } | |
417 } | |
418 | |
419 if (_strip_all_in_config) { | |
420 args += [ "-Wcrl,strip,-x,-S" ] | |
421 | |
422 if (save_unstripped_output) { | |
423 outputs += [ outputs[0] + ".unstripped" ] | |
424 args += [ "-Wcrl,unstripped," + | |
425 rebase_path(get_path_info(outputs[0], "dir"), | |
426 root_build_dir) ] | |
427 } | 398 } |
428 } | 399 } |
429 } | 400 } |
| 401 |
| 402 if (_strip_all_in_config) { |
| 403 args += [ "-Wcrl,strip,-x,-S" ] |
| 404 |
| 405 if (save_unstripped_output) { |
| 406 outputs += [ outputs[0] + ".unstripped" ] |
| 407 args += [ "-Wcrl,unstripped," + |
| 408 rebase_path(get_path_info(outputs[0], "dir"), |
| 409 root_build_dir) ] |
| 410 } |
| 411 } |
430 } | 412 } |
431 } | 413 } |
432 | 414 |
433 create_bundle(target_name) { | 415 create_bundle(target_name) { |
434 forward_variables_from(invoker, | 416 forward_variables_from(invoker, |
435 [ | 417 [ |
436 "bundle_deps_filter", | 418 "bundle_deps_filter", |
437 "data_deps", | 419 "data_deps", |
438 "deps", | 420 "deps", |
439 "public_deps", | 421 "public_deps", |
440 "testonly", | 422 "testonly", |
441 "visibility", | 423 "visibility", |
442 ]) | 424 ]) |
443 | 425 |
444 if (!defined(deps)) { | 426 if (!defined(deps)) { |
445 deps = [] | 427 deps = [] |
446 } | 428 } |
447 deps += [ ":$_bundle_data_info_plist" ] | 429 deps += [ ":$_bundle_data_info_plist" ] |
448 if (!defined(public_deps)) { | 430 if (!defined(public_deps)) { |
449 public_deps = [] | 431 public_deps = [] |
450 } | 432 } |
451 if (_is_fat_build) { | 433 public_deps += [ ":$_lipo_executable" ] |
452 public_deps += [ ":$_lipo_executable" ] | |
453 } else { | |
454 public_deps += [ ":$_link_executable" ] | |
455 } | |
456 if (defined(invoker.bundle_deps)) { | 434 if (defined(invoker.bundle_deps)) { |
457 deps += invoker.bundle_deps | 435 deps += invoker.bundle_deps |
458 } | 436 } |
459 | 437 |
460 if (use_ios_simulator) { | 438 if (use_ios_simulator) { |
461 if (!defined(data_deps)) { | 439 if (!defined(data_deps)) { |
462 data_deps = [] | 440 data_deps = [] |
463 } | 441 } |
464 data_deps += [ "//testing/iossim" ] | 442 data_deps += [ "//testing/iossim" ] |
465 } | 443 } |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 # | 820 # |
843 # For a fat build, the template just expands to the "shared_library" target | 821 # For a fat build, the template just expands to the "shared_library" target |
844 # for the non-default toolchain, while the final library is created using | 822 # for the non-default toolchain, while the final library is created using |
845 # "lipo" in the expansion of the template for the default toolchain. | 823 # "lipo" in the expansion of the template for the default toolchain. |
846 # | 824 # |
847 # The "$target_name+link" group for the non-default toolchain depends on the | 825 # The "$target_name+link" group for the non-default toolchain depends on the |
848 # target of the same name from the default toolchain as this is the target | 826 # target of the same name from the default toolchain as this is the target |
849 # that defines the real framework bundle (it will support the current cpu | 827 # that defines the real framework bundle (it will support the current cpu |
850 # as it is a fat framework). | 828 # as it is a fat framework). |
851 | 829 |
852 if (_is_fat_build && !_is_fat_build_main_target) { | 830 if (_is_secondary_build) { |
853 shared_library(_target_name) { | 831 shared_library(_target_name) { |
854 forward_variables_from(invoker, | 832 forward_variables_from(invoker, |
855 "*", | 833 "*", |
856 [ | 834 [ |
857 "assert_no_deps", | 835 "assert_no_deps", |
858 "bundle_deps", | 836 "bundle_deps", |
859 "data_deps", | 837 "data_deps", |
860 "info_plist", | 838 "info_plist", |
861 "info_plist_target", | 839 "info_plist_target", |
862 "output_name", | 840 "output_name", |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 # the versioned directory structure. | 961 # the versioned directory structure. |
984 _framework_target = _target_name | 962 _framework_target = _target_name |
985 _framework_name = _output_name + ".framework" | 963 _framework_name = _output_name + ".framework" |
986 _framework_root_dir = "$root_out_dir/$_framework_name" | 964 _framework_root_dir = "$root_out_dir/$_framework_name" |
987 if (defined(invoker.framework_version) && invoker.framework_version != "") { | 965 if (defined(invoker.framework_version) && invoker.framework_version != "") { |
988 _framework_version = invoker.framework_version | 966 _framework_version = invoker.framework_version |
989 _framework_root_dir += "/Versions/$_framework_version" | 967 _framework_root_dir += "/Versions/$_framework_version" |
990 _framework_target = _target_name + "_create_bundle" | 968 _framework_target = _target_name + "_create_bundle" |
991 } | 969 } |
992 | 970 |
993 _link_shared_library_target = target_name + "_shared_library" | 971 _link_shared_library_target = target_name + "_arch_shared_library" |
994 _shared_library_dir = "$target_out_dir/$_link_shared_library_target" | 972 _lipo_shared_library_target = target_name + "_shared_library" |
995 _link_shared_library_visibility = [ ":$_framework_target" ] | |
996 | 973 |
997 if (_is_fat_build) { | 974 _lipo_shared_library_visibility = [ ":$_framework_target" ] |
998 _lipo_shared_library_target = _link_shared_library_target | 975 _link_shared_library_visibility = [ ":$_lipo_shared_library_target" ] |
999 _lipo_shared_library_visibility = _link_shared_library_visibility | |
1000 | 976 |
1001 _link_shared_library_visibility = [] | 977 _arch_shared_library_dir = "$target_out_dir/$_link_shared_library_target" |
1002 _link_shared_library_visibility = [ ":$_lipo_shared_library_target" ] | 978 _shared_library_dir = "$target_out_dir/$_lipo_shared_library_target" |
1003 _link_shared_library_target = target_name + "_arch_shared_library" | |
1004 | |
1005 _arch_shared_library_dir = "$target_out_dir/$_link_shared_library_target" | |
1006 _shared_library_dir = "$target_out_dir/$_lipo_shared_library_target" | |
1007 } | |
1008 | 979 |
1009 shared_library(_link_shared_library_target) { | 980 shared_library(_link_shared_library_target) { |
1010 forward_variables_from(invoker, | 981 forward_variables_from(invoker, |
1011 "*", | 982 "*", |
1012 [ | 983 [ |
1013 "assert_no_deps", | 984 "assert_no_deps", |
1014 "bundle_deps", | 985 "bundle_deps", |
1015 "data_deps", | 986 "data_deps", |
1016 "info_plist", | 987 "info_plist", |
1017 "info_plist_target", | 988 "info_plist_target", |
1018 "output_name", | 989 "output_name", |
1019 "visibility", | 990 "visibility", |
1020 ]) | 991 ]) |
1021 visibility = _link_shared_library_visibility | 992 visibility = _link_shared_library_visibility |
1022 output_name = _output_name | 993 output_name = _output_name |
1023 output_prefix_override = true | 994 output_prefix_override = true |
1024 output_extension = "" | 995 output_extension = "" |
1025 | 996 output_dir = _arch_shared_library_dir |
1026 if (!_is_fat_build) { | |
1027 output_dir = _shared_library_dir | |
1028 } else { | |
1029 output_dir = _arch_shared_library_dir | |
1030 } | |
1031 | 997 |
1032 if (_has_public_headers) { | 998 if (_has_public_headers) { |
1033 configs += [ ":$_headers_map_config($default_toolchain)" ] | 999 configs += [ ":$_headers_map_config($default_toolchain)" ] |
1034 | 1000 |
1035 if (!defined(deps)) { | 1001 if (!defined(deps)) { |
1036 deps = [] | 1002 deps = [] |
1037 } | 1003 } |
1038 deps += [ ":$_framework_headers_target($default_toolchain)" ] | 1004 deps += [ ":$_framework_headers_target($default_toolchain)" ] |
1039 } | 1005 } |
1040 } | 1006 } |
1041 | 1007 |
1042 if (_is_fat_build) { | 1008 action(_lipo_shared_library_target) { |
1043 action(_lipo_shared_library_target) { | 1009 forward_variables_from(invoker, [ "testonly" ]) |
1044 forward_variables_from(invoker, [ "testonly" ]) | 1010 visibility = _lipo_shared_library_visibility |
1045 visibility = _lipo_shared_library_visibility | 1011 script = "//build/toolchain/mac/linker_driver.py" |
1046 script = "//build/toolchain/mac/linker_driver.py" | 1012 outputs = [ |
1047 outputs = [ | 1013 "$_shared_library_dir/$_output_name", |
1048 "$_shared_library_dir/$_output_name", | 1014 ] |
| 1015 inputs = [ |
| 1016 "$_arch_shared_library_dir/$_output_name", |
| 1017 ] |
| 1018 deps = [ |
| 1019 ":$_link_shared_library_target", |
| 1020 ] |
| 1021 foreach(_additional_toolchain, additional_toolchains) { |
| 1022 _additional_toolchain_target = "$_target_name($_additional_toolchain)" |
| 1023 deps += [ ":$_additional_toolchain_target" ] |
| 1024 inputs += [ get_label_info(_additional_toolchain_target, |
| 1025 "target_out_dir") + "/$_output_name" ] |
| 1026 } |
| 1027 args = [ |
| 1028 "xcrun", |
| 1029 "lipo", |
| 1030 "-create", |
| 1031 "-output", |
| 1032 rebase_path(outputs[0], root_build_dir), |
| 1033 ] + rebase_path(inputs, root_build_dir) |
| 1034 |
| 1035 if (enable_dsyms) { |
| 1036 _dsyms_dir = "$root_out_dir/$_output_name.dSYM/" |
| 1037 outputs += [ |
| 1038 "$_dsyms_dir/", |
| 1039 "$_dsyms_dir/Contents/Info.plist", |
| 1040 "$_dsyms_dir/Contents/Resources/DWARF/$_output_name", |
1049 ] | 1041 ] |
1050 inputs = [ | 1042 args += |
1051 "$_arch_shared_library_dir/$_output_name", | 1043 [ "-Wcrl,dsym," + rebase_path("$root_out_dir/.", root_build_dir) ] |
1052 ] | 1044 } |
1053 deps = [ | |
1054 ":$_link_shared_library_target", | |
1055 ] | |
1056 foreach(_additional_toolchain, additional_toolchains) { | |
1057 _additional_toolchain_target = "$_target_name($_additional_toolchain)" | |
1058 deps += [ ":$_additional_toolchain_target" ] | |
1059 inputs += [ get_label_info(_additional_toolchain_target, | |
1060 "target_out_dir") + "/$_output_name" ] | |
1061 } | |
1062 args = [ | |
1063 "xcrun", | |
1064 "lipo", | |
1065 "-create", | |
1066 "-output", | |
1067 rebase_path(outputs[0], root_build_dir), | |
1068 ] + rebase_path(inputs, root_build_dir) | |
1069 | 1045 |
1070 if (enable_dsyms) { | 1046 if (enable_stripping) { |
1071 _dsyms_dir = "$root_out_dir/$_output_name.dSYM/" | 1047 # Check whether //build/config/mac:strip_all has been removed from |
1072 outputs += [ | 1048 # the configs variable (as this is how stripping is disabled for a |
1073 "$_dsyms_dir/", | 1049 # single target). |
1074 "$_dsyms_dir/Contents/Info.plist", | 1050 _strip_all_in_config = false |
1075 "$_dsyms_dir/Contents/Resources/DWARF/$_output_name", | 1051 if (defined(invoker.configs)) { |
1076 ] | 1052 foreach(_config, invoker.configs) { |
1077 args += | 1053 if (_config == "//build/config/mac:strip_all") { |
1078 [ "-Wcrl,dsym," + rebase_path("$root_out_dir/.", root_build_dir) ] | 1054 _strip_all_in_config = true |
1079 } | |
1080 | |
1081 if (enable_stripping) { | |
1082 # Check whether //build/config/mac:strip_all has been removed from | |
1083 # the configs variable (as this is how stripping is disabled for a | |
1084 # single target). | |
1085 _strip_all_in_config = false | |
1086 if (defined(invoker.configs)) { | |
1087 foreach(_config, invoker.configs) { | |
1088 if (_config == "//build/config/mac:strip_all") { | |
1089 _strip_all_in_config = true | |
1090 } | |
1091 } | |
1092 } | |
1093 | |
1094 if (_strip_all_in_config) { | |
1095 args += [ "-Wcrl,strip,-x,-S" ] | |
1096 | |
1097 if (save_unstripped_output) { | |
1098 outputs += [ outputs[0] + ".unstripped" ] | |
1099 args += [ "-Wcrl,unstripped," + | |
1100 rebase_path(get_path_info(outputs[0], "dir"), | |
1101 root_build_dir) ] | |
1102 } | 1055 } |
1103 } | 1056 } |
1104 } | 1057 } |
| 1058 |
| 1059 if (_strip_all_in_config) { |
| 1060 args += [ "-Wcrl,strip,-x,-S" ] |
| 1061 |
| 1062 if (save_unstripped_output) { |
| 1063 outputs += [ outputs[0] + ".unstripped" ] |
| 1064 args += [ "-Wcrl,unstripped," + |
| 1065 rebase_path(get_path_info(outputs[0], "dir"), |
| 1066 root_build_dir) ] |
| 1067 } |
| 1068 } |
1105 } | 1069 } |
1106 } | 1070 } |
1107 | 1071 |
1108 _framework_public_config = _target_name + "_public_config" | 1072 _framework_public_config = _target_name + "_public_config" |
1109 config(_framework_public_config) { | 1073 config(_framework_public_config) { |
1110 # TODO(sdefresne): should we have a framework_dirs similar to lib_dirs | 1074 # TODO(sdefresne): should we have a framework_dirs similar to lib_dirs |
1111 # and include_dirs to avoid duplicate values on the command-line. | 1075 # and include_dirs to avoid duplicate values on the command-line. |
1112 visibility = [ ":$_framework_target" ] | 1076 visibility = [ ":$_framework_target" ] |
1113 ldflags = [ | 1077 ldflags = [ |
1114 "-F", | 1078 "-F", |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 deps += invoker.bundle_deps | 1138 deps += invoker.bundle_deps |
1175 } | 1139 } |
1176 | 1140 |
1177 bundle_root_dir = _framework_root_dir | 1141 bundle_root_dir = _framework_root_dir |
1178 bundle_resources_dir = "$bundle_root_dir/Resources" | 1142 bundle_resources_dir = "$bundle_root_dir/Resources" |
1179 bundle_executable_dir = "$bundle_root_dir" | 1143 bundle_executable_dir = "$bundle_root_dir" |
1180 | 1144 |
1181 if (!defined(deps)) { | 1145 if (!defined(deps)) { |
1182 deps = [] | 1146 deps = [] |
1183 } | 1147 } |
1184 | 1148 deps += [ ":$_lipo_shared_library_target" ] |
1185 if (_is_fat_build) { | |
1186 deps += [ ":$_lipo_shared_library_target" ] | |
1187 } else { | |
1188 deps += [ ":$_link_shared_library_target" ] | |
1189 } | |
1190 | 1149 |
1191 _entitlements_path = _default_entitlements_path | 1150 _entitlements_path = _default_entitlements_path |
1192 if (defined(invoker.entitlements_path)) { | 1151 if (defined(invoker.entitlements_path)) { |
1193 _entitlements_path = invoker.entitlements_path | 1152 _entitlements_path = invoker.entitlements_path |
1194 } | 1153 } |
1195 | 1154 |
1196 code_signing_script = _code_signing_script_path | 1155 code_signing_script = _code_signing_script_path |
1197 code_signing_sources = [ | 1156 code_signing_sources = [ |
1198 _entitlements_path, | 1157 _entitlements_path, |
1199 "$_shared_library_dir/$_output_name", | 1158 "$_shared_library_dir/$_output_name", |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 if (defined(invoker.output_name)) { | 1256 if (defined(invoker.output_name)) { |
1298 _output_name = invoker.output_name | 1257 _output_name = invoker.output_name |
1299 } | 1258 } |
1300 | 1259 |
1301 _xctest_target = _target_name | 1260 _xctest_target = _target_name |
1302 _xctest_output = _output_name | 1261 _xctest_output = _output_name |
1303 | 1262 |
1304 _host_target = _target_name + "_host" | 1263 _host_target = _target_name + "_host" |
1305 _host_output = _output_name + "_host" | 1264 _host_output = _output_name + "_host" |
1306 | 1265 |
1307 if (_is_fat_build && !_is_fat_build_main_target) { | 1266 if (_is_secondary_build) { |
1308 loadable_module(_xctest_target) { | 1267 loadable_module(_xctest_target) { |
1309 visibility = [ ":${_xctest_target}_loadable_module($default_toolchain)" ] | 1268 visibility = [ ":${_xctest_target}_loadable_module($default_toolchain)" ] |
1310 sources = [ | 1269 sources = [ |
1311 "//build/config/ios/xctest_shell.mm", | 1270 "//build/config/ios/xctest_shell.mm", |
1312 ] | 1271 ] |
1313 configs += [ "//build/config/ios:xctest_config" ] | 1272 configs += [ "//build/config/ios:xctest_config" ] |
1314 | 1273 |
1315 output_name = _xctest_output | 1274 output_name = _xctest_output |
1316 output_extension = "" | 1275 output_extension = "" |
1317 } | 1276 } |
(...skipping 10 matching lines...) Expand all Loading... |
1328 visibility = [ ":$_xctest_target" ] | 1287 visibility = [ ":$_xctest_target" ] |
1329 public_deps = [ | 1288 public_deps = [ |
1330 ":$_xctest_info_plist_target", | 1289 ":$_xctest_info_plist_target", |
1331 ] | 1290 ] |
1332 sources = get_target_outputs(":$_xctest_info_plist_target") | 1291 sources = get_target_outputs(":$_xctest_info_plist_target") |
1333 outputs = [ | 1292 outputs = [ |
1334 "{{bundle_root_dir}}/Info.plist", | 1293 "{{bundle_root_dir}}/Info.plist", |
1335 ] | 1294 ] |
1336 } | 1295 } |
1337 | 1296 |
1338 _xctest_loadable_module_target = _xctest_target + "_loadable_module" | 1297 _xctest_loadable_module_target = _xctest_target + "_arch_loadable_module" |
1339 _xctest_loadable_module_visibility = [ ":$_xctest_target" ] | 1298 _xctest_lipo_loadable_module_target = _xctest_target + "_loadable_module" |
1340 | 1299 |
1341 if (_is_fat_build) { | 1300 _xctest_loadable_module_visibility = |
1342 _xctest_lipo_loadable_module_target = _xctest_loadable_module_target | 1301 [ ":$_xctest_lipo_loadable_module_target" ] |
1343 _xctest_lipo_loadable_module_visibility = | 1302 _xctest_lipo_loadable_module_visibility = [ ":$_xctest_target" ] |
1344 _xctest_loadable_module_visibility | |
1345 | |
1346 _xctest_loadable_module_visibility = [] | |
1347 _xctest_loadable_module_visibility = | |
1348 [ ":$_xctest_lipo_loadable_module_target" ] | |
1349 _xctest_loadable_module_target = _xctest_target + "_arch_loadable_module" | |
1350 } | |
1351 | 1303 |
1352 loadable_module(_xctest_loadable_module_target) { | 1304 loadable_module(_xctest_loadable_module_target) { |
1353 visibility = _xctest_loadable_module_visibility | 1305 visibility = _xctest_loadable_module_visibility |
1354 sources = [ | 1306 sources = [ |
1355 "//build/config/ios/xctest_shell.mm", | 1307 "//build/config/ios/xctest_shell.mm", |
1356 ] | 1308 ] |
1357 configs += [ "//build/config/ios:xctest_config" ] | 1309 configs += [ "//build/config/ios:xctest_config" ] |
1358 | 1310 |
1359 if (_is_fat_build) { | 1311 output_dir = "$target_out_dir/$current_cpu" |
1360 output_dir = "$target_out_dir/$current_cpu" | |
1361 } else { | |
1362 output_dir = target_out_dir | |
1363 } | |
1364 | |
1365 output_name = _xctest_output | 1312 output_name = _xctest_output |
1366 output_prefix_override = true | 1313 output_prefix_override = true |
1367 output_extension = "" | 1314 output_extension = "" |
1368 } | 1315 } |
1369 | 1316 |
1370 if (_is_fat_build) { | 1317 action(_xctest_lipo_loadable_module_target) { |
1371 action(_xctest_lipo_loadable_module_target) { | 1318 visibility = _xctest_lipo_loadable_module_visibility |
1372 visibility = _xctest_lipo_loadable_module_visibility | 1319 script = "//build/toolchain/mac/linker_driver.py" |
1373 script = "//build/toolchain/mac/linker_driver.py" | 1320 outputs = [ |
1374 outputs = [ | 1321 "$target_out_dir/$_xctest_output", |
1375 "$target_out_dir/$_xctest_output", | 1322 ] |
| 1323 inputs = [ |
| 1324 "$target_out_dir/$current_cpu/$_xctest_output", |
| 1325 ] |
| 1326 deps = [ |
| 1327 ":$_xctest_loadable_module_target", |
| 1328 ] |
| 1329 foreach(_additional_toolchain, additional_toolchains) { |
| 1330 _additional_toolchain_target = "$_target_name($_additional_toolchain)" |
| 1331 deps += [ ":$_additional_toolchain_target" ] |
| 1332 inputs += [ get_label_info(_additional_toolchain_target, |
| 1333 "root_out_dir") + "/$_xctest_output" ] |
| 1334 } |
| 1335 args = [ |
| 1336 "xcrun", |
| 1337 "lipo", |
| 1338 "-create", |
| 1339 "-output", |
| 1340 rebase_path(outputs[0], root_build_dir), |
| 1341 ] + rebase_path(inputs, root_build_dir) |
| 1342 |
| 1343 if (enable_dsyms) { |
| 1344 _dsyms_dir = "$root_out_dir/$_output_name.dSYM/" |
| 1345 outputs += [ |
| 1346 "$_dsyms_dir/", |
| 1347 "$_dsyms_dir/Contents/Info.plist", |
| 1348 "$_dsyms_dir/Contents/Resources/DWARF/$_output_name", |
1376 ] | 1349 ] |
1377 inputs = [ | 1350 args += |
1378 "$target_out_dir/$current_cpu/$_xctest_output", | 1351 [ "-Wcrl,dsym," + rebase_path("$root_out_dir/.", root_build_dir) ] |
1379 ] | 1352 } |
1380 deps = [ | |
1381 ":$_xctest_loadable_module_target", | |
1382 ] | |
1383 foreach(_additional_toolchain, additional_toolchains) { | |
1384 _additional_toolchain_target = "$_target_name($_additional_toolchain)" | |
1385 deps += [ ":$_additional_toolchain_target" ] | |
1386 inputs += [ get_label_info(_additional_toolchain_target, | |
1387 "root_out_dir") + "/$_xctest_output" ] | |
1388 } | |
1389 args = [ | |
1390 "xcrun", | |
1391 "lipo", | |
1392 "-create", | |
1393 "-output", | |
1394 rebase_path(outputs[0], root_build_dir), | |
1395 ] + rebase_path(inputs, root_build_dir) | |
1396 | 1353 |
1397 if (enable_dsyms) { | 1354 if (enable_stripping) { |
1398 _dsyms_dir = "$root_out_dir/$_output_name.dSYM/" | 1355 # Check whether //build/config/mac:strip_all has been removed from |
1399 outputs += [ | 1356 # the configs variable (as this is how stripping is disabled for a |
1400 "$_dsyms_dir/", | 1357 # single target). |
1401 "$_dsyms_dir/Contents/Info.plist", | 1358 _strip_all_in_config = false |
1402 "$_dsyms_dir/Contents/Resources/DWARF/$_output_name", | 1359 if (defined(invoker.configs)) { |
1403 ] | 1360 foreach(_config, invoker.configs) { |
1404 args += | 1361 if (_config == "//build/config/mac:strip_all") { |
1405 [ "-Wcrl,dsym," + rebase_path("$root_out_dir/.", root_build_dir) ] | 1362 _strip_all_in_config = true |
1406 } | |
1407 | |
1408 if (enable_stripping) { | |
1409 # Check whether //build/config/mac:strip_all has been removed from | |
1410 # the configs variable (as this is how stripping is disabled for a | |
1411 # single target). | |
1412 _strip_all_in_config = false | |
1413 if (defined(invoker.configs)) { | |
1414 foreach(_config, invoker.configs) { | |
1415 if (_config == "//build/config/mac:strip_all") { | |
1416 _strip_all_in_config = true | |
1417 } | |
1418 } | |
1419 } | |
1420 | |
1421 if (_strip_all_in_config) { | |
1422 args += [ "-Wcrl,strip,-x,-S" ] | |
1423 | |
1424 if (save_unstripped_output) { | |
1425 outputs += [ outputs[0] + ".unstripped" ] | |
1426 args += [ "-Wcrl,unstripped," + | |
1427 rebase_path(get_path_info(outputs[0], "dir"), | |
1428 root_build_dir) ] | |
1429 } | 1363 } |
1430 } | 1364 } |
1431 } | 1365 } |
| 1366 |
| 1367 if (_strip_all_in_config) { |
| 1368 args += [ "-Wcrl,strip,-x,-S" ] |
| 1369 |
| 1370 if (save_unstripped_output) { |
| 1371 outputs += [ outputs[0] + ".unstripped" ] |
| 1372 args += [ "-Wcrl,unstripped," + |
| 1373 rebase_path(get_path_info(outputs[0], "dir"), |
| 1374 root_build_dir) ] |
| 1375 } |
| 1376 } |
1432 } | 1377 } |
1433 } | 1378 } |
1434 | 1379 |
1435 _xctest_bundle = _xctest_target + "_bundle" | 1380 _xctest_bundle = _xctest_target + "_bundle" |
1436 | 1381 |
1437 create_bundle(_xctest_target) { | 1382 create_bundle(_xctest_target) { |
1438 visibility = [ ":$_xctest_bundle" ] | 1383 visibility = [ ":$_xctest_bundle" ] |
1439 product_type = "com.apple.product-type.bundle.unit-test" | 1384 product_type = "com.apple.product-type.bundle.unit-test" |
1440 deps = [ | 1385 deps = [ |
1441 ":$_xctest_info_plist_bundle", | 1386 ":$_xctest_info_plist_bundle", |
| 1387 ":$_xctest_lipo_loadable_module_target", |
1442 ] | 1388 ] |
1443 bundle_root_dir = "$root_out_dir/$_xctest_output.xctest" | 1389 bundle_root_dir = "$root_out_dir/$_xctest_output.xctest" |
1444 | 1390 |
1445 if (_is_fat_build) { | |
1446 deps += [ ":$_xctest_lipo_loadable_module_target" ] | |
1447 } else { | |
1448 deps += [ ":$_xctest_loadable_module_target" ] | |
1449 } | |
1450 | |
1451 _entitlements_path = _default_entitlements_path | 1391 _entitlements_path = _default_entitlements_path |
1452 if (defined(invoker.entitlements_path)) { | 1392 if (defined(invoker.entitlements_path)) { |
1453 _entitlements_path = invoker.entitlements_path | 1393 _entitlements_path = invoker.entitlements_path |
1454 } | 1394 } |
1455 | 1395 |
1456 code_signing_script = _code_signing_script_path | 1396 code_signing_script = _code_signing_script_path |
1457 code_signing_sources = [ | 1397 code_signing_sources = [ |
1458 _entitlements_path, | 1398 _entitlements_path, |
1459 "$target_out_dir/$_xctest_output", | 1399 "$target_out_dir/$_xctest_output", |
1460 ] | 1400 ] |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 } | 1444 } |
1505 | 1445 |
1506 # Xcode needs those two framework installed in the application (and signed) | 1446 # Xcode needs those two framework installed in the application (and signed) |
1507 # for the XCTest to run, so install them using extra_system_frameworks. | 1447 # for the XCTest to run, so install them using extra_system_frameworks. |
1508 _ios_platform_library = "$ios_sdk_platform_path/Developer/Library" | 1448 _ios_platform_library = "$ios_sdk_platform_path/Developer/Library" |
1509 extra_system_frameworks = [ | 1449 extra_system_frameworks = [ |
1510 "$_ios_platform_library/Frameworks/XCTest.framework", | 1450 "$_ios_platform_library/Frameworks/XCTest.framework", |
1511 "$_ios_platform_library/PrivateFrameworks/IDEBundleInjection.framework", | 1451 "$_ios_platform_library/PrivateFrameworks/IDEBundleInjection.framework", |
1512 ] | 1452 ] |
1513 | 1453 |
1514 if (!_is_fat_build || _is_fat_build_main_target) { | 1454 if (!_is_secondary_build) { |
1515 if (!defined(bundle_deps)) { | 1455 if (!defined(bundle_deps)) { |
1516 bundle_deps = [] | 1456 bundle_deps = [] |
1517 } | 1457 } |
1518 bundle_deps += [ ":$_xctest_bundle" ] | 1458 bundle_deps += [ ":$_xctest_bundle" ] |
1519 } | 1459 } |
1520 | 1460 |
1521 if (!defined(ldflags)) { | 1461 if (!defined(ldflags)) { |
1522 ldflags = [] | 1462 ldflags = [] |
1523 } | 1463 } |
1524 ldflags += [ | 1464 ldflags += [ |
1525 "-Xlinker", | 1465 "-Xlinker", |
1526 "-rpath", | 1466 "-rpath", |
1527 "-Xlinker", | 1467 "-Xlinker", |
1528 "@executable_path/Frameworks", | 1468 "@executable_path/Frameworks", |
1529 "-Xlinker", | 1469 "-Xlinker", |
1530 "-rpath", | 1470 "-rpath", |
1531 "-Xlinker", | 1471 "-Xlinker", |
1532 "@loader_path/Frameworks", | 1472 "@loader_path/Frameworks", |
1533 ] | 1473 ] |
1534 } | 1474 } |
1535 } | 1475 } |
1536 | 1476 |
1537 set_defaults("ios_xctest_test") { | 1477 set_defaults("ios_xctest_test") { |
1538 configs = default_executable_configs | 1478 configs = default_executable_configs |
1539 } | 1479 } |
OLD | NEW |