Make setRemapKeys user-invokable and save the value per-host.
[chromium-blink-merge.git] / remoting / webapp / build_template.gni
blob5d4233c9ccd25be43dc0d6ab795db51e2616753f
1 # Copyright 2015 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.
5 # Keep in sync with 'remoting_webapp' target in remoting/remoting_client.gypi.
7 import("//build/config/chrome_build.gni")
8 import("//remoting/remoting_locales.gni")
9 import("//remoting/remoting_options.gni")
10 import("//remoting/remoting_version.gni")
11 import("//remoting/webapp/files.gni")
13 # The base remoting directory that is used as the root directory for file
14 # references. Many of the scripts rely on the files being specified relative
15 # to this directory.
16 remoting_dir = "//remoting"
18 template("remoting_webapp") {
19   locales_listfile = target_name + "_locales"
20   listfile = "$target_gen_dir/${target_name}_locales.txt"
21   listfile_rel = rebase_path(listfile, root_build_dir)
23   action(locales_listfile) {
24     script = "../tools/build/remoting_localize.py"
26     inputs = []
27     outputs = [
28       listfile,
29     ]
31     args = [
32       "--locale_output",
33       rebase_path(webapp_locale_dir, root_build_dir) +
34           "/@{json_suffix}/messages.json",
35       "--locales_listfile",
36       listfile_rel,
37     ]
38     args += remoting_locales
39   }
41   action(target_name) {
42     script = "build-webapp.py"
44     webapp_type = invoker.webapp_type
45     output_dir = invoker.output_dir
46     zip_path = invoker.zip_path
47     extra_files = invoker.extra_files
49     inputs = []
50     outputs = [
51       "$target_gen_dir/$zip_path",
52     ]
54     deps = [
55       ":html",
56       ":$locales_listfile",
57       "//remoting/resources",
58     ]
60     buildtype = "Dev"
61     if (!is_debug) {
62       if (is_official_build) {
63         buildtype = "Official"
64       } else {
65         buildtype = "Release"
66       }
67     }
69     generated_html_files = [
70       "$target_gen_dir/background.html",
71       "$target_gen_dir/main.html",
72       "$target_gen_dir/message_window.html",
73       "$target_gen_dir/wcs_sandbox.html",
74     ]
76     # Create a file that contains a list of all the resource files needed
77     # to build the webapp. This is needed to avoid problems on platforms that
78     # limit the size of a command line.
79     file_list = "$target_gen_dir/${target_name}_file_list.txt"
80     files = []
81     files += rebase_path(generated_html_files, root_build_dir)
82     files += rebase_path(remoting_webapp_crd_files, root_build_dir)
83     files += rebase_path(extra_files, root_build_dir)
84     write_file(file_list, files)
86     args = [
87       buildtype,
88       version_full,
89       output_dir,
90       zip_path,
91       rebase_path("crd/manifest.json.jinja2", root_build_dir),
92       webapp_type,
93     ]
94     args += [
95       "--files_listfile",
96       rebase_path(file_list, root_build_dir),
97     ]
98     args += [
99       "--locales_listfile",
100       listfile_rel,
101     ]
102     args += [
103       "--use_gcd",
104       "$remoting_use_gcd",
105     ]
106   }