naiveproxy/ios/web_view/repack.gni

71 lines
2.0 KiB
Plaintext
Raw Normal View History

2018-08-15 01:19:20 +03:00
# Copyright 2018 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")
# 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_web_view_repack_one_scale") {
assert(defined(invoker.scale), "scale must be defined for ${target_name}")
repack(target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
sources = [
# TODO(crbug.com/842244): Bundle less resources.
"${root_gen_dir}/components/components_resources_${invoker.scale}_percent.pak",
]
deps = [
"//components/resources:components_scaled_resources",
]
output = "$target_gen_dir/web_view_${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_web_view_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_web_view_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
}
}