summaryrefslogtreecommitdiff
path: root/chromium/build/config/ios/rules.gni
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/build/config/ios/rules.gni')
-rw-r--r--chromium/build/config/ios/rules.gni68
1 files changed, 40 insertions, 28 deletions
diff --git a/chromium/build/config/ios/rules.gni b/chromium/build/config/ios/rules.gni
index 6c9733346e7..0e882464c74 100644
--- a/chromium/build/config/ios/rules.gni
+++ b/chromium/build/config/ios/rules.gni
@@ -514,13 +514,10 @@ template("ios_info_plist") {
# entitlements (must generate a single file as output); cannot be
# defined if entitlements_path is set.
#
-# bundle_extension:
-# (optional) bundle extension including the dot, default to ".app".
-#
# product_type
# (optional) string, product type for the generated Xcode project,
-# default to "com.apple.product-type.application". Should generally
-# not be overridden.
+# default to "com.apple.product-type.application". Should only be
+# overriden when building application extension.
#
# enable_code_signing
# (optional) boolean, control whether code signing is enabled or not,
@@ -546,6 +543,10 @@ template("ios_app_bundle") {
_output_name = invoker.output_name
}
+ assert(
+ !defined(invoker.bundle_extension),
+ "bundle_extension must not be set for ios_app_bundle template for $target_name")
+
_xcode_product_bundle_id = "$ios_app_bundle_id_prefix.$_output_name"
if (defined(invoker.xcode_product_bundle_id)) {
_xcode_product_bundle_id = invoker.xcode_product_bundle_id
@@ -599,10 +600,6 @@ template("ios_app_bundle") {
_default_variant = _variants[0]
- if (current_toolchain != default_toolchain) {
- not_needed("*")
- }
-
source_set(_arch_executable_source) {
forward_variables_from(invoker,
"*",
@@ -632,6 +629,21 @@ template("ios_app_bundle") {
"target_out_dir") + "/$_output_name.xcent"
}
+ _product_type = _ios_xcode_app_bundle_id
+ if (defined(invoker.product_type)) {
+ _product_type = invoker.product_type
+ }
+
+ if (_product_type == _ios_xcode_app_bundle_id) {
+ _bundle_extension = ".app"
+ } else if (_product_type == _ios_xcode_appex_bundle_id) {
+ _bundle_extension = ".appex"
+ } else {
+ assert(false, "unknown product_type \"$product_type\" for $_target_name")
+ }
+
+ _is_app_bundle = _product_type == _ios_xcode_app_bundle_id
+
executable(_arch_executable_target) {
forward_variables_from(invoker,
"*",
@@ -681,6 +693,18 @@ template("ios_app_bundle") {
"2",
]
+ # Application extension may share private frameworks with the application
+ # itself, so they need to look in both their own bundle and the surrounding
+ # app bundle for the frameworks.
+ if (!_is_app_bundle) {
+ ldflags += [
+ "-Xlinker",
+ "-rpath",
+ "-Xlinker",
+ "@executable_path/../../Frameworks",
+ ]
+ }
+
if (use_ios_simulator) {
deps += [ ":$_generate_entitlements_target($default_toolchain)" ]
@@ -791,23 +815,8 @@ template("ios_app_bundle") {
}
}
- _product_type = _ios_xcode_app_bundle_id
- if (defined(invoker.product_type)) {
- _product_type = invoker.product_type
- }
-
- _app_bundle_extension = ".app"
- _bundle_extension = _app_bundle_extension
- if (defined(invoker.bundle_extension)) {
- _bundle_extension = invoker.bundle_extension
- }
-
- # Only write PkgInfo for real application, not application extension (they
- # have the same product type but a different extension).
- _write_pkg_info = _product_type == _ios_xcode_app_bundle_id &&
- _bundle_extension == _app_bundle_extension
-
- if (_write_pkg_info) {
+ # Only write PkgInfo for real application, not application extension.
+ if (_is_app_bundle) {
_create_pkg_info = target_name + "_pkg_info"
action(_create_pkg_info) {
forward_variables_from(invoker, [ "testonly" ])
@@ -873,7 +882,7 @@ template("ios_app_bundle") {
if (!defined(bundle_deps)) {
bundle_deps = []
}
- if (_write_pkg_info) {
+ if (_is_app_bundle) {
bundle_deps += [ ":$_bundle_data_pkg_info" ]
}
bundle_deps += _variant.bundle_deps
@@ -906,6 +915,10 @@ template("ios_app_bundle") {
}
}
}
+
+ if (current_toolchain != default_toolchain) {
+ not_needed("*")
+ }
}
set_defaults("ios_app_bundle") {
@@ -948,7 +961,6 @@ template("ios_appex_bundle") {
"bundle_extension",
"product_type",
])
- bundle_extension = ".appex"
product_type = _ios_xcode_appex_bundle_id
# Add linker flags required for an application extension (determined by