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

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

Issue 2224553002: Refactor code signing script and template. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 != [] 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
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 libs += [ "UIKit.framework" ] 230 libs += [ "UIKit.framework" ]
231 } 231 }
232 } else { 232 } else {
233 # This is either a thin build or the default toolchain of a fat-build. 233 # This is either a thin build or the default toolchain of a fat-build.
234 # The template will expand in many different target ($target_name is the 234 # The template will expand in many different target ($target_name is the
235 # create_bundle target) used as input to the create_bundle target. 235 # create_bundle target) used as input to the create_bundle target.
236 _generate_info_plist = target_name + "_generate_info_plist" 236 _generate_info_plist = target_name + "_generate_info_plist"
237 _bundle_data_info_plist = target_name + "_bundle_data_info_plist" 237 _bundle_data_info_plist = target_name + "_bundle_data_info_plist"
238 238
239 if (use_ios_simulator || ios_enable_code_signing) { 239 if (use_ios_simulator || ios_enable_code_signing) {
240 _entitlements_path = "//build/config/ios/entitlements.plist" 240 _entitlements_path = _default_entitlements_path
241 if (defined(invoker.entitlements_path)) { 241 if (defined(invoker.entitlements_path)) {
242 _entitlements_path = invoker.entitlements_path 242 _entitlements_path = invoker.entitlements_path
243 } 243 }
244 } 244 }
245 245
246 ios_info_plist(_generate_info_plist) { 246 ios_info_plist(_generate_info_plist) {
247 visibility = [ ":$_bundle_data_info_plist" ] 247 visibility = [ ":$_bundle_data_info_plist" ]
248 if (use_ios_simulator) { 248 if (use_ios_simulator) {
249 visibility += [ ":$_generate_entitlements_target" ] 249 visibility += [ ":$_generate_entitlements_target" ]
250 } 250 }
(...skipping 29 matching lines...) Expand all
280 _gen_info_plist_target, 280 _gen_info_plist_target,
281 ] 281 ]
282 sources = [ 282 sources = [
283 _entitlements_path, 283 _entitlements_path,
284 _info_plist_path, 284 _info_plist_path,
285 ] 285 ]
286 outputs = [ 286 outputs = [
287 _generate_entitlements_output, 287 _generate_entitlements_output,
288 ] 288 ]
289 args = [ 289 args = [
290 "generate-entitlements",
290 "-e=" + rebase_path(_entitlements_path, root_build_dir), 291 "-e=" + rebase_path(_entitlements_path, root_build_dir),
291 "generate-entitlements",
292 "-p=" + rebase_path(_info_plist_path, root_build_dir), 292 "-p=" + rebase_path(_info_plist_path, root_build_dir),
293 ] + rebase_path(outputs, root_build_dir) 293 ] + rebase_path(outputs, root_build_dir)
294 } 294 }
295 } 295 }
296 296
297 _link_executable = _target_name + "_executable" 297 _link_executable = _target_name + "_executable"
298 298
299 if (ios_enable_code_signing) { 299 if (ios_enable_code_signing) {
300 _link_executable_visibility = [ ":$_target_name" ] 300 _link_executable_visibility = [ ":$_target_name" ]
301 } else { 301 } else {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 532
533 if (ios_enable_code_signing) { 533 if (ios_enable_code_signing) {
534 code_signing_script = "//build/config/ios/codesign.py" 534 code_signing_script = "//build/config/ios/codesign.py"
535 code_signing_sources = [ 535 code_signing_sources = [
536 _entitlements_path, 536 _entitlements_path,
537 "$target_out_dir/$_output_name", 537 "$target_out_dir/$_output_name",
538 ] 538 ]
539 code_signing_outputs = [ 539 code_signing_outputs = [
540 "$bundle_root_dir/$_output_name", 540 "$bundle_root_dir/$_output_name",
541 "$bundle_root_dir/_CodeSignature/CodeResources", 541 "$bundle_root_dir/_CodeSignature/CodeResources",
542 "$bundle_root_dir/embedded.mobileprovision",
543 ] 542 ]
543 if (ios_code_signing_identity != "") {
544 code_signing_outputs +=
545 [ "$bundle_root_dir/embedded.mobileprovision" ]
546 }
544 if (defined(invoker.extra_system_frameworks)) { 547 if (defined(invoker.extra_system_frameworks)) {
545 foreach(_framework, invoker.extra_system_frameworks) { 548 foreach(_framework, invoker.extra_system_frameworks) {
546 code_signing_outputs += [ "$bundle_root_dir/Frameworks/" + 549 code_signing_outputs += [ "$bundle_root_dir/Frameworks/" +
547 get_path_info(_framework, "file") ] 550 get_path_info(_framework, "file") ]
548 } 551 }
549 } 552 }
550 code_signing_args = [ 553 code_signing_args = [
551 "-e=" + rebase_path(_entitlements_path, root_build_dir),
552 "code-sign-bundle", 554 "code-sign-bundle",
553 "-i=" + ios_code_signing_identity, 555 "-i=" + ios_code_signing_identity,
556 "-e=" + rebase_path(_entitlements_path, root_build_dir),
554 "-b=" + rebase_path("$target_out_dir/$_output_name", root_build_dir), 557 "-b=" + rebase_path("$target_out_dir/$_output_name", root_build_dir),
555 rebase_path(bundle_root_dir, root_build_dir), 558 rebase_path(bundle_root_dir, root_build_dir),
556 ] 559 ]
557 if (defined(invoker.extra_system_frameworks)) { 560 if (defined(invoker.extra_system_frameworks)) {
558 # All framework in extra_system_frameworks are expected to be 561 # All framework in extra_system_frameworks are expected to be
559 # system framework and the path to be already system absolute 562 # system framework and the path to be already system absolute
560 # so do not use rebase_path here. 563 # so do not use rebase_path here.
561 foreach(_framework, invoker.extra_system_frameworks) { 564 foreach(_framework, invoker.extra_system_frameworks) {
562 code_signing_args += [ "-F=" + _framework ] 565 code_signing_args += [ "-F=" + _framework ]
563 } 566 }
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 if (defined(visibility)) { 910 if (defined(visibility)) {
908 visibility += [ ":${_target_name}_shared_library($default_toolchain)" ] 911 visibility += [ ":${_target_name}_shared_library($default_toolchain)" ]
909 } 912 }
910 output_name = _output_name 913 output_name = _output_name
911 output_prefix_override = true 914 output_prefix_override = true
912 output_extension = "" 915 output_extension = ""
913 output_dir = "$target_out_dir/$_target_name" 916 output_dir = "$target_out_dir/$_target_name"
914 917
915 if (_has_public_headers) { 918 if (_has_public_headers) {
916 configs += [ 919 configs += [
917 ":$_framework_headers_config$_toolchain_suffix", 920 ":$_framework_headers_config($default_toolchain)",
918 ":$_headers_map_config$_toolchain_suffix", 921 ":$_headers_map_config($default_toolchain)",
919 ] 922 ]
920 923
921 if (!defined(deps)) { 924 if (!defined(deps)) {
922 deps = [] 925 deps = []
923 } 926 }
924 deps += [ ":$_framework_headers_target$_toolchain_suffix" ] 927 deps += [ ":$_framework_headers_target($default_toolchain)" ]
925 } 928 }
926 } 929 }
927 930
928 group(_target_name + "+link") { 931 group(_target_name + "+link") {
929 forward_variables_from(invoker, 932 forward_variables_from(invoker,
930 [ 933 [
931 "visibility", 934 "visibility",
932 "testonly", 935 "testonly",
933 ]) 936 ])
934 public_deps = [ 937 public_deps = [
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 output_prefix_override = true 1082 output_prefix_override = true
1080 output_extension = "" 1083 output_extension = ""
1081 1084
1082 if (!_is_fat_build) { 1085 if (!_is_fat_build) {
1083 output_dir = _shared_library_dir 1086 output_dir = _shared_library_dir
1084 } else { 1087 } else {
1085 output_dir = _arch_shared_library_dir 1088 output_dir = _arch_shared_library_dir
1086 } 1089 }
1087 1090
1088 if (_has_public_headers) { 1091 if (_has_public_headers) {
1089 configs += [ ":$_headers_map_config$_toolchain_suffix" ] 1092 configs += [ ":$_headers_map_config($default_toolchain)" ]
1090 1093
1091 if (!defined(deps)) { 1094 if (!defined(deps)) {
1092 deps = [] 1095 deps = []
1093 } 1096 }
1094 deps += [ ":$_framework_headers_target$_toolchain_suffix" ] 1097 deps += [ ":$_framework_headers_target($default_toolchain)" ]
1095 } 1098 }
1096 } 1099 }
1097 1100
1098 if (_is_fat_build) { 1101 if (_is_fat_build) {
1099 action(_lipo_shared_library_target) { 1102 action(_lipo_shared_library_target) {
1100 forward_variables_from(invoker, [ "testonly" ]) 1103 forward_variables_from(invoker, [ "testonly" ])
1101 visibility = _lipo_shared_library_visibility 1104 visibility = _lipo_shared_library_visibility
1102 script = "//build/toolchain/mac/linker_driver.py" 1105 script = "//build/toolchain/mac/linker_driver.py"
1103 outputs = [ 1106 outputs = [
1104 "$_shared_library_dir/$_output_name", 1107 "$_shared_library_dir/$_output_name",
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 if (!defined(deps)) { 1270 if (!defined(deps)) {
1268 deps = [] 1271 deps = []
1269 } 1272 }
1270 1273
1271 if (_is_fat_build) { 1274 if (_is_fat_build) {
1272 deps += [ ":$_lipo_shared_library_target" ] 1275 deps += [ ":$_lipo_shared_library_target" ]
1273 } else { 1276 } else {
1274 deps += [ ":$_link_shared_library_target" ] 1277 deps += [ ":$_link_shared_library_target" ]
1275 } 1278 }
1276 1279
1277 _entitlements_path = "//build/config/ios/entitlements.plist" 1280 _entitlements_path = _default_entitlements_path
1278 if (defined(invoker.entitlements_path)) { 1281 if (defined(invoker.entitlements_path)) {
1279 _entitlements_path = invoker.entitlements_path 1282 _entitlements_path = invoker.entitlements_path
1280 } 1283 }
1281 1284
1282 code_signing_script = "//build/config/ios/codesign.py" 1285 code_signing_script = "//build/config/ios/codesign.py"
1283 code_signing_sources = [ 1286 code_signing_sources = [
1284 _entitlements_path, 1287 _entitlements_path,
1285 "$_shared_library_dir/$_output_name", 1288 "$_shared_library_dir/$_output_name",
1286 ] 1289 ]
1287 code_signing_outputs = [ 1290 code_signing_outputs = [
1288 "$bundle_root_dir/$_output_name", 1291 "$bundle_root_dir/$_output_name",
1289 "$bundle_root_dir/_CodeSignature/CodeResources", 1292 "$bundle_root_dir/_CodeSignature/CodeResources",
1290 "$bundle_root_dir/embedded.mobileprovision",
1291 ] 1293 ]
1294 if (ios_code_signing_identity != "") {
1295 code_signing_outputs +=
1296 [ "$bundle_root_dir/embedded.mobileprovision" ]
1297 }
1292 code_signing_args = [ 1298 code_signing_args = [
1293 "-e=" + rebase_path(_entitlements_path, root_build_dir),
1294 "code-sign-bundle", 1299 "code-sign-bundle",
1295 "-i=" + ios_code_signing_identity, 1300 "-i=" + ios_code_signing_identity,
1301 "-e=" + rebase_path(_entitlements_path, root_build_dir),
1296 "-b=" + 1302 "-b=" +
1297 rebase_path("$_shared_library_dir/$_output_name", root_build_dir), 1303 rebase_path("$_shared_library_dir/$_output_name", root_build_dir),
1298 rebase_path(bundle_root_dir, root_build_dir), 1304 rebase_path(bundle_root_dir, root_build_dir),
1299 ] 1305 ]
1300 } 1306 }
1301 } 1307 }
1302 1308
1303 if (defined(_framework_version)) { 1309 if (defined(_framework_version)) {
1304 action(_target_name) { 1310 action(_target_name) {
1305 forward_variables_from(invoker, [ "testonly" ]) 1311 forward_variables_from(invoker, [ "testonly" ])
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 1560
1555 if (!ios_enable_code_signing) { 1561 if (!ios_enable_code_signing) {
1556 deps += [ ":$_xctest_loadable_module_bundle" ] 1562 deps += [ ":$_xctest_loadable_module_bundle" ]
1557 } else { 1563 } else {
1558 if (_is_fat_build) { 1564 if (_is_fat_build) {
1559 deps += [ ":$_xctest_lipo_loadable_module_target" ] 1565 deps += [ ":$_xctest_lipo_loadable_module_target" ]
1560 } else { 1566 } else {
1561 deps += [ ":$_xctest_loadable_module_target" ] 1567 deps += [ ":$_xctest_loadable_module_target" ]
1562 } 1568 }
1563 1569
1564 _entitlements_path = "//build/config/ios/entitlements.plist" 1570 _entitlements_path = _default_entitlements_path
1565 if (defined(invoker.entitlements_path)) { 1571 if (defined(invoker.entitlements_path)) {
1566 _entitlements_path = invoker.entitlements_path 1572 _entitlements_path = invoker.entitlements_path
1567 } 1573 }
1568 1574
1569 code_signing_script = "//build/config/ios/codesign.py" 1575 code_signing_script = "//build/config/ios/codesign.py"
1570 code_signing_sources = [ 1576 code_signing_sources = [
1571 _entitlements_path, 1577 _entitlements_path,
1572 "$target_out_dir/$_xctest_output", 1578 "$target_out_dir/$_xctest_output",
1573 ] 1579 ]
1574 code_signing_outputs = [ 1580 code_signing_outputs = [
1575 "$bundle_root_dir/$_xctest_output", 1581 "$bundle_root_dir/$_xctest_output",
1576 "$bundle_root_dir/_CodeSignature/CodeResources", 1582 "$bundle_root_dir/_CodeSignature/CodeResources",
1577 "$bundle_root_dir/embedded.mobileprovision",
1578 ] 1583 ]
1584 if (ios_code_signing_identity != "") {
1585 code_signing_outputs +=
1586 [ "$bundle_root_dir/embedded.mobileprovision" ]
1587 }
1579 code_signing_args = [ 1588 code_signing_args = [
1580 "-e=" + rebase_path(_entitlements_path, root_build_dir),
1581 "code-sign-bundle", 1589 "code-sign-bundle",
1582 "-i=" + ios_code_signing_identity, 1590 "-i=" + ios_code_signing_identity,
1591 "-e=" + rebase_path(_entitlements_path, root_build_dir),
1583 "-b=" + 1592 "-b=" +
1584 rebase_path("$target_out_dir/$_xctest_output", root_build_dir), 1593 rebase_path("$target_out_dir/$_xctest_output", root_build_dir),
1585 rebase_path(bundle_root_dir, root_build_dir), 1594 rebase_path(bundle_root_dir, root_build_dir),
1586 ] 1595 ]
1587 } 1596 }
1588 } 1597 }
1589 1598
1590 bundle_data(_xctest_bundle) { 1599 bundle_data(_xctest_bundle) {
1591 visibility = [ ":$_host_target" ] 1600 visibility = [ ":$_host_target" ]
1592 public_deps = [ 1601 public_deps = [
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 "-rpath", 1648 "-rpath",
1640 "-Xlinker", 1649 "-Xlinker",
1641 "@loader_path/Frameworks", 1650 "@loader_path/Frameworks",
1642 ] 1651 ]
1643 } 1652 }
1644 } 1653 }
1645 1654
1646 set_defaults("ios_xctest_test") { 1655 set_defaults("ios_xctest_test") {
1647 configs = default_executable_configs 1656 configs = default_executable_configs
1648 } 1657 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698