blob: 0feee31e074b6932a865b26f220ba717ee856b01 [file] [log] [blame]
[email protected]4c047c02014-04-21 22:41:191# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//tools/grit/grit_rule.gni")
[email protected]604828c2014-07-02 20:39:126import("//tools/grit/repack.gni")
[email protected]4c047c02014-04-21 22:41:197
[email protected]604828c2014-07-02 20:39:128group("resources") {
brettw717185d2015-09-18 19:58:579 public_deps = [
[email protected]604828c2014-07-02 20:39:1210 ":ui_resources_grd",
11 ":ui_unscaled_resources_grd",
12 ":webui_resources_grd",
13 ]
14}
15
16grit("ui_resources_grd") {
[email protected]4c047c02014-04-21 22:41:1917 source = "ui_resources.grd"
[email protected]b89c53842014-07-23 16:32:3218 outputs = [
19 "grit/ui_resources.h",
20 "grit/ui_resources_map.cc",
21 "grit/ui_resources_map.h",
22 "ui_resources_100_percent.pak",
23 "ui_resources_200_percent.pak",
lliabraaea7d7402014-10-31 22:09:3824 "ui_resources_300_percent.pak",
[email protected]b89c53842014-07-23 16:32:3225 ]
[email protected]4c047c02014-04-21 22:41:1926}
[email protected]b3df0ff2014-05-20 19:20:4027
[email protected]604828c2014-07-02 20:39:1228grit("ui_unscaled_resources_grd") {
[email protected]b3df0ff2014-05-20 19:20:4029 source = "ui_unscaled_resources.grd"
[email protected]b89c53842014-07-23 16:32:3230 outputs = [
31 "grit/ui_unscaled_resources.h",
32 "ui_unscaled_resources.rc",
33 ]
[email protected]b3df0ff2014-05-20 19:20:4034}
[email protected]604828c2014-07-02 20:39:1235
36grit("webui_resources_grd") {
[email protected]604828c2014-07-02 20:39:1237 source = "../webui/resources/webui_resources.grd"
[email protected]b89c53842014-07-23 16:32:3238 outputs = [
39 "grit/webui_resources.h",
40 "grit/webui_resources_map.cc",
41 "grit/webui_resources_map.h",
42 "webui_resources.pak",
43 ]
Ken Rockotea19acc2017-06-07 00:34:3144 grit_flags = [
45 "-E",
46 "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
47 ]
48 deps = [
49 "//mojo/public/js:bindings",
50 ]
[email protected]604828c2014-07-02 20:39:1251}
52
53if (!is_mac) {
54 copy("copy_ui_resources_100_percent") {
scottmgbba95ce2014-12-03 07:28:2355 sources = [
56 "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
57 ]
scottmg34fb7e52014-12-03 23:27:2458 outputs = [
59 "$root_out_dir/ui_resources_100_percent.pak",
60 ]
scottmgbba95ce2014-12-03 07:28:2361 deps = [
62 "//ui/resources",
63 ]
[email protected]604828c2014-07-02 20:39:1264 }
65}
66
tapted9573ca92014-09-15 01:13:5167# On iOS and Mac the string resources need to go into a locale subfolder, which
68# introduces an extra dependency.
tapted9573ca92014-09-15 01:13:5169if (is_ios || is_mac) {
70 group("ui_test_pak") {
brettwde262b02015-05-27 19:41:4271 public_deps = [
scottmgbba95ce2014-12-03 07:28:2372 ":repack_ui_test_mac_locale_pack",
tapted66badf72016-10-12 11:12:3973 ":repack_ui_test_pak_100_percent",
scottmgbba95ce2014-12-03 07:28:2374 ]
[email protected]604828c2014-07-02 20:39:1275 }
sdefresne0e1a1b3a2016-03-17 10:12:5176
77 # This needs to be a separate target from ui_test_pak as ui_base_unittests
78 # wants the generate .pak file in the bundle to be named en.lpro/locale.pak
79 # while components_unittests wants it to be named ui_test.pak.
rsesek80fb939c2016-04-07 21:36:4680 bundle_data("ui_test_pak_bundle_data_locale") {
sdefresnefd1d0392016-03-19 14:20:4481 testonly = true
rsesek80fb939c2016-04-07 21:36:4682 visibility = [ ":ui_test_pak_bundle_data" ]
sdefresne0e1a1b3a2016-03-17 10:12:5183 public_deps = [
84 ":ui_test_pak",
85 ]
86 sources = [
87 "$root_out_dir/ui_test.pak",
88 ]
89 outputs = [
90 "{{bundle_resources_dir}}/en.lproj/locale.pak",
91 ]
92 }
rsesek80fb939c2016-04-07 21:36:4693
94 bundle_data("ui_test_pak_bundle_data_test_pak") {
95 testonly = true
96 visibility = [ ":ui_test_pak_bundle_data" ]
97 public_deps = [
98 ":ui_test_pak",
99 ]
100 sources = [
101 "$root_out_dir/ui_test.pak",
102 ]
103 outputs = [
104 "{{bundle_resources_dir}}/ui_test.pak",
105 ]
106 }
107
108 bundle_data("ui_test_pak_bundle_data_100_percent") {
109 testonly = true
110 visibility = [ ":ui_test_pak_bundle_data" ]
111 public_deps = [
112 ":ui_test_pak",
113 ]
114 sources = [
115 "$root_out_dir/ui_test.pak",
116 ]
117 outputs = [
118 "{{bundle_resources_dir}}/chrome_100_percent.pak",
119 ]
120 }
121
122 group("ui_test_pak_bundle_data") {
123 testonly = true
124 public_deps = [
125 ":ui_test_pak_bundle_data_100_percent",
126 ":ui_test_pak_bundle_data_locale",
127 ":ui_test_pak_bundle_data_test_pak",
128 ]
129 }
[email protected]604828c2014-07-02 20:39:12130} else {
brettwfc2f1362015-04-17 19:00:02131 copy("ui_test_pak") {
132 sources = [
133 "$root_out_dir/ui_test.pak",
134 ]
135 outputs = [
136 "$root_out_dir/ui/en-US.pak",
137 ]
brettwde262b02015-05-27 19:41:42138 public_deps = [
tapted66badf72016-10-12 11:12:39139 ":repack_ui_test_pak_100_percent",
scottmgbba95ce2014-12-03 07:28:23140 ]
[email protected]604828c2014-07-02 20:39:12141 }
142}
143
tapted66badf72016-10-12 11:12:39144# This group exists just for targets that need the data file to exist in the
145# build directory so it can be loaded for test purposes. If a target requires
146# 200 percent resources it should also depend on ui_test_pak_data_200_percent.
dpranke30cf0d52015-09-02 22:38:11147group("ui_test_pak_data") {
tfarinaf7698e02015-11-03 00:49:39148 data_deps = [
tapted66badf72016-10-12 11:12:39149 ":repack_ui_test_pak_100_percent",
tfarinaf7698e02015-11-03 00:49:39150 ]
dpranke30cf0d52015-09-02 22:38:11151}
152
tapted66badf72016-10-12 11:12:39153group("ui_test_pak_data_200_percent") {
154 data_deps = [
155 ":repack_ui_test_pak_200_percent",
156 ]
157}
158
159repack("repack_ui_test_pak_100_percent") {
dpranke30cf0d52015-09-02 22:38:11160 # Depend on ui_test_pak or ui_test_pak_data instead of this one.
161 visibility = [
162 ":ui_test_pak",
163 ":ui_test_pak_data",
164 ]
[email protected]604828c2014-07-02 20:39:12165
tapted9573ca92014-09-15 01:13:51166 sources = [
[email protected]604828c2014-07-02 20:39:12167 "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
168 "$root_gen_dir/ui/resources/webui_resources.pak",
169 "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
170 "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
171 ]
172
stevenjbd0502302014-10-30 20:07:48173 if (is_chromeos) {
174 sources += [
175 "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_100_percent.pak",
176 "$root_gen_dir/ui/chromeos/strings/ui_chromeos_strings_en-US.pak",
177 ]
178 }
179
[email protected]604828c2014-07-02 20:39:12180 output = "$root_out_dir/ui_test.pak"
181
182 deps = [
183 "//ui/resources",
184 "//ui/strings",
185 ]
186
sherouk80095df2015-08-07 15:15:47187 if (!is_ios) {
188 deps += [ "//third_party/WebKit/public:resources_grit" ]
189 }
190
[email protected]604828c2014-07-02 20:39:12191 if (!is_mac) {
192 deps += [ ":copy_ui_resources_100_percent" ]
193 }
stevenjbd0502302014-10-30 20:07:48194
195 if (is_chromeos) {
196 deps += [
197 "//ui/chromeos/resources",
198 "//ui/chromeos/strings",
199 ]
200 }
sadrul7bd20c92015-06-24 16:45:44201
202 if (toolkit_views) {
203 deps += [ "//ui/views/resources" ]
jackhoufe323b592015-08-07 06:58:55204 sources += [
205 "$root_gen_dir/blink/public/resources/blink_resources.pak",
206 "$root_gen_dir/ui/views/resources/views_resources_100_percent.pak",
207 ]
sadrul7bd20c92015-06-24 16:45:44208 }
bshece2227442015-08-19 16:20:35209
tapted87ca2d62016-05-19 20:48:49210 if (use_aura && toolkit_views) {
bshece2227442015-08-19 16:20:35211 deps += [ "//ui/app_list/resources" ]
212 sources += [ "$root_gen_dir/ui/app_list/resources/app_list_resources_100_percent.pak" ]
213 }
[email protected]604828c2014-07-02 20:39:12214}
tapted9573ca92014-09-15 01:13:51215
tapted66badf72016-10-12 11:12:39216repack("repack_ui_test_pak_200_percent") {
217 visibility = [ ":ui_test_pak_data_200_percent" ]
218
219 sources = [
220 "$root_gen_dir/ui/resources/ui_resources_200_percent.pak",
221 ]
222
223 output = "$root_out_dir/ui_test_200_percent.pak"
224
225 deps = [
226 "//ui/resources",
227 ]
228
229 if (toolkit_views) {
230 deps += [ "//ui/views/resources" ]
231 sources +=
232 [ "$root_gen_dir/ui/views/resources/views_resources_200_percent.pak" ]
233 }
234}
235
tapted9573ca92014-09-15 01:13:51236# Repack just the strings for the framework locales on Mac and iOS. This
237# emulates repack_locales.py, but just for en-US. Note ui_test.pak is not simply
238# copied, because it causes leaks from allocations within system libraries when
239# trying to load non-string resources. http://crbug.com/413034.
240repack("repack_ui_test_mac_locale_pack") {
brettweb7dc65852016-05-24 01:19:43241 visibility = [ ":ui_test_pak" ]
tapted9573ca92014-09-15 01:13:51242
243 sources = [
244 "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
245 "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
246 ]
247
248 output = "$root_out_dir/ui/en.lproj/locale.pak"
249
250 deps = [
251 "//ui/strings",
252 ]
253}