Commit 9689c569 authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

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/+/2144039Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760051}
parent 504e01c2
...@@ -187,6 +187,10 @@ template("lipo_binary") { ...@@ -187,6 +187,10 @@ template("lipo_binary") {
# (optional) string, name of the test application for Xcode unit or ui # (optional) string, name of the test application for Xcode unit or ui
# test target. # 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: # primary_info_plist:
# (optional) path to Info.plist to merge with the $partial_info_plist # (optional) path to Info.plist to merge with the $partial_info_plist
# generated by the compilation of the asset catalog. # generated by the compilation of the asset catalog.
...@@ -274,6 +278,11 @@ template("create_signed_bundle") { ...@@ -274,6 +278,11 @@ template("create_signed_bundle") {
_enable_code_signing = invoker.enable_code_signing _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) { create_bundle(_target_name) {
forward_variables_from(invoker, forward_variables_from(invoker,
[ [
...@@ -300,6 +309,9 @@ template("create_signed_bundle") { ...@@ -300,6 +309,9 @@ template("create_signed_bundle") {
xcode_extra_attributes = { xcode_extra_attributes = {
IPHONEOS_DEPLOYMENT_TARGET = ios_deployment_target 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 invoker has defined extra attributes, they override the defaults.
if (defined(invoker.xcode_extra_attributes)) { if (defined(invoker.xcode_extra_attributes)) {
...@@ -519,6 +531,11 @@ template("ios_info_plist") { ...@@ -519,6 +531,11 @@ template("ios_info_plist") {
# variant with the same binary but the correct bundle_deps, the bundle # 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. # 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". # For more information, see "gn help executable".
template("ios_app_bundle") { template("ios_app_bundle") {
_output_name = target_name _output_name = target_name
...@@ -527,6 +544,19 @@ template("ios_app_bundle") { ...@@ -527,6 +544,19 @@ template("ios_app_bundle") {
_output_name = invoker.output_name _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_source = _target_name + "_arch_executable_sources"
_arch_executable_target = _target_name + "_arch_executable" _arch_executable_target = _target_name + "_arch_executable"
_lipo_executable_target = _target_name + "_executable" _lipo_executable_target = _target_name + "_executable"
...@@ -829,6 +859,7 @@ template("ios_app_bundle") { ...@@ -829,6 +859,7 @@ template("ios_app_bundle") {
bundle_binary_output = _output_name bundle_binary_output = _output_name
bundle_extension = _bundle_extension bundle_extension = _bundle_extension
product_type = _product_type product_type = _product_type
xcode_product_bundle_id = _xcode_product_bundle_id
_generate_info_plist_outputs = _generate_info_plist_outputs =
get_target_outputs(":$_generate_info_plist") get_target_outputs(":$_generate_info_plist")
...@@ -1692,6 +1723,7 @@ template("ios_xctest_bundle") { ...@@ -1692,6 +1723,7 @@ template("ios_xctest_bundle") {
create_signed_bundle(_target_name) { create_signed_bundle(_target_name) {
forward_variables_from(invoker, forward_variables_from(invoker,
[ [
"bundle_id",
"data_deps", "data_deps",
"enable_code_signing", "enable_code_signing",
"product_type", "product_type",
......
...@@ -298,6 +298,7 @@ ios_app_bundle("chrome") { ...@@ -298,6 +298,7 @@ ios_app_bundle("chrome") {
entitlements_target = ":entitlements" entitlements_target = ":entitlements"
info_plist_target = ":info_plist" info_plist_target = ":info_plist"
xcode_product_bundle_id = "$chromium_bundle_id"
bundle_deps = [ "//ios/chrome/app/resources" ] bundle_deps = [ "//ios/chrome/app/resources" ]
if (!is_chrome_branded || ios_chrome_app_variants == []) { if (!is_chrome_branded || ios_chrome_app_variants == []) {
......
...@@ -38,6 +38,7 @@ ios_appex_bundle("content_widget_extension") { ...@@ -38,6 +38,7 @@ ios_appex_bundle("content_widget_extension") {
entitlements_target = ":entitlements" entitlements_target = ":entitlements"
info_plist_target = ":tweak_info_plist" info_plist_target = ":tweak_info_plist"
xcode_product_bundle_id = "$chromium_bundle_id.ContentTodayExtension"
} }
source_set("content_widget") { source_set("content_widget") {
......
...@@ -78,6 +78,7 @@ ios_appex_bundle("credential_provider_extension") { ...@@ -78,6 +78,7 @@ ios_appex_bundle("credential_provider_extension") {
entitlements_target = ":entitlements" entitlements_target = ":entitlements"
info_plist_target = ":tweak_info_plist" info_plist_target = ":tweak_info_plist"
xcode_product_bundle_id = "$chromium_bundle_id.CredentialProviderExtension"
} }
generate_localizable_strings("system_strings") { generate_localizable_strings("system_strings") {
......
...@@ -42,6 +42,7 @@ ios_appex_bundle("search_widget_extension") { ...@@ -42,6 +42,7 @@ ios_appex_bundle("search_widget_extension") {
entitlements_target = ":entitlements" entitlements_target = ":entitlements"
info_plist_target = ":tweak_info_plist" info_plist_target = ":tweak_info_plist"
xcode_product_bundle_id = "$chromium_bundle_id.TodayExtension"
} }
source_set("search_widget") { source_set("search_widget") {
......
...@@ -73,6 +73,7 @@ ios_appex_bundle("share_extension") { ...@@ -73,6 +73,7 @@ ios_appex_bundle("share_extension") {
entitlements_target = ":entitlements" entitlements_target = ":entitlements"
info_plist_target = ":tweak_info_plist" info_plist_target = ":tweak_info_plist"
xcode_product_bundle_id = "$chromium_bundle_id.ShareExtension"
} }
generate_localizable_strings("system_strings") { generate_localizable_strings("system_strings") {
......
...@@ -139,6 +139,7 @@ template("chrome_ios_eg_test") { ...@@ -139,6 +139,7 @@ template("chrome_ios_eg_test") {
"//ios/chrome/app/resources", "//ios/chrome/app/resources",
ios_application_icons_target, ios_application_icons_target,
] ]
xcode_product_bundle_id = "gtest.$target_name"
if (!defined(extra_substitutions)) { if (!defined(extra_substitutions)) {
extra_substitutions = [] extra_substitutions = []
......
...@@ -72,6 +72,7 @@ template("chrome_ios_eg2_test_app_host") { ...@@ -72,6 +72,7 @@ template("chrome_ios_eg2_test_app_host") {
"public_deps", "public_deps",
]) ])
testonly = true testonly = true
xcode_product_bundle_id = "gtest.$target_name"
if (!defined(entitlements_path) && !defined(entitlements_target)) { if (!defined(entitlements_path) && !defined(entitlements_target)) {
entitlements_target = ":$_tweak_entitlements" entitlements_target = ":$_tweak_entitlements"
......
...@@ -298,12 +298,14 @@ template("test") { ...@@ -298,12 +298,14 @@ template("test") {
info_plist = "//testing/gtest_ios/unittest-Info.plist" info_plist = "//testing/gtest_ios/unittest-Info.plist"
} }
_bundle_id_suffix = "${target_name}" _gtest_bundle_id_suffix = "${target_name}"
xcode_product_bundle_id = "gtest.$_gtest_bundle_id_suffix"
if (!defined(extra_substitutions)) { if (!defined(extra_substitutions)) {
extra_substitutions = [] extra_substitutions = []
} }
extra_substitutions += [ "GTEST_BUNDLE_ID_SUFFIX=$_bundle_id_suffix" ] extra_substitutions +=
[ "GTEST_BUNDLE_ID_SUFFIX=$_gtest_bundle_id_suffix" ]
if (!defined(bundle_deps)) { if (!defined(bundle_deps)) {
bundle_deps = [] bundle_deps = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment