OLD | NEW |
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") |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 args += rebase_path(js_files, root_build_dir) | 72 args += rebase_path(js_files, root_build_dir) |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 action(target_name) { | 76 action(target_name) { |
77 html_template_file = invoker.html_template_file | 77 html_template_file = invoker.html_template_file |
78 html_template_include_files = invoker.html_template_include_files | 78 html_template_include_files = invoker.html_template_include_files |
79 js_files = invoker.js_files | 79 js_files = invoker.js_files |
80 html_output = invoker.html_output | 80 html_output = invoker.html_output |
81 | 81 |
82 script = "build-html.py" | 82 script = rebase_path("//remoting/webapp/build-html.py", root_build_dir) |
83 | 83 |
84 inputs = [ html_template_file ] + html_template_include_files + js_files | 84 inputs = [ html_template_file ] + html_template_include_files + js_files |
85 | 85 |
86 outputs = [ | 86 outputs = [ |
87 html_output, | 87 html_output, |
88 ] | 88 ] |
89 | 89 |
90 if (target_jscompile != "") { | 90 if (target_jscompile != "") { |
91 deps = [ | 91 deps = [ |
92 ":$target_jscompile", | 92 ":$target_jscompile", |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 main_html_output = "$target_gen_dir/html/$target_name/main.html" | 149 main_html_output = "$target_gen_dir/html/$target_name/main.html" |
150 | 150 |
151 build_webapp_html(main_html) { | 151 build_webapp_html(main_html) { |
152 html_template_file = remoting_webapp_template_main | 152 html_template_file = remoting_webapp_template_main |
153 html_template_include_files = remoting_webapp_template_files | 153 html_template_include_files = remoting_webapp_template_files |
154 js_files = remoting_webapp_crd_main_html_all_js_files | 154 js_files = remoting_webapp_crd_main_html_all_js_files |
155 html_output = main_html_output | 155 html_output = main_html_output |
156 } | 156 } |
157 | 157 |
158 action(target_name) { | 158 action(target_name) { |
159 script = "build-webapp.py" | 159 script = "//remoting/webapp/build-webapp.py" |
160 | 160 |
161 webapp_type = invoker.webapp_type | 161 webapp_type = invoker.webapp_type |
162 output_dir = invoker.output_dir | 162 output_dir = invoker.output_dir |
163 zip_path = invoker.zip_path | 163 zip_path = invoker.zip_path |
164 extra_files = invoker.extra_files | 164 extra_files = invoker.extra_files |
165 | 165 |
166 inputs = | 166 inputs = |
167 [ rebase_path("crd/manifest.json.jinja2", root_build_dir) ] + | 167 [ rebase_path("crd/manifest.json.jinja2", root_build_dir) ] + |
168 remoting_version_files + | 168 remoting_version_files + |
169 rebase_path(remoting_webapp_crd_files, root_build_dir) + extra_files | 169 rebase_path(remoting_webapp_crd_files, root_build_dir) + extra_files |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 "$remoting_use_gcd", | 219 "$remoting_use_gcd", |
220 ] | 220 ] |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 template("app_remoting_webapp") { | 224 template("app_remoting_webapp") { |
225 locales_listfile = target_name + "_locales" | 225 locales_listfile = target_name + "_locales" |
226 locales_listfile_output = "$target_gen_dir/${target_name}_locales.txt" | 226 locales_listfile_output = "$target_gen_dir/${target_name}_locales.txt" |
227 | 227 |
228 build_locales_listfile(locales_listfile) { | 228 build_locales_listfile(locales_listfile) { |
| 229 # TODO(garykac) Replace resources with empty stub rather than duplicating |
| 230 # all the resources needed by the shared module. |
| 231 # Template uses locales_listfile_output from outer scope. |
| 232 } |
| 233 |
| 234 action(target_name) { |
| 235 script = "//remoting/webapp/build-webapp.py" |
| 236 |
| 237 app_key = invoker.app_key |
| 238 app_id = invoker.app_id |
| 239 app_client_id = invoker.app_client_id |
| 240 app_vendor = invoker.app_vendor |
| 241 app_name = invoker.app_name |
| 242 app_fullname = invoker.app_fullname |
| 243 app_description = invoker.app_description |
| 244 app_capabilities = invoker.app_capabilities |
| 245 manifest_key = invoker.manifest_key |
| 246 |
| 247 # These asserts are so that these variables get marked as being used so |
| 248 # that GN doesn't complain about them. |
| 249 assert(app_key != "" || app_key == "") |
| 250 assert(app_id != "" || app_id == "") |
| 251 |
| 252 ar_base_path = "//remoting/webapp/app_remoting" |
| 253 if (app_vendor != "") { |
| 254 ar_app_path = "$ar_base_path/internal/apps/$app_vendor/$app_name" |
| 255 } else { |
| 256 ar_app_path = "$ar_base_path/apps/$app_name" |
| 257 } |
| 258 ar_app_manifest = "$ar_app_path/manifest.json.jinja2" |
| 259 ar_app_manifest_common = "$ar_base_path/manifest_common.json.jinja2" |
| 260 |
| 261 output_dir = "remoting/app_remoting/$ar_service_environment/$target_name" |
| 262 zip_path = "remoting/app_remoting/$ar_service_environment/$target_name.zip" |
| 263 |
| 264 # TODO(garykac) Move this list of files into files.gni. |
| 265 ar_app_specific_files = [ |
| 266 "$ar_app_path/icon16.png", |
| 267 "$ar_app_path/icon48.png", |
| 268 "$ar_app_path/icon128.png", |
| 269 "$ar_app_path/loading_splash.png", |
| 270 ] |
| 271 |
| 272 ar_webapp_files = |
| 273 ar_app_specific_files + ar_vendor_js_files + ar_vendor_html_files |
| 274 |
| 275 inputs = [ |
| 276 rebase_path(ar_app_manifest, root_build_dir), |
| 277 rebase_path(ar_app_manifest_common, root_build_dir), |
| 278 ] + remoting_version_files + ar_webapp_files |
| 279 |
| 280 outputs = [ |
| 281 "$target_gen_dir/$zip_path", |
| 282 ] |
| 283 |
| 284 deps = [ |
| 285 ":$locales_listfile", |
| 286 "//remoting/resources", |
| 287 ] |
| 288 |
| 289 # Create a file that contains a list of all the resource files needed |
| 290 # to build the webapp. This is needed to avoid problems on platforms that |
| 291 # limit the size of a command line. |
| 292 file_list = "$target_gen_dir/${target_name}_files.txt" |
| 293 files = [] |
| 294 files += rebase_path(ar_webapp_files, root_build_dir) |
| 295 write_file(file_list, files) |
| 296 |
| 297 args = [ |
| 298 buildtype, |
| 299 version_full, |
| 300 output_dir, |
| 301 zip_path, |
| 302 rebase_path(ar_app_manifest, root_build_dir), |
| 303 "app_remoting", # Web app type |
| 304 ] |
| 305 args += [ |
| 306 "--files_listfile", |
| 307 rebase_path(file_list, root_build_dir), |
| 308 ] |
| 309 args += [ |
| 310 "--locales_listfile", |
| 311 rebase_path(locales_listfile_output, root_build_dir), |
| 312 ] |
| 313 args += [ |
| 314 "--jinja_paths", |
| 315 rebase_path("//remoting/webapp/app_remoting", root_build_dir), |
| 316 ] |
| 317 |
| 318 if (is_debug) { |
| 319 # Normally, the app-id for the orchestrator is automatically extracted |
| 320 # from the webapp's extension id, but that approach doesn't work for |
| 321 # dev webapp builds (since they all share the same dev extension id). |
| 322 # The --appid arg will create a webapp that registers the given app-id |
| 323 # rather than using the extension id. |
| 324 # This is only done for Dev apps because the app-id for Release apps |
| 325 # *must* match the extension id. |
| 326 args += [ |
| 327 "--appid", |
| 328 app_id, |
| 329 ] |
| 330 } |
| 331 |
| 332 args += [ |
| 333 "--app_name", |
| 334 app_fullname, |
| 335 ] |
| 336 args += [ |
| 337 "--app_description", |
| 338 app_description, |
| 339 ] |
| 340 args += [ "--app_capabilities" ] + app_capabilities |
| 341 args += [ |
| 342 "--service_environment", |
| 343 ar_service_environment, |
| 344 ] |
| 345 args += [ |
| 346 "--manifest_key", |
| 347 manifest_key, |
| 348 ] |
| 349 args += [ |
| 350 "--app_client_id", |
| 351 app_client_id, |
| 352 ] |
| 353 } |
| 354 } |
| 355 |
| 356 template("app_remoting_shared_module") { |
| 357 locales_listfile = target_name + "_locales" |
| 358 locales_listfile_output = "$target_gen_dir/${target_name}_locales.txt" |
| 359 |
| 360 build_locales_listfile(locales_listfile) { |
229 # Template uses locales_listfile_output from outer scope. | 361 # Template uses locales_listfile_output from outer scope. |
230 } | 362 } |
231 | 363 |
232 feedback_consent_html = target_name + "_feedback_consent_html" | 364 feedback_consent_html = target_name + "_feedback_consent_html" |
233 feedback_consent_html_output = | 365 feedback_consent_html_output = |
234 "$target_gen_dir/html/$target_name/feedback_consent.html" | 366 "$target_gen_dir/html/$target_name/feedback_consent.html" |
235 | 367 |
236 build_webapp_html(feedback_consent_html) { | 368 build_webapp_html(feedback_consent_html) { |
237 html_template_file = ar_feedback_consent_template | 369 html_template_file = ar_feedback_consent_template |
238 html_template_include_files = [] | 370 html_template_include_files = [] |
(...skipping 29 matching lines...) Expand all Loading... |
268 wcs_sandbox_html = target_name + "_wcs_sandbox_html" | 400 wcs_sandbox_html = target_name + "_wcs_sandbox_html" |
269 wcs_sandbox_html_output = "$target_gen_dir/html/$target_name/wcs_sandbox.html" | 401 wcs_sandbox_html_output = "$target_gen_dir/html/$target_name/wcs_sandbox.html" |
270 | 402 |
271 build_webapp_html(wcs_sandbox_html) { | 403 build_webapp_html(wcs_sandbox_html) { |
272 html_template_file = remoting_webapp_template_wcs_sandbox | 404 html_template_file = remoting_webapp_template_wcs_sandbox |
273 html_template_include_files = [] | 405 html_template_include_files = [] |
274 js_files = remoting_webapp_wcs_sandbox_html_all_js_files | 406 js_files = remoting_webapp_wcs_sandbox_html_all_js_files |
275 html_output = wcs_sandbox_html_output | 407 html_output = wcs_sandbox_html_output |
276 } | 408 } |
277 | 409 |
| 410 background_html = target_name + "_background_html" |
| 411 background_html_output = |
| 412 "$target_gen_dir/html/$target_name/ar_background.html" |
| 413 |
| 414 build_webapp_html(background_html) { |
| 415 html_template_file = ar_background_template |
| 416 html_template_include_files = [] |
| 417 js_files = ar_background_html_js_files |
| 418 html_output = background_html_output |
| 419 } |
| 420 |
278 main_html = target_name + "_main_html" | 421 main_html = target_name + "_main_html" |
279 main_html_output = "$target_gen_dir/html/$target_name/main.html" | 422 main_html_output = "$target_gen_dir/html/$target_name/main.html" |
280 | 423 |
281 build_webapp_html(main_html) { | 424 build_webapp_html(main_html) { |
282 html_template_file = ar_main_template | 425 html_template_file = ar_main_template |
283 html_template_include_files = ar_main_template_files | 426 html_template_include_files = ar_main_template_files |
284 js_files = ar_main_js_files | 427 js_files = ar_main_js_files |
285 html_output = main_html_output | 428 html_output = main_html_output |
286 } | 429 } |
287 | 430 |
288 action(target_name) { | 431 action(target_name) { |
289 script = "build-webapp.py" | 432 script = "build-webapp.py" |
290 | 433 |
291 app_key = invoker.app_key | |
292 app_id = invoker.app_id | |
293 app_client_id = invoker.app_client_id | 434 app_client_id = invoker.app_client_id |
294 app_name = invoker.app_name | 435 app_name = invoker.app_name |
| 436 app_fullname = invoker.app_fullname |
295 app_description = invoker.app_description | 437 app_description = invoker.app_description |
296 app_capabilities = invoker.app_capabilities | |
297 manifest_key = invoker.manifest_key | 438 manifest_key = invoker.manifest_key |
298 | 439 |
299 # These asserts are so that these variables get marked as being used so | 440 ar_path = "app_remoting/$app_name" |
300 # that GN doesn't complain about them. | 441 ar_manifest = "$ar_path/manifest.json" |
301 assert(app_key != "" || app_key == "") | |
302 assert(app_id != "" || app_id == "") | |
303 | 442 |
304 # TODO(garykac) For internal targets, we need to extract the vendor and app | 443 output_dir = "remoting/app_remoting/$target_name" |
305 # name from the target. | 444 zip_path = "remoting/app_remoting/$target_name.zip" |
306 ar_app_name = "sample_app" #target_name | |
307 ar_app_path = "app_remoting/apps/$ar_app_name" | |
308 ar_app_manifest = "$ar_app_path/manifest.json.jinja2" | |
309 ar_app_manifest_common = "app_remoting/manifest_common.json.jinja2" | |
310 | |
311 output_dir = "remoting/app_remoting/$ar_service_environment/$target_name" | |
312 zip_path = "remoting/app_remoting/$ar_service_environment/$target_name.zip" | |
313 | |
314 ar_app_specific_files = [ | |
315 "$ar_app_path/icon16.png", | |
316 "$ar_app_path/icon48.png", | |
317 "$ar_app_path/icon128.png", | |
318 "$ar_app_path/loading_splash.png", | |
319 ] | |
320 | 445 |
321 ar_generated_html_files = [ | 446 ar_generated_html_files = [ |
| 447 background_html_output, |
322 feedback_consent_html_output, | 448 feedback_consent_html_output, |
323 loading_window_html_output, | 449 loading_window_html_output, |
324 message_window_html_output, | 450 message_window_html_output, |
325 wcs_sandbox_html_output, | 451 wcs_sandbox_html_output, |
326 main_html_output, | 452 main_html_output, |
327 ] | 453 ] |
328 | 454 |
329 ar_webapp_files = | 455 ar_webapp_files = |
330 ar_app_specific_files + ar_shared_resource_files + ar_all_js_files | 456 ar_shared_resource_files + ar_all_js_files + ar_generated_html_files |
331 | 457 |
332 inputs = [ | 458 inputs = [ rebase_path(ar_manifest, root_build_dir) ] + |
333 rebase_path(ar_app_manifest, root_build_dir), | 459 remoting_version_files + ar_webapp_files |
334 rebase_path(ar_app_manifest_common, root_build_dir), | |
335 ] + remoting_version_files + ar_webapp_files | |
336 | 460 |
337 outputs = [ | 461 outputs = [ |
338 "$target_gen_dir/$zip_path", | 462 "$target_gen_dir/$zip_path", |
339 ] | 463 ] |
340 | 464 |
341 deps = [ | 465 deps = [ |
342 ":$locales_listfile", | 466 ":$locales_listfile", |
343 ":$feedback_consent_html", | 467 ":$feedback_consent_html", |
344 ":$loading_window_html", | 468 ":$loading_window_html", |
345 ":$message_window_html", | 469 ":$message_window_html", |
346 ":$wcs_sandbox_html", | 470 ":$wcs_sandbox_html", |
347 ":$main_html", | 471 ":$main_html", |
348 "//remoting/resources", | 472 "//remoting/resources", |
349 ] | 473 ] |
350 | 474 |
351 # Create a file that contains a list of all the resource files needed | 475 # Create a file that contains a list of all the resource files needed |
352 # to build the webapp. This is needed to avoid problems on platforms that | 476 # to build the webapp. This is needed to avoid problems on platforms that |
353 # limit the size of a command line. | 477 # limit the size of a command line. |
354 file_list = "$target_gen_dir/${target_name}_files.txt" | 478 file_list = "$target_gen_dir/${target_name}_files.txt" |
355 files = [] | 479 files = [] |
356 files += rebase_path(ar_generated_html_files, root_build_dir) | |
357 files += rebase_path(ar_webapp_files, root_build_dir) | 480 files += rebase_path(ar_webapp_files, root_build_dir) |
358 write_file(file_list, files) | 481 write_file(file_list, files) |
359 | 482 |
360 args = [ | 483 args = [ |
361 buildtype, | 484 buildtype, |
362 version_full, | 485 version_full, |
363 output_dir, | 486 output_dir, |
364 zip_path, | 487 zip_path, |
365 rebase_path(ar_app_manifest, root_build_dir), | 488 rebase_path(ar_manifest, root_build_dir), |
366 "app_remoting", # Web app type | 489 "shared_module", # Web app type |
367 ] | 490 ] |
368 args += [ | 491 args += [ |
369 "--files_listfile", | 492 "--files_listfile", |
370 rebase_path(file_list, root_build_dir), | 493 rebase_path(file_list, root_build_dir), |
371 ] | 494 ] |
372 args += [ | 495 args += [ |
373 "--locales_listfile", | 496 "--locales_listfile", |
374 rebase_path(locales_listfile_output, root_build_dir), | 497 rebase_path(locales_listfile_output, root_build_dir), |
375 ] | 498 ] |
376 args += [ | |
377 "--jinja_paths", | |
378 rebase_path("app_remoting", root_build_dir), | |
379 ] | |
380 | |
381 if (is_debug) { | |
382 # Normally, the app-id for the orchestrator is automatically extracted | |
383 # from the webapp's extension id, but that approach doesn't work for | |
384 # dev webapp builds (since they all share the same dev extension id). | |
385 # The --appid arg will create a webapp that registers the given app-id | |
386 # rather than using the extension id. | |
387 # This is only done for Dev apps because the app-id for Release apps | |
388 # *must* match the extension id. | |
389 args += [ | |
390 "--appid", | |
391 app_id, | |
392 ] | |
393 } | |
394 | 499 |
395 args += [ | 500 args += [ |
396 "--app_name", | 501 "--app_name", |
397 app_name, | 502 app_fullname, |
398 ] | 503 ] |
399 args += [ | 504 args += [ |
400 "--app_description", | 505 "--app_description", |
401 app_description, | 506 app_description, |
402 ] | 507 ] |
403 args += [ "--app_capabilities" ] + app_capabilities | |
404 args += [ | |
405 "--service_environment", | |
406 ar_service_environment, | |
407 ] | |
408 args += [ | 508 args += [ |
409 "--manifest_key", | 509 "--manifest_key", |
410 manifest_key, | 510 manifest_key, |
411 ] | 511 ] |
412 args += [ | 512 args += [ |
413 "--app_client_id", | 513 "--app_client_id", |
414 app_client_id, | 514 app_client_id, |
415 ] | 515 ] |
416 } | 516 } |
417 } | 517 } |
OLD | NEW |