naiveproxy/ios/chrome/app/resources/ios_chrome_repack.gni
2018-02-02 05:49:39 -05:00

107 lines
3.5 KiB
Plaintext

# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//tools/grit/repack.gni")
import("//build/config/chrome_build.gni")
# Wraps repack_locales(), setting the source_patterns and deps required for
# Chrome.
# 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/components_${branding_path_component}_strings_",
"${root_gen_dir}/components/strings/components_locale_settings_",
"${root_gen_dir}/components/strings/components_strings_",
"${root_gen_dir}/ios/chrome/ios_${branding_path_component}_strings_",
"${root_gen_dir}/ios/chrome/ios_strings_",
"${root_gen_dir}/third_party/libaddressinput/address_input_strings_",
"${root_gen_dir}/ui/strings/app_locale_settings_",
"${root_gen_dir}/ui/strings/ui_strings_",
]
deps = [
"//components/strings:components_${branding_path_component}_strings",
"//components/strings:components_locale_settings",
"//components/strings:components_strings",
"//ios/chrome/app/strings:ios_${branding_path_component}_strings",
"//ios/chrome/app/strings:ios_strings",
"//third_party/libaddressinput:strings",
"//ui/strings:app_locale_settings",
"//ui/strings:ui_strings",
]
copy_data_to_bundle = true
}
}
# Template to repack all scalable resources at a given scale.
#
# Arguments
#
# scale
# string, scale as a percentage, e.g. "200" corresponds to @2x scale.
#
# Generates a bundle_data target for convenience.
template("_ios_chrome_repack_one_scale") {
assert(defined(invoker.scale), "scale must be defined for ${target_name}")
repack(target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
sources = [
"${root_gen_dir}/components/components_resources_${invoker.scale}_percent.pak",
"${root_gen_dir}/ios/chrome/ios_theme_resources_${invoker.scale}_percent.pak",
"${root_gen_dir}/ui/resources/ui_resources_${invoker.scale}_percent.pak",
]
deps = [
"//components/resources",
"//ios/chrome/app/theme",
"//ui/resources",
]
output = "$target_gen_dir/chrome_${invoker.scale}_percent.pak"
copy_data_to_bundle = true
}
}
# Template to repack all scalable resources at all scales.
#
# 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_all_scales") {
assert(defined(invoker.scales), "scales must be defined for ${target_name}")
_scale_targets = []
_target_name = target_name
foreach(_scale, invoker.scales) {
_scale_targets += [ ":${_target_name}_${_scale}_percent" ]
_ios_chrome_repack_one_scale("${_target_name}_${_scale}_percent") {
forward_variables_from(invoker, [ "testonly" ])
visibility = [ ":${_target_name}" ]
scale = _scale
}
}
group(_target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
public_deps = _scale_targets
}
}