# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//remoting/remoting_locales.gni")
import("//tools/grit/grit_rule.gni")
group("resources") {
public_deps = [
":copy_locales",
":strings",
":verify_resources",
]
}
action("verify_resources") {
script = "//remoting/tools/verify_resources.py"
sources_to_verify = [
"../host/continue_window_mac.mm",
"../host/disconnect_window_mac.mm",
"../host/installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.jinja2",
"../host/win/core.rc.jinja2",
"../host/win/host_messages.mc.jinja2",
"../host/win/version.rc.jinja2",
]
inputs = [ "remoting_strings.grd" ] + sources_to_verify
stampfile = "$root_out_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)
}
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
outputs = [ "remoting/base/string_resources.h" ]
# The grd produces a *.pak file and a messages.json file (this one uses
# underscores instead of hyphens) for each locale.
outputs +=
process_file_template(remoting_locales_with_pseudolocales,
[ "remoting/resources/{{source_name_part}}.pak" ])
outputs += remoting_resources_locale_files
if (is_official_build) {
defines = [ "_official_build" ]
}
}
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,
[ "$root_gen_dir/remoting/resources/{{source_name_part}}.pak" ])
# Likewise, process the outputs in the same way as the inputs.
if (is_apple) {
# On mac, use underscores instead of hyphens and put the files in a
# different place.
outputs = process_file_template(
remoting_locales_with_underscores,
[ "$root_out_dir/remoting/resources/{{source_name_part}}.lproj/locale.pak" ])
} else {
outputs = process_file_template(
remoting_locales,
[ "$root_out_dir/remoting_locales/{{source_name_part}}.pak" ])
}
args = [
"-p",
current_os,
"-g",
rebase_path(root_gen_dir, root_build_dir),
"-x",
rebase_path(root_out_dir, root_build_dir),
] + remoting_locales
deps = [ ":strings" ]
}