Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: remoting/webapp/build_template.gni

Issue 1143643003: [Chromoting] Add GN build support for ar_sample_app target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Keep in sync with 'remoting_webapp' target in remoting/remoting_client.gypi. 5 # Keep in sync with 'remoting_webapp' target in remoting/remoting_client.gypi.
6 6
7 import("//build/config/chrome_build.gni") 7 import("//build/config/chrome_build.gni")
8 import("//remoting/remoting_locales.gni") 8 import("//remoting/remoting_locales.gni")
9 import("//remoting/remoting_options.gni") 9 import("//remoting/remoting_options.gni")
10 import("//remoting/remoting_version.gni") 10 import("//remoting/remoting_version.gni")
11 import("//remoting/webapp/files.gni") 11 import("//remoting/webapp/files.gni")
12 12
13 # The base remoting directory that is used as the root directory for file 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 14 # references. Many of the scripts rely on the files being specified relative
15 # to this directory. 15 # to this directory.
16 remoting_dir = "//remoting" 16 remoting_dir = "//remoting"
17 17
18 template("remoting_webapp") { 18 buildtype = "Dev"
19 locales_listfile = target_name + "_locales" 19 if (!is_debug) {
20 listfile = "$target_gen_dir/${target_name}_locales.txt" 20 if (is_official_build) {
21 listfile_rel = rebase_path(listfile, root_build_dir) 21 buildtype = "Official"
22 } else {
23 buildtype = "Release"
24 }
25 }
22 26
23 action(locales_listfile) { 27 template("build_locales_listfile") {
28 action(target_name) {
29 locales_listfile_output = invoker.locales_listfile_output
30
24 script = "../tools/build/remoting_localize.py" 31 script = "../tools/build/remoting_localize.py"
25 32
26 inputs = [] 33 inputs = []
27 outputs = [ 34 outputs = [
28 listfile, 35 locales_listfile_output,
29 ] 36 ]
30 37
31 args = [ 38 args = [
32 "--locale_output", 39 "--locale_output",
33 rebase_path(webapp_locale_dir, root_build_dir) + 40 rebase_path(webapp_locale_dir, root_build_dir) +
34 "/@{json_suffix}/messages.json", 41 "/@{json_suffix}/messages.json",
35 "--locales_listfile", 42 "--locales_listfile",
36 listfile_rel, 43 rebase_path(locales_listfile_output, root_build_dir),
37 ] 44 ]
38 args += remoting_locales 45 args += remoting_locales
39 } 46 }
47 }
48
49 template("build_webapp_html") {
50 action(target_name) {
51 html_template_file = invoker.html_template_file
52 html_template_files = invoker.html_template_files
53 js_files = invoker.js_files
54 html_output = invoker.html_output
55
56 script = "build-html.py"
57
58 inputs = [ html_template_file ] + html_template_files + js_files
59
60 outputs = [
61 html_output,
62 ]
63
64 args = [
65 rebase_path(html_output, root_build_dir),
66 rebase_path(html_template_file, root_build_dir),
67 ]
68 args += [
69 "--template-dir",
70 rebase_path(remoting_dir, root_build_dir),
71 ]
72 args += [ "--templates" ] + html_template_files
73 args += [ "--js" ] + rebase_path(js_files, remoting_dir)
74 }
75 }
76
77 template("desktop_remoting_webapp") {
78 locales_listfile = target_name + "_locales"
79 locales_listfile_output = "$target_gen_dir/${target_name}_locales.txt"
80
81 build_locales_listfile(locales_listfile) {
82 # Template uses locales_listfile_output from outer scope.
83 }
84
85 background_html = target_name + "_background_html"
86 background_html_output = "$target_gen_dir/html/$target_name/background.html"
87
88 build_webapp_html(background_html) {
89 html_template_file = remoting_webapp_template_background
90 html_template_files = []
91 js_files = remoting_webapp_background_html_all_js_files
92 html_output = background_html_output
93 }
94
95 message_window_html = target_name + "_message_window_html"
96 message_window_html_output =
97 "$target_gen_dir/html/$target_name/message_window.html"
98
99 build_webapp_html(message_window_html) {
100 html_template_file = remoting_webapp_template_message_window
101 html_template_files = []
102 js_files = remoting_webapp_message_window_html_all_js_files
103 html_output = message_window_html_output
104 }
105
106 wcs_sandbox_html = target_name + "_wcs_sandbox_html"
107 wcs_sandbox_html_output = "$target_gen_dir/html/$target_name/wcs_sandbox.html"
108
109 build_webapp_html(wcs_sandbox_html) {
110 html_template_file = remoting_webapp_template_wcs_sandbox
111 html_template_files = []
112 js_files = remoting_webapp_wcs_sandbox_html_all_js_files
113 html_output = wcs_sandbox_html_output
114 }
115
116 main_html = target_name + "_main_html"
117 main_html_output = "$target_gen_dir/html/$target_name/main.html"
118
119 build_webapp_html(main_html) {
120 html_template_file = remoting_webapp_template_main
121 html_template_files = remoting_webapp_template_files
122 js_files = remoting_webapp_crd_main_html_all_js_files
123 html_output = main_html_output
124 }
40 125
41 action(target_name) { 126 action(target_name) {
42 script = "build-webapp.py" 127 script = "build-webapp.py"
43 128
44 webapp_type = invoker.webapp_type 129 webapp_type = invoker.webapp_type
45 output_dir = invoker.output_dir 130 output_dir = invoker.output_dir
46 zip_path = invoker.zip_path 131 zip_path = invoker.zip_path
47 extra_files = invoker.extra_files 132 extra_files = invoker.extra_files
48 133
49 inputs = [] 134 inputs =
135 [ rebase_path("crd/manifest.json.jinja2", root_build_dir) ] +
136 remoting_version_files +
137 rebase_path(remoting_webapp_crd_files, root_build_dir) + extra_files
138
50 outputs = [ 139 outputs = [
51 "$target_gen_dir/$zip_path", 140 "$target_gen_dir/$zip_path",
52 ] 141 ]
53 142
54 deps = [ 143 deps = [
55 ":html",
56 ":$locales_listfile", 144 ":$locales_listfile",
145 ":$background_html",
146 ":$message_window_html",
147 ":$wcs_sandbox_html",
148 ":$main_html",
57 "//remoting/resources", 149 "//remoting/resources",
58 ] 150 ]
59 151
60 buildtype = "Dev" 152 dr_generated_html_files = [
61 if (!is_debug) { 153 background_html_output,
62 if (is_official_build) { 154 message_window_html_output,
63 buildtype = "Official" 155 wcs_sandbox_html_output,
64 } else { 156 main_html_output,
65 buildtype = "Release"
66 }
67 }
68
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 ] 157 ]
75 158
76 # Create a file that contains a list of all the resource files needed 159 # 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 160 # to build the webapp. This is needed to avoid problems on platforms that
78 # limit the size of a command line. 161 # limit the size of a command line.
79 file_list = "$target_gen_dir/${target_name}_file_list.txt" 162 file_list = "$target_gen_dir/${target_name}_files.txt"
80 files = [] 163 files = []
81 files += rebase_path(generated_html_files, root_build_dir) 164 files += rebase_path(dr_generated_html_files, root_build_dir)
82 files += rebase_path(remoting_webapp_crd_files, root_build_dir) 165 files += rebase_path(remoting_webapp_crd_files, root_build_dir)
83 files += rebase_path(extra_files, root_build_dir) 166 files += rebase_path(extra_files, root_build_dir)
84 write_file(file_list, files) 167 write_file(file_list, files)
85 168
86 args = [ 169 args = [
87 buildtype, 170 buildtype,
88 version_full, 171 version_full,
89 output_dir, 172 output_dir,
90 zip_path, 173 zip_path,
91 rebase_path("crd/manifest.json.jinja2", root_build_dir), 174 rebase_path("crd/manifest.json.jinja2", root_build_dir),
92 webapp_type, 175 webapp_type,
93 ] 176 ]
94 args += [ 177 args += [
95 "--files_listfile", 178 "--files_listfile",
96 rebase_path(file_list, root_build_dir), 179 rebase_path(file_list, root_build_dir),
97 ] 180 ]
98 args += [ 181 args += [
99 "--locales_listfile", 182 "--locales_listfile",
100 listfile_rel, 183 rebase_path(locales_listfile_output, root_build_dir),
101 ] 184 ]
102 args += [ 185 args += [
103 "--use_gcd", 186 "--use_gcd",
104 "$remoting_use_gcd", 187 "$remoting_use_gcd",
105 ] 188 ]
106 } 189 }
107 } 190 }
191
192 template("app_remoting_webapp") {
193 locales_listfile = target_name + "_locales"
194 locales_listfile_output = "$target_gen_dir/${target_name}_locales.txt"
195
196 build_locales_listfile(locales_listfile) {
197 # Template uses locales_listfile_output from outer scope.
198 }
199
200 feedback_consent_html = target_name + "_feedback_consent_html"
201 feedback_consent_html_output =
202 "$target_gen_dir/html/$target_name/feedback_consent.html"
203
204 build_webapp_html(feedback_consent_html) {
205 html_template_file = ar_feedback_consent_template
206 html_template_files = []
207 js_files = ar_feedback_consent_html_all_js_files
208 html_output = feedback_consent_html_output
209 }
210
211 loading_window_html = target_name + "_loading_window_html"
212 loading_window_html_output =
213 "$target_gen_dir/html/$target_name/loading_window.html"
214
215 build_webapp_html(loading_window_html) {
216 html_template_file = ar_loading_window_template
217 html_template_files = []
218
219 # The loading window is just a reskin of the message window -- all JS code
220 # is shared.
221 js_files = remoting_webapp_message_window_html_all_js_files
222 html_output = loading_window_html_output
223 }
224
225 message_window_html = target_name + "_message_window_html"
226 message_window_html_output =
227 "$target_gen_dir/html/$target_name/message_window.html"
228
229 build_webapp_html(message_window_html) {
230 html_template_file = remoting_webapp_template_message_window
231 html_template_files = []
232 js_files = remoting_webapp_message_window_html_all_js_files
233 html_output = message_window_html_output
234 }
235
236 wcs_sandbox_html = target_name + "_wcs_sandbox_html"
237 wcs_sandbox_html_output = "$target_gen_dir/html/$target_name/wcs_sandbox.html"
238
239 build_webapp_html(wcs_sandbox_html) {
240 html_template_file = remoting_webapp_template_wcs_sandbox
241 html_template_files = []
242 js_files = remoting_webapp_wcs_sandbox_html_all_js_files
243 html_output = wcs_sandbox_html_output
244 }
245
246 main_html = target_name + "_main_html"
247 main_html_output = "$target_gen_dir/html/$target_name/main.html"
248
249 build_webapp_html(main_html) {
250 html_template_file = ar_main_template
251 html_template_files = ar_main_template_files
252 js_files = ar_main_js_files
253 html_output = main_html_output
254 }
255
256 action(target_name) {
257 script = "build-webapp.py"
258
259 app_key = invoker.app_key
260 app_id = invoker.app_id
261 app_client_id = invoker.app_client_id
262 app_name = invoker.app_name
263 app_description = invoker.app_description
264 app_capabilities = invoker.app_capabilities
265 manifest_key = invoker.manifest_key
266
267 # These asserts are so that these variables get marked as being used so
268 # that GN doesn't complain about them.
269 assert(app_key != "" || app_key == "")
270 assert(app_id != "" || app_id == "")
271
272 # TODO(garykac) For internal targets, we need to extract the vendor and app
273 # name from the target.
274 ar_app_name = "sample_app" #target_name
275 ar_app_path = "app_remoting/apps/$ar_app_name"
276 ar_app_manifest = "$ar_app_path/manifest.json.jinja2"
277 ar_app_manifest_common = "app_remoting/manifest_common.json.jinja2"
278
279 output_dir = "remoting/app_remoting/$ar_service_environment/$target_name"
280 zip_path = "remoting/app_remoting/$ar_service_environment/$target_name.zip"
281
282 ar_app_specific_files = [
283 "$ar_app_path/icon16.png",
284 "$ar_app_path/icon48.png",
285 "$ar_app_path/icon128.png",
286 "$ar_app_path/loading_splash.png",
287 ]
288
289 ar_generated_html_files = [
290 feedback_consent_html_output,
291 loading_window_html_output,
292 message_window_html_output,
293 wcs_sandbox_html_output,
294 main_html_output,
295 ]
296
297 ar_webapp_files =
298 ar_app_specific_files + ar_shared_resource_files + ar_all_js_files
299
300 inputs = [
301 rebase_path(ar_app_manifest, root_build_dir),
302 rebase_path(ar_app_manifest_common, root_build_dir),
303 ] + remoting_version_files + ar_webapp_files
304
305 outputs = [
306 "$target_gen_dir/$zip_path",
307 ]
308
309 deps = [
310 ":$locales_listfile",
311 ":$feedback_consent_html",
312 ":$loading_window_html",
313 ":$message_window_html",
314 ":$wcs_sandbox_html",
315 ":$main_html",
316 "//remoting/resources",
317 ]
318
319 # Create a file that contains a list of all the resource files needed
320 # to build the webapp. This is needed to avoid problems on platforms that
321 # limit the size of a command line.
322 file_list = "$target_gen_dir/${target_name}_files.txt"
323 files = []
324 files += rebase_path(ar_generated_html_files, root_build_dir)
325 files += rebase_path(ar_webapp_files, root_build_dir)
326 write_file(file_list, files)
327
328 args = [
329 buildtype,
330 version_full,
331 output_dir,
332 zip_path,
333 rebase_path(ar_app_manifest, root_build_dir),
334 "app_remoting", # Web app type
335 ]
336 args += [
337 "--files_listfile",
338 rebase_path(file_list, root_build_dir),
339 ]
340 args += [
341 "--locales_listfile",
342 rebase_path(locales_listfile_output, root_build_dir),
343 ]
344 args += [
345 "--jinja_paths",
346 rebase_path("app_remoting", root_build_dir),
347 ]
348
349 if (is_debug) {
350 # Normally, the app-id for the orchestrator is automatically extracted
351 # from the webapp's extension id, but that approach doesn't work for
352 # dev webapp builds (since they all share the same dev extension id).
353 # The --appid arg will create a webapp that registers the given app-id
354 # rather than using the extension id.
355 # This is only done for Dev apps because the app-id for Release apps
356 # *must* match the extension id.
357 args += [
358 "--appid",
359 app_id,
360 ]
361 }
362
363 args += [
364 "--app_name",
365 app_name,
366 ]
367 args += [
368 "--app_description",
369 app_description,
370 ]
371 args += [ "--app_capabilities" ] + app_capabilities
372 args += [
373 "--service_environment",
374 ar_service_environment,
375 ]
376 args += [
377 "--manifest_key",
378 manifest_key,
379 ]
380 args += [
381 "--app_client_id",
382 app_client_id,
383 ]
384 }
385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698