| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 # This file contains rules that are shared between Mac and iOS. | 5 # This file contains rules that are shared between Mac and iOS. |
| 6 | 6 |
| 7 import("//build/toolchain/toolchain.gni") | 7 import("//build/toolchain/toolchain.gni") |
| 8 | 8 |
| 9 if (is_mac) { | 9 if (is_mac) { |
| 10 import("//build/config/mac/mac_sdk.gni") | 10 import("//build/config/mac/mac_sdk.gni") |
| 11 } else if (is_ios) { | 11 } else if (is_ios) { |
| 12 import("//build/config/mac/ios_sdk.gni") | 12 import("//build/config/mac/ios_sdk.gni") |
| 13 } | 13 } |
| 14 | 14 |
| 15 # The base template used to generate Info.plist files for iOS and Mac apps and | 15 # The base template used to generate Info.plist files for iOS and Mac apps and |
| 16 # frameworks. | 16 # frameworks. |
| 17 # | 17 # |
| 18 # Arguments | 18 # Arguments |
| 19 # | 19 # |
| 20 # plist_templates: | 20 # plist_templates: |
| 21 # string array, paths to plist files which will be used for the bundle. | 21 # string array, paths to plist files which will be used for the bundle. |
| 22 # | 22 # |
| 23 # executable_name: | 23 # executable_name: |
| 24 # string, name of the generated target used for the product | 24 # string, name of the generated target used for the product |
| 25 # and executable name as specified in the output Info.plist. | 25 # and executable name as specified in the output Info.plist. |
| 26 # | 26 # |
| 27 # format: |
| 28 # string, the format to `plutil -convert` the plist to when |
| 29 # generating the output. |
| 30 # |
| 27 # extra_substitutions: | 31 # extra_substitutions: |
| 28 # (optional) string array, 'key=value' pairs for extra fields which are | 32 # (optional) string array, 'key=value' pairs for extra fields which are |
| 29 # specified in a source Info.plist template. | 33 # specified in a source Info.plist template. |
| 30 template("info_plist") { | 34 template("info_plist") { |
| 31 assert(defined(invoker.plist_templates), | 35 assert(defined(invoker.plist_templates), |
| 32 "A list of template plist files must be specified for $target_name") | 36 "A list of template plist files must be specified for $target_name") |
| 33 assert(defined(invoker.executable_name), | 37 assert(defined(invoker.executable_name), |
| 34 "The executable_name must be specified for $target_name") | 38 "The executable_name must be specified for $target_name") |
| 39 assert(defined(invoker.format), |
| 40 "The plist format must be specified for $target_name") |
| 35 executable_name = invoker.executable_name | 41 executable_name = invoker.executable_name |
| 36 | 42 |
| 37 action(target_name) { | 43 action(target_name) { |
| 38 script = "//build/config/mac/gen_plist.py" | 44 script = "//build/config/mac/gen_plist.py" |
| 39 sources = invoker.plist_templates | 45 sources = invoker.plist_templates |
| 40 outputs = [ | 46 outputs = [ |
| 41 "$target_gen_dir/$target_name.plist", | 47 "$target_gen_dir/$target_name.plist", |
| 42 ] | 48 ] |
| 43 extra_args = [] | 49 extra_args = [] |
| 44 if (defined(invoker.extra_substitutions)) { | 50 if (defined(invoker.extra_substitutions)) { |
| 45 foreach(substitution, invoker.extra_substitutions) { | 51 foreach(substitution, invoker.extra_substitutions) { |
| 46 extra_args += [ "-s=$substitution" ] | 52 extra_args += [ "-s=$substitution" ] |
| 47 } | 53 } |
| 48 } | 54 } |
| 49 response_file_contents = | 55 response_file_contents = |
| 50 extra_args + [ | 56 extra_args + [ |
| 51 "-s=BUILD_MACHINE_OS_BUILD=$machine_os_build", | 57 "-s=BUILD_MACHINE_OS_BUILD=$machine_os_build", |
| 52 "-s=EXECUTABLE_NAME=$executable_name", | 58 "-s=EXECUTABLE_NAME=$executable_name", |
| 53 "-s=GCC_VERSION=com.apple.compilers.llvm.clang.1_0", | 59 "-s=GCC_VERSION=com.apple.compilers.llvm.clang.1_0", |
| 54 "-s=PRODUCT_NAME=$executable_name", | 60 "-s=PRODUCT_NAME=$executable_name", |
| 55 "-s=XCODE_BUILD=$xcode_build", | 61 "-s=XCODE_BUILD=$xcode_build", |
| 56 "-s=XCODE_VERSION=$xcode_version", | 62 "-s=XCODE_VERSION=$xcode_version", |
| 57 "-o=" + rebase_path(outputs[0], root_build_dir), | 63 "-o=" + rebase_path(outputs[0], root_build_dir), |
| 64 "-f=" + invoker.format, |
| 58 ] + rebase_path(sources, root_build_dir) | 65 ] + rebase_path(sources, root_build_dir) |
| 59 args = [ "@{{response_file_name}}" ] | 66 args = [ "@{{response_file_name}}" ] |
| 60 } | 67 } |
| 61 } | 68 } |
| 62 | 69 |
| 63 # This is used as the base template for both iOS and Mac frameworks. | 70 # This is used as the base template for both iOS and Mac frameworks. |
| 64 # | 71 # |
| 65 # By default, the bundle target this template generates does not link the | 72 # By default, the bundle target this template generates does not link the |
| 66 # resulting framework into anything that depends on it. If a dependency wants | 73 # resulting framework into anything that depends on it. If a dependency wants |
| 67 # a link-time (as well as build-time) dependency on the framework bundle, | 74 # a link-time (as well as build-time) dependency on the framework bundle, |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 "$target_gen_dir/{{source_name_part}}.nib", | 312 "$target_gen_dir/{{source_name_part}}.nib", |
| 306 ] | 313 ] |
| 307 args = [ | 314 args = [ |
| 308 "--input", | 315 "--input", |
| 309 "{{source}}", | 316 "{{source}}", |
| 310 "--output", | 317 "--output", |
| 311 rebase_path("$target_gen_dir/{{source_name_part}}.nib"), | 318 rebase_path("$target_gen_dir/{{source_name_part}}.nib"), |
| 312 ] + ibtool_flags | 319 ] + ibtool_flags |
| 313 } | 320 } |
| 314 } | 321 } |
| OLD | NEW |