Add PRODUCT_BUNDLE_IDENTIFIER in xcode attributes

Attribute is needed for some debug functions in Xcode
(e.g. simulated MetricKit payload).

Change-Id: I6ee8456a7dd4bc1ecc9e3ebc4e31526b2c5ad506
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144039
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: John Chen <johnchen@chromium.org>
Reviewed-by: Olivier Robin <olivierrobin@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#760051}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9689c569d59efae61ea29501b89b1ce801eaa505
This commit is contained in:
Olivier Robin 2020-04-17 14:03:57 +00:00 коммит произвёл Commit Bot
Родитель f15d49b2dd
Коммит 0b88654237
1 изменённых файлов: 32 добавлений и 0 удалений

Просмотреть файл

@ -187,6 +187,10 @@ template("lipo_binary") {
# (optional) string, name of the test application for Xcode unit or ui
# test target.
#
# xcode_product_bundle_id:
# (optional) string, the bundle ID that will be added in the XCode
# attributes to enable some features when debugging (e.g. MetricKit).
#
# primary_info_plist:
# (optional) path to Info.plist to merge with the $partial_info_plist
# generated by the compilation of the asset catalog.
@ -274,6 +278,11 @@ template("create_signed_bundle") {
_enable_code_signing = invoker.enable_code_signing
}
_xcode_product_bundle_id = ""
if (defined(invoker.xcode_product_bundle_id)) {
_xcode_product_bundle_id = invoker.xcode_product_bundle_id
}
create_bundle(_target_name) {
forward_variables_from(invoker,
[
@ -300,6 +309,9 @@ template("create_signed_bundle") {
xcode_extra_attributes = {
IPHONEOS_DEPLOYMENT_TARGET = ios_deployment_target
if (_xcode_product_bundle_id != "") {
PRODUCT_BUNDLE_IDENTIFIER = _xcode_product_bundle_id
}
# If invoker has defined extra attributes, they override the defaults.
if (defined(invoker.xcode_extra_attributes)) {
@ -519,6 +531,11 @@ template("ios_info_plist") {
# variant with the same binary but the correct bundle_deps, the bundle
# at $target_out_dir/$output_name will be a copy of the first variant.
#
# xcode_product_bundle_id:
# (optional) string, the bundle ID that will be added in the XCode
# attributes to enable some features when debugging (e.g. MetricKit).
# defaults to "$ios_app_bundle_id_prefix.$output_name".
#
# For more information, see "gn help executable".
template("ios_app_bundle") {
_output_name = target_name
@ -527,6 +544,19 @@ template("ios_app_bundle") {
_output_name = invoker.output_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
_xcode_product_bundle_id =
"$ios_app_bundle_id_prefix.$_xcode_product_bundle_id"
} else if (defined(invoker.bundle_id)) {
_xcode_product_bundle_id = invoker.bundle_id
}
# Bundle ID should respect rfc1034 and replace _ with -.
_xcode_product_bundle_id =
string_replace("$_xcode_product_bundle_id", "_", "-")
_arch_executable_source = _target_name + "_arch_executable_sources"
_arch_executable_target = _target_name + "_arch_executable"
_lipo_executable_target = _target_name + "_executable"
@ -829,6 +859,7 @@ template("ios_app_bundle") {
bundle_binary_output = _output_name
bundle_extension = _bundle_extension
product_type = _product_type
xcode_product_bundle_id = _xcode_product_bundle_id
_generate_info_plist_outputs =
get_target_outputs(":$_generate_info_plist")
@ -1692,6 +1723,7 @@ template("ios_xctest_bundle") {
create_signed_bundle(_target_name) {
forward_variables_from(invoker,
[
"bundle_id",
"data_deps",
"enable_code_signing",
"product_type",