# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/apple/compile_entitlements.gni")
import("//build/apple/tweak_info_plist.gni")
import("//build/config/ios/ios_sdk.gni")
import("//build/config/ios/rules.gni")
import("//build/ios/extension_bundle_data.gni")
import("//ios/build/chrome_build.gni")
import("//ios/chrome/features.gni")
import("//ios/features.gni")
# Template used to create a Chrome-like app bundle that depends on
# EarlyMallocZoneRegistration.
#
template("chrome_app") {
_target_name = target_name
if (use_blink) {
assert(ios_partition_alloc_enabled)
ios_framework_bundle("${_target_name}_framework") {
forward_variables_from(invoker,
[
"deps",
"framework_dirs",
"frameworks",
"public_configs",
"public_deps",
"sources",
"testonly",
])
# Explicitly clobber configs inherited from `set_defaults(...)`, then
# add back `//build/config:shared_library_config` since this builds a
# shared library.
if (defined(invoker.configs)) {
configs = []
configs = invoker.configs + [ "//build/config:shared_library_config" ]
}
output_name = "${_target_name}_framework"
transparent = true
info_plist = "//ios/chrome/app/resources/EarlyPAFrameworkInfo.plist"
extra_substitutions =
[ "BUNDLE_IDENTIFIER=$ios_app_bundle_id_prefix.$output_name" ]
}
template("browserkit_extension") {
_process_target = target_name
_outer_target = _target_name
tweak_info_plist("tweak_${_outer_target}_${_process_target}_plist") {
info_plist = "//content/app/ios/appex/${_process_target}.plist"
}
extension_bundle_data("${_outer_target}_${_process_target}_bundle") {
forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
extension_dir = "Extensions"
extension_name = "${_outer_target}_${_process_target}.appex"
extension_target = ":${_outer_target}_${_process_target}"
}
compile_entitlements("${_outer_target}_${_process_target}_entitlements") {
substitutions = [ "IOS_BUNDLE_ID_PREFIX=$ios_app_bundle_id_prefix" ]
output_name = "$target_gen_dir/${target_name}.appex.entitlements"
entitlements_templates =
[ "//content/app/ios/appex/${_process_target}.appex.entitlements" ]
}
# We don't use ios_appex_bundle here because we don't want to mess with multiple
# toolkits as the core framework is built with the default toolkit.
ios_app_bundle("${_outer_target}_${_process_target}") {
forward_variables_from(invoker,
"*",
[
"defines",
"deps",
"framework_dirs",
"frameworks",
"public_deps",
"sources",
"target_name",
])
output_name = target_name
transparent = true
configs += [ "//build/config/ios:ios_extension_executable_flags" ]
deps = [
":${_outer_target}_framework+link",
"//content/app/ios/appex:${_process_target}",
]
ldflags = [
"-Wl,--ignore-auto-link-option=CoreAudioTypes",
"-Wl,-no_application_extension",
"-Wl,-rpath,@executable_path/../../Frameworks",
]
product_type = "com.apple.product-type.app-extension"
entitlements_target = ":${target_name}_entitlements"
info_plist_target = ":tweak_${target_name}_plist"
}
}
browserkit_extension("gpu_process") {
forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
bundle_identifier = "$ios_chromium_bundle_id.GPUProcess"
}
browserkit_extension("network_process") {
forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
bundle_identifier = "$ios_chromium_bundle_id.NetworkProcess"
}
browserkit_extension("content_process") {
forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
bundle_identifier = "$ios_chromium_bundle_id.ContentProcess"
}
ios_app_bundle(_target_name) {
forward_variables_from(invoker,
"*",
[
"defines",
"deps",
"framework_dirs",
"frameworks",
"public_deps",
"sources",
])
configs = []
configs = default_executable_configs
deps = [
":${_target_name}_framework+link",
":${target_name}_content_process_bundle",
":${target_name}_gpu_process_bundle",
":${target_name}_network_process_bundle",
"//ios/chrome/app:app_trampoline",
"//ios/chrome/app:early_partition_alloc_framework+bundle",
]
frameworks = [ "EarlyMallocZoneRegistration.framework" ]
bundle_deps += [
":${_target_name}_framework+bundle",
"//ios/chrome/app:early_partition_alloc_framework+bundle",
]
}
} else {
ios_app_bundle(_target_name) {
forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY)
forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
if (ios_partition_alloc_enabled) {
frameworks = [ "EarlyMallocZoneRegistration.framework" ]
bundle_deps +=
[ "//ios/chrome/app:early_partition_alloc_framework+bundle" ]
}
}
}
}