# Copyright 2016 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/config/chrome_build.gni")
import("//tools/grit/repack.gni")
declare_args() {
# Additional source_patterns for ios_chrome_repack_locales.
ios_locales_pack_extra_source_patterns = []
# Additional dependencies for ios_chrome_repack_locales.
ios_locales_pack_extra_deps = []
# Additional source_patterns for ios_chrome_repack_all_scales.
ios_scalable_pack_extra_source_patterns = []
# Additional dependencies for ios_chrome_repack_all_scales.
ios_scalable_pack_extra_deps = []
}
# Wraps repack_locales() with default needed to pack localized strings for
# Chrome on iOS. Additional source_patterns and deps can be passed via gn
# variables when using internal iOS repository.
#
# Generates a collection of bundle_data targets.
template("ios_chrome_repack_locales") {
repack_locales(target_name) {
forward_variables_from(invoker, "*")
source_patterns = [
"${root_gen_dir}/components/strings/search_engine_descriptions_strings_",
"${root_gen_dir}/components/strings/components_${branding_path_product}_strings_",
"${root_gen_dir}/components/strings/components_locale_settings_",
"${root_gen_dir}/components/strings/components_strings_",
"${root_gen_dir}/components/omnibox/resources/omnibox_pedal_synonyms_",
"${root_gen_dir}/ios/chrome/ios_${branding_path_product}_strings_",
"${root_gen_dir}/ios/chrome/ios_strings_",
"${root_gen_dir}/ios/chrome/ios_whats_new_strings_",
"${root_gen_dir}/third_party/libaddressinput/address_input_strings_",
"${root_gen_dir}/ui/strings/app_locale_settings_",
"${root_gen_dir}/ui/strings/ax_strings_",
"${root_gen_dir}/ui/strings/ui_strings_",
]
foreach(_source_pattern, ios_locales_pack_extra_source_patterns) {
_source_pattern =
string_replace(_source_pattern, "%branding%", branding_path_product)
_source_pattern =
string_replace(_source_pattern, "%root_gen_dir%", root_gen_dir)
source_patterns += [ _source_pattern ]
}
deps = [
"//components/omnibox/resources:omnibox_pedal_synonyms_grit",
"//components/strings:components_branded_strings",
"//components/strings:components_locale_settings",
"//components/strings:components_strings",
"//components/strings:search_engine_descriptions_strings",
"//ios/chrome/app/strings:ios_branded_strings",
"//ios/chrome/app/strings:ios_strings",
"//ios/chrome/browser/ui/whats_new/strings:strings",
"//third_party/libaddressinput:strings",
"//ui/strings:app_locale_settings",
"//ui/strings:ax_strings",
"//ui/strings:ui_strings",
]
foreach(_target, ios_locales_pack_extra_deps) {
_target = string_replace(_target, "%branding%", branding_path_product)
deps += [ _target ]
}
copy_data_to_bundle = true
}
}
# Template to repack all scalable resources at all scales. Additional
# source_patterns and deps can be passed via gn variables when using
# internal iOS repository
#
# Arguments
#
# scales
# list of strings corresponding to scales as percentage, e.g. "200"
# corresponds to @2x scale.
#
# Generates a collection of bundle_data targets for convenience.
template("ios_chrome_repack_scalables") {
_scale_target_names = []
_target_name = target_name
foreach(_scale, invoker.scales) {
_scale_target_name = "${target_name}_${_scale}"
_scale_target_names += [ ":$_scale_target_name" ]
repack("$_scale_target_name") {
forward_variables_from(invoker,
[
"deps",
"testonly",
])
visibility = [ ":$_target_name" ]
sources = [
"${root_gen_dir}/components/components_resources_${_scale}_percent.pak",
"${root_gen_dir}/ios/chrome/ios_theme_resources_${_scale}_percent.pak",
"${root_gen_dir}/ui/resources/ui_resources_${_scale}_percent.pak",
]
foreach(_source_pattern, ios_scalable_pack_extra_source_patterns) {
_source_pattern = string_replace(_source_pattern, "%scale%", _scale)
_source_pattern =
string_replace(_source_pattern, "%root_gen_dir%", root_gen_dir)
sources += [ _source_pattern ]
}
deps = [
"//components/resources",
"//ios/chrome/app/theme",
"//ui/resources",
] + ios_scalable_pack_extra_deps
output = "$target_gen_dir/chrome_${_scale}_percent.pak"
copy_data_to_bundle = true
}
}
group(_target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
public_deps = _scale_target_names
}
}