Chromium Code Reviews| Index: remoting/resources/BUILD.gn |
| diff --git a/remoting/resources/BUILD.gn b/remoting/resources/BUILD.gn |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..01829b4b03ce9d878c0ff0caf7caa772e0c40be1 |
| --- /dev/null |
| +++ b/remoting/resources/BUILD.gn |
| @@ -0,0 +1,262 @@ |
| +# Copyright 2014 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/grit_rule.gni") |
| + |
| +# See also remoting_locales_hyphenated_names below. |
| +remoting_locales = [ |
| + "ar", |
| + "bg", |
| + "ca", |
| + "cs", |
| + "da", |
| + "de", |
| + "el", |
| + "en", |
| + "en-GB", |
| + "es", |
| + "es-419", |
| + "et", |
| + "fi", |
| + "fil", |
| + "fr", |
| + "he", |
| + "hi", |
| + "hr", |
| + "hu", |
| + "id", |
| + "it", |
| + "ja", |
| + "ko", |
| + "lt", |
| + "lv", |
| + "nb", |
| + "nl", |
| + "pl", |
| + "pt-BR", |
| + "pt-PT", |
| + "ro", |
| + "ru", |
| + "sk", |
| + "sl", |
| + "sr", |
| + "sv", |
| + "th", |
| + "tr", |
| + "uk", |
| + "vi", |
| + "zh-CN", |
| + "zh-TW", |
| +] |
| + |
| +# The set of locale names with hyphens in them. |
| +remoting_locales_hyphenated_names = [ |
| + "en-GB", |
| + "es-419", |
| + "pt-BR", |
| + "pt-PT", |
| + "zh-CN", |
| + "zh-TW", |
| +] |
| + |
| +# The hyphenated locale names with underscores instead. |
| +remoting_locales_underscore_names = [ |
| + "en_GB", |
| + "es_419", |
| + "pt_BR", |
| + "pt_PT", |
| + "zh_CN", |
| + "zh_TW", |
| +] |
| + |
| +group("resources") { |
| + deps = [ |
| + ":copy_locales", |
| + ":strings", |
| + #":verify_resources", TODO(GYP) enable this. |
| + ] |
| +} |
| + |
| +# TODO(GYP) enable verify_resources. The bots are complaining about |
| +# gen/main.html not being found but this doesn't seems to reproduce locally. |
| +if (false) { |
| + |
| +action("verify_resources") { |
| + script = "//remoting/tools/verify_resources.py" |
| + |
| + sources_to_verify = [ |
| + "$root_gen_dir/main.html", |
| + "../base/resources_unittest.cc", |
| + "../host/continue_window_mac.mm", |
| + "../host/disconnect_window_mac.mm", |
| + "../host/installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.jinja2", |
| + "../host/mac/me2me_preference_pane-InfoPlist.strings.jinja2", |
| + "../host/win/core.rc.jinja2", |
| + "../host/win/host_messages.mc.jinja2", |
| + "../host/win/version.rc.jinja2", |
| + "../resources/play_store_resources.cc", |
| + "../webapp/background/background.js", |
| + "../webapp/butter_bar.js", |
| + "../webapp/client_screen.js", |
| + "../webapp/error.js", |
| + "../webapp/host_list.js", |
| + "../webapp/host_setup_dialog.js", |
| + "../webapp/host_table_entry.js", |
| + "../webapp/manifest.json.jinja2", |
| + "../webapp/paired_client_manager.js", |
| + "../webapp/remoting.js", |
| + "../webapp/window_frame.js", |
| + ] |
| + |
| + inputs = [ |
| + "remoting_strings.grd", |
| + ] + sources_to_verify |
| + |
| + stampfile = "$root_build_dir/remoting_resources_verified_stamp" |
| + outputs = [ stampfile ] |
| + |
| + args = [ |
| + "-t", rebase_path(stampfile, root_build_dir), |
| + "-r", rebase_path("remoting_strings.grd", root_build_dir), |
| + ] + rebase_path(sources_to_verify, root_build_dir) |
| + |
| + deps = [ "//remoting/webapp:html" ] # Generates main.html. |
| +} |
| + |
| +} # if false |
| + |
| +grit("strings") { |
| + source = "remoting_strings.grd" |
| + output_name = "remoting_strings" |
| + |
| + # The grd file encodes "remoting/..." in the name, so root everything in the |
| + # generated file root. |
| + output_dir = root_gen_dir |
| + |
| + resource_ids = "resource_ids" |
| + |
| + outputs = [ |
| + "remoting/base/string_resources.h", |
| + "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.
|
| + "remoting/resources/bg.pak", |
| + "remoting/resources/ca.pak", |
| + "remoting/resources/cs.pak", |
| + "remoting/resources/da.pak", |
| + "remoting/resources/de.pak", |
| + "remoting/resources/el.pak", |
| + "remoting/resources/en-GB.pak", |
| + "remoting/resources/en.pak", |
| + "remoting/resources/es-419.pak", |
| + "remoting/resources/es.pak", |
| + "remoting/resources/et.pak", |
| + "remoting/resources/fi.pak", |
| + "remoting/resources/fil.pak", |
| + "remoting/resources/fr.pak", |
| + "remoting/resources/he.pak", |
| + "remoting/resources/hi.pak", |
| + "remoting/resources/hr.pak", |
| + "remoting/resources/hu.pak", |
| + "remoting/resources/id.pak", |
| + "remoting/resources/it.pak", |
| + "remoting/resources/ja.pak", |
| + "remoting/resources/ko.pak", |
| + "remoting/resources/lt.pak", |
| + "remoting/resources/lv.pak", |
| + "remoting/resources/nb.pak", |
| + "remoting/resources/nl.pak", |
| + "remoting/resources/pl.pak", |
| + "remoting/resources/pt-BR.pak", |
| + "remoting/resources/pt-PT.pak", |
| + "remoting/resources/ro.pak", |
| + "remoting/resources/ru.pak", |
| + "remoting/resources/sk.pak", |
| + "remoting/resources/sl.pak", |
| + "remoting/resources/sr.pak", |
| + "remoting/resources/sv.pak", |
| + "remoting/resources/th.pak", |
| + "remoting/resources/tr.pak", |
| + "remoting/resources/uk.pak", |
| + "remoting/resources/vi.pak", |
| + "remoting/resources/zh-CN.pak", |
| + "remoting/resources/zh-TW.pak", |
| + "remoting/webapp/_locales/ar/messages.json", |
| + "remoting/webapp/_locales/bg/messages.json", |
| + "remoting/webapp/_locales/ca/messages.json", |
| + "remoting/webapp/_locales/cs/messages.json", |
| + "remoting/webapp/_locales/da/messages.json", |
| + "remoting/webapp/_locales/de/messages.json", |
| + "remoting/webapp/_locales/el/messages.json", |
| + "remoting/webapp/_locales/en/messages.json", |
| + "remoting/webapp/_locales/en_GB/messages.json", |
| + "remoting/webapp/_locales/es/messages.json", |
| + "remoting/webapp/_locales/es_419/messages.json", |
| + "remoting/webapp/_locales/et/messages.json", |
| + "remoting/webapp/_locales/fi/messages.json", |
| + "remoting/webapp/_locales/fil/messages.json", |
| + "remoting/webapp/_locales/fr/messages.json", |
| + "remoting/webapp/_locales/he/messages.json", |
| + "remoting/webapp/_locales/hi/messages.json", |
| + "remoting/webapp/_locales/hr/messages.json", |
| + "remoting/webapp/_locales/hu/messages.json", |
| + "remoting/webapp/_locales/id/messages.json", |
| + "remoting/webapp/_locales/it/messages.json", |
| + "remoting/webapp/_locales/ja/messages.json", |
| + "remoting/webapp/_locales/ko/messages.json", |
| + "remoting/webapp/_locales/lt/messages.json", |
| + "remoting/webapp/_locales/lv/messages.json", |
| + "remoting/webapp/_locales/nb/messages.json", |
| + "remoting/webapp/_locales/nl/messages.json", |
| + "remoting/webapp/_locales/pl/messages.json", |
| + "remoting/webapp/_locales/pt_BR/messages.json", |
| + "remoting/webapp/_locales/pt_PT/messages.json", |
| + "remoting/webapp/_locales/ro/messages.json", |
| + "remoting/webapp/_locales/ru/messages.json", |
| + "remoting/webapp/_locales/sk/messages.json", |
| + "remoting/webapp/_locales/sl/messages.json", |
| + "remoting/webapp/_locales/sr/messages.json", |
| + "remoting/webapp/_locales/sv/messages.json", |
| + "remoting/webapp/_locales/th/messages.json", |
| + "remoting/webapp/_locales/tr/messages.json", |
| + "remoting/webapp/_locales/uk/messages.json", |
| + "remoting/webapp/_locales/vi/messages.json", |
| + "remoting/webapp/_locales/zh_CN/messages.json", |
| + "remoting/webapp/_locales/zh_TW/messages.json", |
| + ] |
| +} |
| + |
| +action("copy_locales") { |
| + script = "../tools/build/remoting_copy_locales.py" |
| + |
| + # The gyp build calls out to Python, but the Python just computes a simple |
| + # replacement over the locales. Here, we can do this in GN script by |
| + # pretending the locale list is a list of files. The {{source_name_part}} |
| + # will just expand to the locale name. |
| + inputs = process_file_template( |
| + remoting_locales, |
| + [ "$target_gen_dir/{{source_name_part}}.pak" ]) |
| + |
| + # Likewise, process the outputs in the same way as the inputs. |
| + if (is_mac || is_ios) { |
| + # On mac, use underscores instead of hyphens and put the files in a |
| + # different place. |
| + outputs = process_file_template( |
| + remoting_locales - remoting_locales_hyphenated_names + |
| + remoting_locales_underscore_names, |
| + [ "$root_build_dir/remoting/resources/{{source_name_part}}.lproj/locale.pak" ]) |
| + } else { |
| + assert(remoting_locales_hyphenated_names != []) |
| + assert(remoting_locales_underscore_names != []) |
| + outputs = process_file_template( |
| + remoting_locales, |
| + [ "$root_build_dir/remoting_locales/{{source_name_part}}.pak" ]) |
| + } |
| + |
| + args = [ |
| + "-p", os, |
| + "-g", rebase_path(root_gen_dir, root_build_dir), |
| + "-x", rebase_path(root_out_dir, root_build_dir), |
| + ] + remoting_locales |
| + |
| + deps = [ ":strings" ] |
| +} |