| 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/rules.gni") | 6 import("//build/config/mac/rules.gni") |
| 7 | 7 |
| 8 template("ios_info_plist") { |
| 9 info_plist(target_name) { |
| 10 extra_substitutions = [] |
| 11 if (defined(invoker.extra_substitutions)) { |
| 12 extra_substitutions = invoker.extra_substitutions |
| 13 } |
| 14 extra_substitutions += [ |
| 15 "IOS_DEPLOYMENT_TARGET=$ios_deployment_target", |
| 16 "IOS_PLATFORM_BUILD=$ios_platform_build", |
| 17 "IOS_PLATFORM_NAME=$ios_sdk_name", |
| 18 "IOS_PLATFORM_VERSION=$ios_sdk_version", |
| 19 "IOS_SDK_BUILD=$ios_sdk_build", |
| 20 "IOS_SDK_NAME=$ios_sdk_name$ios_sdk_version", |
| 21 "IOS_SUPPORTED_PLATFORM=$ios_sdk_platform", |
| 22 ] |
| 23 plist_templates = [ |
| 24 "//build/config/ios/BuildInfo.plist", |
| 25 invoker.info_plist, |
| 26 ] |
| 27 forward_variables_from(invoker, [ "executable_name" ]) |
| 28 } |
| 29 } |
| 30 |
| 8 # TODO(crbug.com/297668): refactor this template to extract common behaviour | 31 # TODO(crbug.com/297668): refactor this template to extract common behaviour |
| 9 # between OS X and iOS bundle generation, then create a generic "app" template | 32 # between OS X and iOS bundle generation, then create a generic "app" template |
| 10 # that forward to "executable" on all platform except iOS/OS X. | 33 # that forward to "executable" on all platform except iOS/OS X. |
| 11 | 34 |
| 12 # Template to build an application bundle for iOS. | 35 # Template to build an application bundle for iOS. |
| 13 # | 36 # |
| 14 # This should be used instead of "executable" built-in target type on iOS. | 37 # This should be used instead of "executable" built-in target type on iOS. |
| 15 # As the template forward the generation of the application executable to | 38 # As the template forward the generation of the application executable to |
| 16 # an "executable" target, all arguments supported by "executable" targets | 39 # an "executable" target, all arguments supported by "executable" targets |
| 17 # are also supported by this template. | 40 # are also supported by this template. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 | 61 |
| 39 _output_name = target_name | 62 _output_name = target_name |
| 40 _target_name = target_name | 63 _target_name = target_name |
| 41 if (defined(invoker.output_name)) { | 64 if (defined(invoker.output_name)) { |
| 42 _output_name = invoker.output_name | 65 _output_name = invoker.output_name |
| 43 } | 66 } |
| 44 | 67 |
| 45 _generate_info_plist = target_name + "_generate_info_plist" | 68 _generate_info_plist = target_name + "_generate_info_plist" |
| 46 _bundle_data_info_plist = target_name + "_bundle_data_info_plist" | 69 _bundle_data_info_plist = target_name + "_bundle_data_info_plist" |
| 47 | 70 |
| 48 action(_generate_info_plist) { | 71 ios_info_plist(_generate_info_plist) { |
| 49 visibility = [ ":$_bundle_data_info_plist" ] | 72 executable_name = _output_name |
| 50 script = "//build/config/ios/ios_gen_plist.py" | 73 forward_variables_from(invoker, |
| 51 sources = [ | 74 [ |
| 52 "//build/config/ios/BuildInfo.plist", | 75 "extra_substitutions", |
| 53 invoker.info_plist, | 76 "info_plist", |
| 54 ] | 77 ]) |
| 55 outputs = [ | |
| 56 "$target_gen_dir/$target_name/Info.plist", | |
| 57 ] | |
| 58 extra_args = [] | |
| 59 if (defined(invoker.extra_substitutions)) { | |
| 60 foreach(substitution, invoker.extra_substitutions) { | |
| 61 extra_args += [ "-s=$substitution" ] | |
| 62 } | |
| 63 } | |
| 64 response_file_contents = | |
| 65 extra_args + [ | |
| 66 "-s=BUILD_MACHINE_OS_BUILD=$machine_os_build", | |
| 67 "-s=EXECUTABLE_NAME=$_output_name", | |
| 68 "-s=GCC_VERSION=com.apple.compilers.llvm.clang.1_0", | |
| 69 "-s=IOS_DEPLOYMENT_TARGET=$ios_deployment_target", | |
| 70 "-s=IOS_PLATFORM_BUILD=$ios_platform_build", | |
| 71 "-s=IOS_PLATFORM_NAME=$ios_sdk_name", | |
| 72 "-s=IOS_PLATFORM_VERSION=$ios_sdk_version", | |
| 73 "-s=IOS_SDK_BUILD=$ios_sdk_build", | |
| 74 "-s=IOS_SDK_NAME=$ios_sdk_name$ios_sdk_version", | |
| 75 "-s=IOS_SUPPORTED_PLATFORM=$ios_sdk_platform", | |
| 76 "-s=PRODUCT_NAME=$_output_name", | |
| 77 "-s=XCODE_BUILD=$xcode_build", | |
| 78 "-s=XCODE_VERSION=$xcode_version", | |
| 79 "-o=" + rebase_path(outputs[0], root_out_dir), | |
| 80 ] + rebase_path(sources, root_out_dir) | |
| 81 args = [ "@{{response_file_name}}" ] | |
| 82 } | 78 } |
| 83 | 79 |
| 84 bundle_data(_bundle_data_info_plist) { | 80 bundle_data(_bundle_data_info_plist) { |
| 85 forward_variables_from(invoker, [ "testonly" ]) | 81 forward_variables_from(invoker, [ "testonly" ]) |
| 86 visibility = [ ":$_target_name" ] | 82 visibility = [ ":$_target_name" ] |
| 87 sources = get_target_outputs(":$_generate_info_plist") | 83 sources = get_target_outputs(":$_generate_info_plist") |
| 88 outputs = [ | 84 outputs = [ |
| 89 "{{bundle_root_dir}}/Info.plist", | 85 "{{bundle_root_dir}}/Info.plist", |
| 90 ] | 86 ] |
| 91 public_deps = [ | 87 public_deps = [ |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 [ | 404 [ |
| 409 "testonly", | 405 "testonly", |
| 410 "visibility", | 406 "visibility", |
| 411 ]) | 407 ]) |
| 412 public_deps = [ | 408 public_deps = [ |
| 413 ":$_framework_target+link", | 409 ":$_framework_target+link", |
| 414 ] | 410 ] |
| 415 } | 411 } |
| 416 } | 412 } |
| 417 } | 413 } |
| OLD | NEW |