| 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 _toolchain_suffix = "" | |
| 10 _is_fat_build = additional_toolchains != [] | 9 _is_fat_build = additional_toolchains != [] |
| 11 if (_is_fat_build) { | 10 if (_is_fat_build) { |
| 12 _toolchain_suffix = "($default_toolchain)" | |
| 13 _is_fat_build_main_target = current_toolchain == default_toolchain | 11 _is_fat_build_main_target = current_toolchain == default_toolchain |
| 14 } | 12 } |
| 15 | 13 |
| 14 if (use_ios_simulator || ios_enable_code_signing) { |
| 15 _default_entitlements_path = "//build/config/ios/entitlements.plist" |
| 16 } |
| 17 |
| 16 # Generates Info.plist files for Mac apps and frameworks. | 18 # Generates Info.plist files for Mac apps and frameworks. |
| 17 # | 19 # |
| 18 # Arguments | 20 # Arguments |
| 19 # | 21 # |
| 20 # info_plist: | 22 # info_plist: |
| 21 # (optional) string, path to the Info.plist file that will be used for | 23 # (optional) string, path to the Info.plist file that will be used for |
| 22 # the bundle. | 24 # the bundle. |
| 23 # | 25 # |
| 24 # info_plist_target: | 26 # info_plist_target: |
| 25 # (optional) string, if the info_plist is generated from an action, | 27 # (optional) string, if the info_plist is generated from an action, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 # The rest of the build, including the codesigning step, are the same for | 155 # The rest of the build, including the codesigning step, are the same for |
| 154 # thin and fat builds. | 156 # thin and fat builds. |
| 155 | 157 |
| 156 _executable_extra_deps = [] | 158 _executable_extra_deps = [] |
| 157 _executable_extra_inputs = [] | 159 _executable_extra_inputs = [] |
| 158 _executable_extra_ldflags = [] | 160 _executable_extra_ldflags = [] |
| 159 | 161 |
| 160 # Embeds the entitlements file if building for simulator. This is optional | 162 # Embeds the entitlements file if building for simulator. This is optional |
| 161 # with Xcode 7 or older but required with Xcode 8. This is not necessary for | 163 # with Xcode 7 or older but required with Xcode 8. This is not necessary for |
| 162 # device build as the entitlement is embedded via the codesigning step. | 164 # device build as the entitlement is embedded via the codesigning step. |
| 163 # | |
| 164 # As the generation of the entitlement depends on the | |
| 165 if (use_ios_simulator) { | 165 if (use_ios_simulator) { |
| 166 _generate_entitlements_target = _target_name + "_gen_entitlements" | 166 _generate_entitlements_target = _target_name + "_gen_entitlements" |
| 167 _generate_entitlements_target_with_toolchain_suffix = | 167 _generate_entitlements_target_with_toolchain_suffix = |
| 168 "$_generate_entitlements_target$_toolchain_suffix" | 168 "$_generate_entitlements_target($default_toolchain)" |
| 169 | 169 |
| 170 _generate_entitlements_output = | 170 _generate_entitlements_output = |
| 171 get_label_info(_generate_entitlements_target_with_toolchain_suffix, | 171 get_label_info(_generate_entitlements_target_with_toolchain_suffix, |
| 172 "target_gen_dir") + "/$_output_name.xcent" | 172 "target_gen_dir") + "/$_output_name.xcent" |
| 173 | 173 |
| 174 _executable_extra_inputs += [ _generate_entitlements_output ] | 174 _executable_extra_inputs += [ _generate_entitlements_output ] |
| 175 _executable_extra_deps += | 175 _executable_extra_deps += |
| 176 [ ":$_generate_entitlements_target_with_toolchain_suffix" ] | 176 [ ":$_generate_entitlements_target_with_toolchain_suffix" ] |
| 177 _executable_extra_ldflags += [ | 177 _executable_extra_ldflags += [ |
| 178 "-Xlinker", | 178 "-Xlinker", |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 libs += [ "UIKit.framework" ] | 231 libs += [ "UIKit.framework" ] |
| 232 } | 232 } |
| 233 } else { | 233 } else { |
| 234 # This is either a thin build or the default toolchain of a fat-build. | 234 # This is either a thin build or the default toolchain of a fat-build. |
| 235 # The template will expand in many different target ($target_name is the | 235 # The template will expand in many different target ($target_name is the |
| 236 # create_bundle target) used as input to the create_bundle target. | 236 # create_bundle target) used as input to the create_bundle target. |
| 237 _generate_info_plist = target_name + "_generate_info_plist" | 237 _generate_info_plist = target_name + "_generate_info_plist" |
| 238 _bundle_data_info_plist = target_name + "_bundle_data_info_plist" | 238 _bundle_data_info_plist = target_name + "_bundle_data_info_plist" |
| 239 | 239 |
| 240 if (use_ios_simulator || ios_enable_code_signing) { | 240 if (use_ios_simulator || ios_enable_code_signing) { |
| 241 _entitlements_path = "//build/config/ios/entitlements.plist" | 241 _entitlements_path = _default_entitlements_path |
| 242 if (defined(invoker.entitlements_path)) { | 242 if (defined(invoker.entitlements_path)) { |
| 243 _entitlements_path = invoker.entitlements_path | 243 _entitlements_path = invoker.entitlements_path |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 ios_info_plist(_generate_info_plist) { | 247 ios_info_plist(_generate_info_plist) { |
| 248 visibility = [ ":$_bundle_data_info_plist" ] | 248 visibility = [ ":$_bundle_data_info_plist" ] |
| 249 if (use_ios_simulator) { | 249 if (use_ios_simulator) { |
| 250 visibility += [ ":$_generate_entitlements_target" ] | 250 visibility += [ ":$_generate_entitlements_target" ] |
| 251 } | 251 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 281 _gen_info_plist_target, | 281 _gen_info_plist_target, |
| 282 ] | 282 ] |
| 283 sources = [ | 283 sources = [ |
| 284 _entitlements_path, | 284 _entitlements_path, |
| 285 _info_plist_path, | 285 _info_plist_path, |
| 286 ] | 286 ] |
| 287 outputs = [ | 287 outputs = [ |
| 288 _generate_entitlements_output, | 288 _generate_entitlements_output, |
| 289 ] | 289 ] |
| 290 args = [ | 290 args = [ |
| 291 "generate-entitlements", |
| 291 "-e=" + rebase_path(_entitlements_path, root_build_dir), | 292 "-e=" + rebase_path(_entitlements_path, root_build_dir), |
| 292 "generate-entitlements", | |
| 293 "-p=" + rebase_path(_info_plist_path, root_build_dir), | 293 "-p=" + rebase_path(_info_plist_path, root_build_dir), |
| 294 ] + rebase_path(outputs, root_build_dir) | 294 ] + rebase_path(outputs, root_build_dir) |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 _link_executable = _target_name + "_executable" | 298 _link_executable = _target_name + "_executable" |
| 299 | 299 |
| 300 if (ios_enable_code_signing) { | 300 if (ios_enable_code_signing) { |
| 301 _link_executable_visibility = [ ":$_target_name" ] | 301 _link_executable_visibility = [ ":$_target_name" ] |
| 302 } else { | 302 } else { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 535 |
| 536 if (ios_enable_code_signing) { | 536 if (ios_enable_code_signing) { |
| 537 code_signing_script = "//build/config/ios/codesign.py" | 537 code_signing_script = "//build/config/ios/codesign.py" |
| 538 code_signing_sources = [ | 538 code_signing_sources = [ |
| 539 _entitlements_path, | 539 _entitlements_path, |
| 540 "$target_out_dir/$_output_name", | 540 "$target_out_dir/$_output_name", |
| 541 ] | 541 ] |
| 542 code_signing_outputs = [ | 542 code_signing_outputs = [ |
| 543 "$bundle_root_dir/$_output_name", | 543 "$bundle_root_dir/$_output_name", |
| 544 "$bundle_root_dir/_CodeSignature/CodeResources", | 544 "$bundle_root_dir/_CodeSignature/CodeResources", |
| 545 "$bundle_root_dir/embedded.mobileprovision", | |
| 546 ] | 545 ] |
| 546 if (ios_code_signing_identity != "") { |
| 547 code_signing_outputs += |
| 548 [ "$bundle_root_dir/embedded.mobileprovision" ] |
| 549 } |
| 547 if (defined(invoker.extra_system_frameworks)) { | 550 if (defined(invoker.extra_system_frameworks)) { |
| 548 foreach(_framework, invoker.extra_system_frameworks) { | 551 foreach(_framework, invoker.extra_system_frameworks) { |
| 549 code_signing_outputs += [ "$bundle_root_dir/Frameworks/" + | 552 code_signing_outputs += [ "$bundle_root_dir/Frameworks/" + |
| 550 get_path_info(_framework, "file") ] | 553 get_path_info(_framework, "file") ] |
| 551 } | 554 } |
| 552 } | 555 } |
| 553 code_signing_args = [ | 556 code_signing_args = [ |
| 554 "-e=" + rebase_path(_entitlements_path, root_build_dir), | |
| 555 "code-sign-bundle", | 557 "code-sign-bundle", |
| 556 "-i=" + ios_code_signing_identity, | 558 "-i=" + ios_code_signing_identity, |
| 559 "-e=" + rebase_path(_entitlements_path, root_build_dir), |
| 557 "-b=" + rebase_path("$target_out_dir/$_output_name", root_build_dir), | 560 "-b=" + rebase_path("$target_out_dir/$_output_name", root_build_dir), |
| 558 rebase_path(bundle_root_dir, root_build_dir), | 561 rebase_path(bundle_root_dir, root_build_dir), |
| 559 ] | 562 ] |
| 560 if (defined(invoker.extra_system_frameworks)) { | 563 if (defined(invoker.extra_system_frameworks)) { |
| 561 # All framework in extra_system_frameworks are expected to be | 564 # All framework in extra_system_frameworks are expected to be |
| 562 # system framework and the path to be already system absolute | 565 # system framework and the path to be already system absolute |
| 563 # so do not use rebase_path here. | 566 # so do not use rebase_path here. |
| 564 foreach(_framework, invoker.extra_system_frameworks) { | 567 foreach(_framework, invoker.extra_system_frameworks) { |
| 565 code_signing_args += [ "-F=" + _framework ] | 568 code_signing_args += [ "-F=" + _framework ] |
| 566 } | 569 } |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 if (defined(visibility)) { | 916 if (defined(visibility)) { |
| 914 visibility += [ ":${_target_name}_shared_library($default_toolchain)" ] | 917 visibility += [ ":${_target_name}_shared_library($default_toolchain)" ] |
| 915 } | 918 } |
| 916 output_name = _output_name | 919 output_name = _output_name |
| 917 output_prefix_override = true | 920 output_prefix_override = true |
| 918 output_extension = "" | 921 output_extension = "" |
| 919 output_dir = "$target_out_dir/$_target_name" | 922 output_dir = "$target_out_dir/$_target_name" |
| 920 | 923 |
| 921 if (_has_public_headers) { | 924 if (_has_public_headers) { |
| 922 configs += [ | 925 configs += [ |
| 923 ":$_framework_headers_config$_toolchain_suffix", | 926 ":$_framework_headers_config($default_toolchain)", |
| 924 ":$_headers_map_config$_toolchain_suffix", | 927 ":$_headers_map_config($default_toolchain)", |
| 925 ] | 928 ] |
| 926 | 929 |
| 927 if (!defined(deps)) { | 930 if (!defined(deps)) { |
| 928 deps = [] | 931 deps = [] |
| 929 } | 932 } |
| 930 deps += [ ":$_framework_headers_target$_toolchain_suffix" ] | 933 deps += [ ":$_framework_headers_target($default_toolchain)" ] |
| 931 } | 934 } |
| 932 } | 935 } |
| 933 | 936 |
| 934 group(_target_name + "+link") { | 937 group(_target_name + "+link") { |
| 935 forward_variables_from(invoker, | 938 forward_variables_from(invoker, |
| 936 [ | 939 [ |
| 937 "visibility", | 940 "visibility", |
| 938 "testonly", | 941 "testonly", |
| 939 ]) | 942 ]) |
| 940 public_deps = [ | 943 public_deps = [ |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 output_prefix_override = true | 1088 output_prefix_override = true |
| 1086 output_extension = "" | 1089 output_extension = "" |
| 1087 | 1090 |
| 1088 if (!_is_fat_build) { | 1091 if (!_is_fat_build) { |
| 1089 output_dir = _shared_library_dir | 1092 output_dir = _shared_library_dir |
| 1090 } else { | 1093 } else { |
| 1091 output_dir = _arch_shared_library_dir | 1094 output_dir = _arch_shared_library_dir |
| 1092 } | 1095 } |
| 1093 | 1096 |
| 1094 if (_has_public_headers) { | 1097 if (_has_public_headers) { |
| 1095 configs += [ ":$_headers_map_config$_toolchain_suffix" ] | 1098 configs += [ ":$_headers_map_config($default_toolchain)" ] |
| 1096 | 1099 |
| 1097 if (!defined(deps)) { | 1100 if (!defined(deps)) { |
| 1098 deps = [] | 1101 deps = [] |
| 1099 } | 1102 } |
| 1100 deps += [ ":$_framework_headers_target$_toolchain_suffix" ] | 1103 deps += [ ":$_framework_headers_target($default_toolchain)" ] |
| 1101 } | 1104 } |
| 1102 } | 1105 } |
| 1103 | 1106 |
| 1104 if (_is_fat_build) { | 1107 if (_is_fat_build) { |
| 1105 action(_lipo_shared_library_target) { | 1108 action(_lipo_shared_library_target) { |
| 1106 forward_variables_from(invoker, [ "testonly" ]) | 1109 forward_variables_from(invoker, [ "testonly" ]) |
| 1107 visibility = _lipo_shared_library_visibility | 1110 visibility = _lipo_shared_library_visibility |
| 1108 script = "//build/toolchain/mac/linker_driver.py" | 1111 script = "//build/toolchain/mac/linker_driver.py" |
| 1109 outputs = [ | 1112 outputs = [ |
| 1110 "$_shared_library_dir/$_output_name", | 1113 "$_shared_library_dir/$_output_name", |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 if (!defined(deps)) { | 1276 if (!defined(deps)) { |
| 1274 deps = [] | 1277 deps = [] |
| 1275 } | 1278 } |
| 1276 | 1279 |
| 1277 if (_is_fat_build) { | 1280 if (_is_fat_build) { |
| 1278 deps += [ ":$_lipo_shared_library_target" ] | 1281 deps += [ ":$_lipo_shared_library_target" ] |
| 1279 } else { | 1282 } else { |
| 1280 deps += [ ":$_link_shared_library_target" ] | 1283 deps += [ ":$_link_shared_library_target" ] |
| 1281 } | 1284 } |
| 1282 | 1285 |
| 1283 _entitlements_path = "//build/config/ios/entitlements.plist" | 1286 _entitlements_path = _default_entitlements_path |
| 1284 if (defined(invoker.entitlements_path)) { | 1287 if (defined(invoker.entitlements_path)) { |
| 1285 _entitlements_path = invoker.entitlements_path | 1288 _entitlements_path = invoker.entitlements_path |
| 1286 } | 1289 } |
| 1287 | 1290 |
| 1288 code_signing_script = "//build/config/ios/codesign.py" | 1291 code_signing_script = "//build/config/ios/codesign.py" |
| 1289 code_signing_sources = [ | 1292 code_signing_sources = [ |
| 1290 _entitlements_path, | 1293 _entitlements_path, |
| 1291 "$_shared_library_dir/$_output_name", | 1294 "$_shared_library_dir/$_output_name", |
| 1292 ] | 1295 ] |
| 1293 code_signing_outputs = [ | 1296 code_signing_outputs = [ |
| 1294 "$bundle_root_dir/$_output_name", | 1297 "$bundle_root_dir/$_output_name", |
| 1295 "$bundle_root_dir/_CodeSignature/CodeResources", | 1298 "$bundle_root_dir/_CodeSignature/CodeResources", |
| 1296 "$bundle_root_dir/embedded.mobileprovision", | |
| 1297 ] | 1299 ] |
| 1300 if (ios_code_signing_identity != "") { |
| 1301 code_signing_outputs += |
| 1302 [ "$bundle_root_dir/embedded.mobileprovision" ] |
| 1303 } |
| 1298 code_signing_args = [ | 1304 code_signing_args = [ |
| 1299 "-e=" + rebase_path(_entitlements_path, root_build_dir), | |
| 1300 "code-sign-bundle", | 1305 "code-sign-bundle", |
| 1301 "-i=" + ios_code_signing_identity, | 1306 "-i=" + ios_code_signing_identity, |
| 1307 "-e=" + rebase_path(_entitlements_path, root_build_dir), |
| 1302 "-b=" + | 1308 "-b=" + |
| 1303 rebase_path("$_shared_library_dir/$_output_name", root_build_dir), | 1309 rebase_path("$_shared_library_dir/$_output_name", root_build_dir), |
| 1304 rebase_path(bundle_root_dir, root_build_dir), | 1310 rebase_path(bundle_root_dir, root_build_dir), |
| 1305 ] | 1311 ] |
| 1306 } | 1312 } |
| 1307 } | 1313 } |
| 1308 | 1314 |
| 1309 if (defined(_framework_version)) { | 1315 if (defined(_framework_version)) { |
| 1310 action(_target_name) { | 1316 action(_target_name) { |
| 1311 forward_variables_from(invoker, [ "testonly" ]) | 1317 forward_variables_from(invoker, [ "testonly" ]) |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 | 1566 |
| 1561 if (!ios_enable_code_signing) { | 1567 if (!ios_enable_code_signing) { |
| 1562 deps += [ ":$_xctest_loadable_module_bundle" ] | 1568 deps += [ ":$_xctest_loadable_module_bundle" ] |
| 1563 } else { | 1569 } else { |
| 1564 if (_is_fat_build) { | 1570 if (_is_fat_build) { |
| 1565 deps += [ ":$_xctest_lipo_loadable_module_target" ] | 1571 deps += [ ":$_xctest_lipo_loadable_module_target" ] |
| 1566 } else { | 1572 } else { |
| 1567 deps += [ ":$_xctest_loadable_module_target" ] | 1573 deps += [ ":$_xctest_loadable_module_target" ] |
| 1568 } | 1574 } |
| 1569 | 1575 |
| 1570 _entitlements_path = "//build/config/ios/entitlements.plist" | 1576 _entitlements_path = _default_entitlements_path |
| 1571 if (defined(invoker.entitlements_path)) { | 1577 if (defined(invoker.entitlements_path)) { |
| 1572 _entitlements_path = invoker.entitlements_path | 1578 _entitlements_path = invoker.entitlements_path |
| 1573 } | 1579 } |
| 1574 | 1580 |
| 1575 code_signing_script = "//build/config/ios/codesign.py" | 1581 code_signing_script = "//build/config/ios/codesign.py" |
| 1576 code_signing_sources = [ | 1582 code_signing_sources = [ |
| 1577 _entitlements_path, | 1583 _entitlements_path, |
| 1578 "$target_out_dir/$_xctest_output", | 1584 "$target_out_dir/$_xctest_output", |
| 1579 ] | 1585 ] |
| 1580 code_signing_outputs = [ | 1586 code_signing_outputs = [ |
| 1581 "$bundle_root_dir/$_xctest_output", | 1587 "$bundle_root_dir/$_xctest_output", |
| 1582 "$bundle_root_dir/_CodeSignature/CodeResources", | 1588 "$bundle_root_dir/_CodeSignature/CodeResources", |
| 1583 "$bundle_root_dir/embedded.mobileprovision", | |
| 1584 ] | 1589 ] |
| 1590 if (ios_code_signing_identity != "") { |
| 1591 code_signing_outputs += |
| 1592 [ "$bundle_root_dir/embedded.mobileprovision" ] |
| 1593 } |
| 1585 code_signing_args = [ | 1594 code_signing_args = [ |
| 1586 "-e=" + rebase_path(_entitlements_path, root_build_dir), | |
| 1587 "code-sign-bundle", | 1595 "code-sign-bundle", |
| 1588 "-i=" + ios_code_signing_identity, | 1596 "-i=" + ios_code_signing_identity, |
| 1597 "-e=" + rebase_path(_entitlements_path, root_build_dir), |
| 1589 "-b=" + | 1598 "-b=" + |
| 1590 rebase_path("$target_out_dir/$_xctest_output", root_build_dir), | 1599 rebase_path("$target_out_dir/$_xctest_output", root_build_dir), |
| 1591 rebase_path(bundle_root_dir, root_build_dir), | 1600 rebase_path(bundle_root_dir, root_build_dir), |
| 1592 ] | 1601 ] |
| 1593 } | 1602 } |
| 1594 } | 1603 } |
| 1595 | 1604 |
| 1596 bundle_data(_xctest_bundle) { | 1605 bundle_data(_xctest_bundle) { |
| 1597 visibility = [ ":$_host_target" ] | 1606 visibility = [ ":$_host_target" ] |
| 1598 public_deps = [ | 1607 public_deps = [ |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1645 "-rpath", | 1654 "-rpath", |
| 1646 "-Xlinker", | 1655 "-Xlinker", |
| 1647 "@loader_path/Frameworks", | 1656 "@loader_path/Frameworks", |
| 1648 ] | 1657 ] |
| 1649 } | 1658 } |
| 1650 } | 1659 } |
| 1651 | 1660 |
| 1652 set_defaults("ios_xctest_test") { | 1661 set_defaults("ios_xctest_test") { |
| 1653 configs = default_executable_configs | 1662 configs = default_executable_configs |
| 1654 } | 1663 } |
| OLD | NEW |