forked from brave/brave-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
brave_paks.gni
161 lines (147 loc) · 5.24 KB
/
brave_paks.gni
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import("//build/config/locales.gni")
import("//chrome/common/features.gni")
import("//extensions/buildflags/buildflags.gni")
import("//tools/grit/repack.gni")
import("//ui/base/ui_features.gni")
# Generates a rule to repack a set of resources, substituting a given string
# in for the percentage (e.g. "100", "200"). It generates the repacked files in
# the "gen" directory, and then introduces a copy rule to copy it to the root
# build directory.
#
# Argument:
# percent [required]
# String to substitute for the percentage.
template("brave_repack_percent") {
percent = invoker.percent
repack(target_name) {
forward_variables_from(invoker,
[
"copy_data_to_bundle",
"repack_whitelist",
"visibility",
])
# All sources should also have deps for completeness.
sources = [
"$root_gen_dir/brave/brave_theme_resources_${percent}_percent.pak",
]
deps = [
"//brave/app/theme:brave_theme_resources",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
output = "${invoker.output_dir}/brave_${percent}_percent.pak"
}
}
template("brave_extra_paks") {
repack(target_name) {
forward_variables_from(invoker,
[
"copy_data_to_bundle",
"repack_whitelist",
"visibility",
])
output = "${invoker.output_dir}/brave_resources.pak"
sources = [
"$root_gen_dir/brave/brave_generated_resources.pak",
"$root_gen_dir/brave/brave_unscaled_resources.pak",
"$root_gen_dir/brave/browser/resources/brave_settings_resources.pak",
"$root_gen_dir/components/brave_components_resources.pak",
"$root_gen_dir/components/brave_components_strings.pak",
"$root_gen_dir/brave/components/brave_rewards/resources/brave_rewards_resources.pak",
"$root_gen_dir/brave/components/brave_rewards/resources/extension/brave_rewards_extension_resources.pak",
"$target_gen_dir/browser/resources/brave_extension.pak",
"$target_gen_dir/components/brave_webtorrent/brave_webtorrent_resources.pak",
]
deps = [
"//brave/app:brave_generated_resources_grit",
"//brave/app/theme:brave_unscaled_resources",
"//brave/components/brave_rewards/resources",
"//brave/components/brave_rewards/resources/extension:resources",
"//brave/components/brave_webtorrent:resources",
"//brave/components/resources",
"//brave/components/resources:strings",
"//brave/browser/resources:brave_extension_grit",
"//brave/browser/resources:brave_settings_resources",
"//brave/common/extensions/api"
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (defined(invoker.additional_paks)) {
sources += invoker.additional_paks
}
}
}
# Defines repack() targets used by Brave. Specifically:
# * brave_100_percent.pak
# * brave_200_percent.pak (optionally)
# * resources.pak
#
# Paramters:
# output_dir [required]: Directory to output .pak files.
# additional_extra_paks: List of extra .pak sources for resources.pak.
# locale_whitelist: if set, override repack_whitelist for locale .pak files.
# copy_data_to_bundle:
# deps:
# output_dir:
# public_deps:
# repack_whitelist:
# visibility:
# Normal meanings.
#
template("brave_paks") {
brave_repack_percent("${target_name}_100_percent") {
percent = "100"
forward_variables_from(invoker,
[
"copy_data_to_bundle",
"deps",
"output_dir",
"repack_whitelist",
"visibility",
])
}
if (enable_hidpi) {
brave_repack_percent("${target_name}_200_percent") {
percent = "200"
forward_variables_from(invoker,
[
"copy_data_to_bundle",
"deps",
"output_dir",
"repack_whitelist",
"visibility",
])
}
}
brave_extra_paks("${target_name}_extra") {
forward_variables_from(invoker,
[
"copy_data_to_bundle",
"deps",
"output_dir",
"repack_whitelist",
"visibility",
])
if (defined(invoker.additional_extra_paks)) {
additional_paks = invoker.additional_extra_paks
}
}
group(target_name) {
forward_variables_from(invoker, [ "deps" ])
public_deps = [
":${target_name}_100_percent",
":${target_name}_extra",
]
if (enable_hidpi) {
public_deps += [ ":${target_name}_200_percent" ]
}
if (defined(invoker.public_deps)) {
public_deps += invoker.public_deps
}
}
}