summaryrefslogtreecommitdiffstats
path: root/chromium/build/config/ios
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/build/config/ios')
-rw-r--r--chromium/build/config/ios/ios_sdk.gni43
-rw-r--r--chromium/build/config/ios/rules.gni68
2 files changed, 72 insertions, 39 deletions
diff --git a/chromium/build/config/ios/ios_sdk.gni b/chromium/build/config/ios/ios_sdk.gni
index f3aaf810644..917a6902ae1 100644
--- a/chromium/build/config/ios/ios_sdk.gni
+++ b/chromium/build/config/ios/ios_sdk.gni
@@ -27,12 +27,18 @@ declare_args() {
# not work (see build/BUILDCONFIG.gn for pattern that would cause issue).
ios_sdk_developer_dir = ""
- # The iOS Code signing identity to use
- # TODO(GYP), TODO(sdfresne): Consider having a separate
- # ios_enable_code_signing_flag=<bool> flag to make the invocation clearer.
+ # Control whether codesiging is enabled (ignored for simulator builds).
ios_enable_code_signing = true
+
+ # Explicitly select the identity to use for codesigning. If defined, must
+ # be set to a non-empty string that will be passed to codesigning. Can be
+ # left unspecified if ios_code_signing_identity_description is used instead.
ios_code_signing_identity = ""
- ios_code_signing_identity_description = "iPhone Developer"
+
+ # Pattern used to select the identity to use for codesigning. If defined,
+ # must be a substring of the description of exactly one of the identities by
+ # `security find-identity -v -p codesigning`.
+ ios_code_signing_identity_description = "Apple Development"
# Prefix for CFBundleIdentifier property of iOS bundles (correspond to the
# "Organization Identifier" in Xcode). Code signing will fail if no mobile
@@ -68,6 +74,18 @@ assert(custom_toolchain == "" || additional_target_cpus == [],
use_ios_simulator = current_cpu == "x86" || current_cpu == "x64"
+# If codesigning is enabled, use must configure either a codesigning identity
+# or a filter to automatically select the codesigning identity.
+if (!use_ios_simulator && ios_enable_code_signing) {
+ assert(ios_code_signing_identity == "" ||
+ ios_code_signing_identity_description == "",
+ "You should either specify the precise identity to use with " +
+ "ios_code_signing_identity or let the code select an identity " +
+ "automatically (via find_signing_identity.py which use the " +
+ "variable ios_code_signing_identity_description to set the " +
+ "pattern to match the identity to use).")
+}
+
# Initialize additional_toolchains from additional_target_cpus. Assert here
# that the list does not contains $target_cpu nor duplicates as this would
# cause weird errors during the build.
@@ -135,12 +153,15 @@ if (!use_ios_simulator && ios_enable_code_signing) {
# Automatically select a codesigning identity if no identity is configured.
# This only applies to device build as simulator builds are not signed.
if (ios_code_signing_identity == "") {
- ios_code_signing_identity =
- exec_script("find_signing_identity.py",
- [
- "--matching-pattern",
- ios_code_signing_identity_description,
- ],
- "string")
+ find_signing_identity_args = []
+ if (ios_code_signing_identity_description != "") {
+ find_signing_identity_args = [
+ "--matching-pattern",
+ ios_code_signing_identity_description,
+ ]
+ }
+ ios_code_signing_identity = exec_script("find_signing_identity.py",
+ find_signing_identity_args,
+ "trim string")
}
}
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