Index: build/config/mac/base_rules.gni |
diff --git a/build/config/mac/rules.gni b/build/config/mac/base_rules.gni |
similarity index 52% |
copy from build/config/mac/rules.gni |
copy to build/config/mac/base_rules.gni |
index 9d13d8c4d69e1fa16a96578c02ba338ddbbd605e..18293895220aa49c4a51ebf676b64685a828e757 100644 |
--- a/build/config/mac/rules.gni |
+++ b/build/config/mac/base_rules.gni |
@@ -1,9 +1,16 @@ |
-# Copyright 2015 The Chromium Authors. All rights reserved. |
+# Copyright 2016 The Chromium Authors. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+# This file contains rules that are shared between Mac and iOS. |
+ |
import("//build/toolchain/toolchain.gni") |
-import("//build/config/mac/mac_sdk.gni") |
+ |
+if (is_mac) { |
+ import("//build/config/mac/mac_sdk.gni") |
+} else if (is_ios) { |
+ import("//build/config/ios/ios_sdk.gni") |
+} |
# The base template used to generate Info.plist files for iOS and Mac apps and |
# frameworks. |
@@ -53,39 +60,6 @@ template("info_plist") { |
} |
} |
-# Generates Info.plist files for Mac apps and frameworks. |
-# |
-# Arguments |
-# |
-# info_plist: |
-# string, the path to an plist file that will be included in the final |
-# Info.plist generated. |
-# |
-# executable_name: |
-# string, name of the generated target used for the product |
-# and executable name as specified in the output Info.plist. |
-# |
-# extra_substitutions: |
-# (optional) string array, 'key=value' pairs for extra fields which are |
-# specified in a source Info.plist template. |
-template("mac_info_plist") { |
- info_plist(target_name) { |
- extra_substitutions = [] |
- if (defined(invoker.extra_substitutions)) { |
- extra_substitutions = invoker.extra_substitutions |
- } |
- extra_substitutions += [ |
- "MAC_SDK_BUILD=$mac_sdk_build", |
- "MAC_SDK_NAME=$mac_sdk_name$mac_sdk_version", |
- ] |
- plist_templates = [ |
- "//build/config/mac/BuildInfo.plist", |
- invoker.info_plist, |
- ] |
- forward_variables_from(invoker, [ "executable_name" ]) |
- } |
-} |
- |
# This is used as the base template for both iOS and Mac frameworks. |
# |
# By default, the bundle target this template generates does not link the |
@@ -303,7 +277,6 @@ template("framework_bundle") { |
# Template to combile .xib or .storyboard files. |
# |
-# |
# Arguments |
# |
# sources: |
@@ -339,275 +312,3 @@ template("compile_xibs") { |
] + ibtool_flags |
} |
} |
- |
-# Template to compile and package Mac XIB files as bundle data. |
-# |
-# Arguments |
-# |
-# sources: |
-# list of string, sources to comiple |
-# |
-# output_path: |
-# (optional) string, the path to use for the outputs list in the |
-# bundle_data step. If unspecified, defaults to bundle_resources_dir. |
-template("mac_xib_bundle_data") { |
- _target_name = target_name |
- _compile_target_name = _target_name + "_compile_ibtool" |
- |
- compile_xibs(_compile_target_name) { |
- forward_variables_from(invoker, [ "testonly" ]) |
- visibility = [ ":$_target_name" ] |
- sources = invoker.sources |
- ibtool_flags = [ |
- "--minimum-deployment-target", |
- mac_deployment_target, |
- "--target-device", |
- "mac", |
- ] |
- } |
- |
- bundle_data(_target_name) { |
- forward_variables_from(invoker, |
- [ |
- "testonly", |
- "visibility", |
- ]) |
- |
- public_deps = [ |
- ":$_compile_target_name", |
- ] |
- sources = get_target_outputs(":$_compile_target_name") |
- |
- _output_path = "{{bundle_resources_dir}}" |
- if (defined(invoker.output_path)) { |
- _output_path = invoker.output_path |
- } |
- |
- outputs = [ |
- "$_output_path/{{source_file_part}}", |
- ] |
- } |
-} |
- |
-# Template to package a shared library into a Mac framework bundle. |
-# |
-# This template provides two targets to control whether the framework is |
-# merely built when targets depend on it, or whether it is linked as well: |
-# "$target_name" and "$target_name+link". |
-# |
-# See the //build/config/mac/rules.gni:framework_bundle for a discussion |
-# and examples. |
-# |
-# Arguments |
-# |
-# info_plist: |
-# string, path to the Info.plist file that will be used for the bundle. |
-# |
-# output_name: |
-# (optional) string, name of the generated framework without the |
-# .framework suffix. If omitted, defaults to target_name. |
-# |
-# framework_version: |
-# (optional) string, version of the framework. Typically this is a |
-# single letter, like "A". If omitted, the Versions/ subdirectory |
-# structure will not be created, and build output will go directly |
-# into the framework subdirectory. |
-# |
-# See "gn help shared_library" for more information on arguments supported |
-# by shared library target. |
-template("mac_framework_bundle") { |
- assert(defined(invoker.deps), |
- "Dependencies must be specified for $target_name") |
- assert(defined(invoker.info_plist), |
- "The Info.plist file must be specified for $target_name") |
- |
- _info_plist_target = target_name + "_info_plist" |
- |
- mac_info_plist(_info_plist_target) { |
- executable_name = target_name |
- if (defined(invoker.output_name)) { |
- executable_name = invoker.output_name |
- } |
- forward_variables_from(invoker, [ "info_plist" ]) |
- } |
- |
- _info_plist_bundle_data = _info_plist_target + "_bundle_data" |
- |
- bundle_data(_info_plist_bundle_data) { |
- forward_variables_from(invoker, [ "testonly" ]) |
- sources = get_target_outputs(":$_info_plist_target") |
- outputs = [ |
- "{{bundle_root_dir}}/Info.plist", |
- ] |
- public_deps = [ |
- ":$_info_plist_target", |
- ] |
- } |
- |
- framework_bundle(target_name) { |
- forward_variables_from(invoker, "*", [ "info_plist" ]) |
- |
- if (!defined(deps)) { |
- deps = [] |
- } |
- deps += [ ":$_info_plist_bundle_data" ] |
- } |
-} |
- |
-# Template to create a Mac executable application bundle. |
-# |
-# Arguments |
-# |
-# info_plist: |
-# string, path to the Info.plist file that will be used for the bundle. |
-# |
-# output_name: |
-# (optional) string, name of the generated app without the |
-# .app suffix. If omitted, defaults to target_name. |
-template("mac_app_bundle") { |
- assert(defined(invoker.info_plist), |
- "The Info.plist file must be specified for $target_name") |
- |
- _target_name = target_name |
- _output_name = target_name |
- if (defined(invoker.output_name)) { |
- _output_name = invoker.output_name |
- } |
- |
- _executable_target = target_name + "_executable" |
- _executable_bundle_data = _executable_target + "_bundle_data" |
- |
- executable(_executable_target) { |
- visibility = [ ":$_executable_bundle_data" ] |
- forward_variables_from(invoker, |
- "*", |
- [ |
- "assert_no_deps", |
- "data_deps", |
- "info_plist", |
- "output_name", |
- "visibility", |
- ]) |
- output_name = _output_name |
- output_dir = "$target_out_dir/$_executable_target" |
- } |
- |
- bundle_data(_executable_bundle_data) { |
- visibility = [ ":$_target_name" ] |
- forward_variables_from(invoker, [ "testonly" ]) |
- sources = [ |
- "$target_out_dir/$_executable_target/$_output_name", |
- ] |
- outputs = [ |
- "{{bundle_executable_dir}}/$_output_name", |
- ] |
- public_deps = [ |
- ":$_executable_target", |
- ] |
- } |
- |
- _info_plist_target = target_name + "_info_plist" |
- |
- mac_info_plist(_info_plist_target) { |
- executable_name = _output_name |
- forward_variables_from(invoker, [ "info_plist" ]) |
- } |
- |
- _info_plist_bundle_data = _info_plist_target + "_bundle_data" |
- |
- bundle_data(_info_plist_bundle_data) { |
- forward_variables_from(invoker, [ "testonly" ]) |
- visibility = [ ":$_target_name" ] |
- sources = get_target_outputs(":$_info_plist_target") |
- outputs = [ |
- "{{bundle_root_dir}}/Info.plist", |
- ] |
- public_deps = [ |
- ":$_info_plist_target", |
- ] |
- } |
- |
- create_bundle(_target_name) { |
- forward_variables_from(invoker, |
- [ |
- "data_deps", |
- "deps", |
- "public_deps", |
- "testonly", |
- ]) |
- if (!defined(deps)) { |
- deps = [] |
- } |
- deps += [ |
- ":$_executable_bundle_data", |
- ":$_info_plist_bundle_data", |
- ] |
- |
- bundle_root_dir = "$root_out_dir/${_output_name}.app/Contents" |
- bundle_resources_dir = "$bundle_root_dir/Resources" |
- bundle_executable_dir = "$bundle_root_dir/MacOS" |
- } |
-} |
- |
-# Template to package a loadable_module into a .plugin bundle. |
-# |
-# This takes no extra arguments that differ from a loadable_module. |
-template("mac_plugin_bundle") { |
- assert(defined(invoker.deps), |
- "Dependencies must be specified for $target_name") |
- |
- _target_name = target_name |
- _loadable_module_target = _target_name + "_loadable_module" |
- _loadable_module_bundle_data = _loadable_module_target + "_bundle_data" |
- |
- _output_name = _target_name |
- if (defined(invoker.output_name)) { |
- _output_name = invoker.output_name |
- } |
- |
- loadable_module(_loadable_module_target) { |
- visibility = [ ":$_loadable_module_bundle_data" ] |
- forward_variables_from(invoker, |
- "*", |
- [ |
- "assert_no_deps", |
- "data_deps", |
- "output_name", |
- "visibility", |
- ]) |
- output_dir = "$target_out_dir" |
- output_name = _output_name |
- } |
- |
- bundle_data(_loadable_module_bundle_data) { |
- forward_variables_from(invoker, [ "testonly" ]) |
- visibility = [ ":$_target_name" ] |
- sources = [ |
- "$target_out_dir/${_output_name}.so", |
- ] |
- outputs = [ |
- "{{bundle_executable_dir}}/$_output_name", |
- ] |
- public_deps = [ |
- ":$_loadable_module_target", |
- ] |
- } |
- |
- create_bundle(_target_name) { |
- forward_variables_from(invoker, |
- [ |
- "data_deps", |
- "deps", |
- "public_deps", |
- "testonly", |
- "visibility", |
- ]) |
- if (!defined(deps)) { |
- deps = [] |
- } |
- deps += [ ":$_loadable_module_bundle_data" ] |
- |
- bundle_root_dir = "$root_out_dir/$_output_name.plugin/Contents" |
- bundle_executable_dir = "$bundle_root_dir/MacOS" |
- } |
-} |