OLD | NEW |
---|---|
(Empty) | |
1 # 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 | |
5 import("//tools/grit/grit_rule.gni") | |
6 | |
7 # See also remoting_locales_hyphenated_names below. | |
8 remoting_locales = [ | |
9 "ar", | |
10 "bg", | |
11 "ca", | |
12 "cs", | |
13 "da", | |
14 "de", | |
15 "el", | |
16 "en", | |
17 "en-GB", | |
18 "es", | |
19 "es-419", | |
20 "et", | |
21 "fi", | |
22 "fil", | |
23 "fr", | |
24 "he", | |
25 "hi", | |
26 "hr", | |
27 "hu", | |
28 "id", | |
29 "it", | |
30 "ja", | |
31 "ko", | |
32 "lt", | |
33 "lv", | |
34 "nb", | |
35 "nl", | |
36 "pl", | |
37 "pt-BR", | |
38 "pt-PT", | |
39 "ro", | |
40 "ru", | |
41 "sk", | |
42 "sl", | |
43 "sr", | |
44 "sv", | |
45 "th", | |
46 "tr", | |
47 "uk", | |
48 "vi", | |
49 "zh-CN", | |
50 "zh-TW", | |
51 ] | |
52 | |
53 # The set of locale names with hyphens in them. | |
54 remoting_locales_hyphenated_names = [ | |
55 "en-GB", | |
56 "es-419", | |
57 "pt-BR", | |
58 "pt-PT", | |
59 "zh-CN", | |
60 "zh-TW", | |
61 ] | |
62 | |
63 # The hyphenated locale names with underscores instead. | |
64 remoting_locales_underscore_names = [ | |
65 "en_GB", | |
66 "es_419", | |
67 "pt_BR", | |
68 "pt_PT", | |
69 "zh_CN", | |
70 "zh_TW", | |
71 ] | |
72 | |
73 group("resources") { | |
74 deps = [ | |
75 ":copy_locales", | |
76 ":strings", | |
77 #":verify_resources", TODO(GYP) enable this. | |
78 ] | |
79 } | |
80 | |
81 # TODO(GYP) enable verify_resources. The bots are complaining about | |
82 # gen/main.html not being found but this doesn't seems to reproduce locally. | |
83 if (false) { | |
84 | |
85 action("verify_resources") { | |
86 script = "//remoting/tools/verify_resources.py" | |
87 | |
88 sources_to_verify = [ | |
89 "$root_gen_dir/main.html", | |
90 "../base/resources_unittest.cc", | |
91 "../host/continue_window_mac.mm", | |
92 "../host/disconnect_window_mac.mm", | |
93 "../host/installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.ji nja2", | |
94 "../host/mac/me2me_preference_pane-InfoPlist.strings.jinja2", | |
95 "../host/win/core.rc.jinja2", | |
96 "../host/win/host_messages.mc.jinja2", | |
97 "../host/win/version.rc.jinja2", | |
98 "../resources/play_store_resources.cc", | |
99 "../webapp/background/background.js", | |
100 "../webapp/butter_bar.js", | |
101 "../webapp/client_screen.js", | |
102 "../webapp/error.js", | |
103 "../webapp/host_list.js", | |
104 "../webapp/host_setup_dialog.js", | |
105 "../webapp/host_table_entry.js", | |
106 "../webapp/manifest.json.jinja2", | |
107 "../webapp/paired_client_manager.js", | |
108 "../webapp/remoting.js", | |
109 "../webapp/window_frame.js", | |
110 ] | |
111 | |
112 inputs = [ | |
113 "remoting_strings.grd", | |
114 ] + sources_to_verify | |
115 | |
116 stampfile = "$root_build_dir/remoting_resources_verified_stamp" | |
117 outputs = [ stampfile ] | |
118 | |
119 args = [ | |
120 "-t", rebase_path(stampfile, root_build_dir), | |
121 "-r", rebase_path("remoting_strings.grd", root_build_dir), | |
122 ] + rebase_path(sources_to_verify, root_build_dir) | |
123 | |
124 deps = [ "//remoting/webapp:html" ] # Generates main.html. | |
125 } | |
126 | |
127 } # if false | |
128 | |
129 grit("strings") { | |
130 source = "remoting_strings.grd" | |
131 output_name = "remoting_strings" | |
132 | |
133 # The grd file encodes "remoting/..." in the name, so root everything in the | |
134 # generated file root. | |
135 output_dir = root_gen_dir | |
136 | |
137 resource_ids = "resource_ids" | |
138 | |
139 outputs = [ | |
140 "remoting/base/string_resources.h", | |
141 "remoting/resources/ar.pak", | |
Sergey Ulanov
2014/08/23 02:00:46
Is it possible to generate this list from remoting
brettw
2014/08/25 16:58:14
Yes, good idea. Done.
| |
142 "remoting/resources/bg.pak", | |
143 "remoting/resources/ca.pak", | |
144 "remoting/resources/cs.pak", | |
145 "remoting/resources/da.pak", | |
146 "remoting/resources/de.pak", | |
147 "remoting/resources/el.pak", | |
148 "remoting/resources/en-GB.pak", | |
149 "remoting/resources/en.pak", | |
150 "remoting/resources/es-419.pak", | |
151 "remoting/resources/es.pak", | |
152 "remoting/resources/et.pak", | |
153 "remoting/resources/fi.pak", | |
154 "remoting/resources/fil.pak", | |
155 "remoting/resources/fr.pak", | |
156 "remoting/resources/he.pak", | |
157 "remoting/resources/hi.pak", | |
158 "remoting/resources/hr.pak", | |
159 "remoting/resources/hu.pak", | |
160 "remoting/resources/id.pak", | |
161 "remoting/resources/it.pak", | |
162 "remoting/resources/ja.pak", | |
163 "remoting/resources/ko.pak", | |
164 "remoting/resources/lt.pak", | |
165 "remoting/resources/lv.pak", | |
166 "remoting/resources/nb.pak", | |
167 "remoting/resources/nl.pak", | |
168 "remoting/resources/pl.pak", | |
169 "remoting/resources/pt-BR.pak", | |
170 "remoting/resources/pt-PT.pak", | |
171 "remoting/resources/ro.pak", | |
172 "remoting/resources/ru.pak", | |
173 "remoting/resources/sk.pak", | |
174 "remoting/resources/sl.pak", | |
175 "remoting/resources/sr.pak", | |
176 "remoting/resources/sv.pak", | |
177 "remoting/resources/th.pak", | |
178 "remoting/resources/tr.pak", | |
179 "remoting/resources/uk.pak", | |
180 "remoting/resources/vi.pak", | |
181 "remoting/resources/zh-CN.pak", | |
182 "remoting/resources/zh-TW.pak", | |
183 "remoting/webapp/_locales/ar/messages.json", | |
184 "remoting/webapp/_locales/bg/messages.json", | |
185 "remoting/webapp/_locales/ca/messages.json", | |
186 "remoting/webapp/_locales/cs/messages.json", | |
187 "remoting/webapp/_locales/da/messages.json", | |
188 "remoting/webapp/_locales/de/messages.json", | |
189 "remoting/webapp/_locales/el/messages.json", | |
190 "remoting/webapp/_locales/en/messages.json", | |
191 "remoting/webapp/_locales/en_GB/messages.json", | |
192 "remoting/webapp/_locales/es/messages.json", | |
193 "remoting/webapp/_locales/es_419/messages.json", | |
194 "remoting/webapp/_locales/et/messages.json", | |
195 "remoting/webapp/_locales/fi/messages.json", | |
196 "remoting/webapp/_locales/fil/messages.json", | |
197 "remoting/webapp/_locales/fr/messages.json", | |
198 "remoting/webapp/_locales/he/messages.json", | |
199 "remoting/webapp/_locales/hi/messages.json", | |
200 "remoting/webapp/_locales/hr/messages.json", | |
201 "remoting/webapp/_locales/hu/messages.json", | |
202 "remoting/webapp/_locales/id/messages.json", | |
203 "remoting/webapp/_locales/it/messages.json", | |
204 "remoting/webapp/_locales/ja/messages.json", | |
205 "remoting/webapp/_locales/ko/messages.json", | |
206 "remoting/webapp/_locales/lt/messages.json", | |
207 "remoting/webapp/_locales/lv/messages.json", | |
208 "remoting/webapp/_locales/nb/messages.json", | |
209 "remoting/webapp/_locales/nl/messages.json", | |
210 "remoting/webapp/_locales/pl/messages.json", | |
211 "remoting/webapp/_locales/pt_BR/messages.json", | |
212 "remoting/webapp/_locales/pt_PT/messages.json", | |
213 "remoting/webapp/_locales/ro/messages.json", | |
214 "remoting/webapp/_locales/ru/messages.json", | |
215 "remoting/webapp/_locales/sk/messages.json", | |
216 "remoting/webapp/_locales/sl/messages.json", | |
217 "remoting/webapp/_locales/sr/messages.json", | |
218 "remoting/webapp/_locales/sv/messages.json", | |
219 "remoting/webapp/_locales/th/messages.json", | |
220 "remoting/webapp/_locales/tr/messages.json", | |
221 "remoting/webapp/_locales/uk/messages.json", | |
222 "remoting/webapp/_locales/vi/messages.json", | |
223 "remoting/webapp/_locales/zh_CN/messages.json", | |
224 "remoting/webapp/_locales/zh_TW/messages.json", | |
225 ] | |
226 } | |
227 | |
228 action("copy_locales") { | |
229 script = "../tools/build/remoting_copy_locales.py" | |
230 | |
231 # The gyp build calls out to Python, but the Python just computes a simple | |
232 # replacement over the locales. Here, we can do this in GN script by | |
233 # pretending the locale list is a list of files. The {{source_name_part}} | |
234 # will just expand to the locale name. | |
235 inputs = process_file_template( | |
236 remoting_locales, | |
237 [ "$target_gen_dir/{{source_name_part}}.pak" ]) | |
238 | |
239 # Likewise, process the outputs in the same way as the inputs. | |
240 if (is_mac || is_ios) { | |
241 # On mac, use underscores instead of hyphens and put the files in a | |
242 # different place. | |
243 outputs = process_file_template( | |
244 remoting_locales - remoting_locales_hyphenated_names + | |
245 remoting_locales_underscore_names, | |
246 [ "$root_build_dir/remoting/resources/{{source_name_part}}.lproj/locale. pak" ]) | |
247 } else { | |
248 assert(remoting_locales_hyphenated_names != []) | |
249 assert(remoting_locales_underscore_names != []) | |
250 outputs = process_file_template( | |
251 remoting_locales, | |
252 [ "$root_build_dir/remoting_locales/{{source_name_part}}.pak" ]) | |
253 } | |
254 | |
255 args = [ | |
256 "-p", os, | |
257 "-g", rebase_path(root_gen_dir, root_build_dir), | |
258 "-x", rebase_path(root_out_dir, root_build_dir), | |
259 ] + remoting_locales | |
260 | |
261 deps = [ ":strings" ] | |
262 } | |
OLD | NEW |