Commit c9f08364 authored by garykac's avatar garykac Committed by Commit bot

[Chromoting] Update build-webapp to accept a filelist & update GN rules

This cl:
* Adds file list support to build-webapp.py
* Update teh GN webapp build rules to build/pass a filelist
* Enable the GN webapp build for Windows

This change is motivated by enabling the remoting webapp build on
Windows, which has a limit on the size of the command line. This
limit was encountered with the Windows GN build.

The corresponding GYP build files are not updated (even though GYP
has support for building filelists via the <| syntax) because our
files have GYP paths in them that get written into the file rather
than being expanded. Fixing this is not worth the time since we're
moving away from our GYP builds.

BUG=

Review URL: https://codereview.chromium.org/1107483002

Cr-Commit-Position: refs/heads/master@{#326959}
parent a45d3191
......@@ -24,12 +24,8 @@ group("remoting_all") {
#"//app_remoting_webapp.gyp:ar_sample_app",
]
if ((is_linux && !is_chromeos) || is_mac) {
deps += [
# TODO(gyp) Enable this for Windows once the webapp can be built without
# exceeding the 8k cmd line limit on Windows.
"//remoting/webapp",
]
if ((is_linux && !is_chromeos) || is_mac || is_win) {
deps += [ "//remoting/webapp" ]
}
if (is_win) {
......
......@@ -109,7 +109,8 @@ def processJinjaTemplate(input_file, include_paths, output_file, context):
def buildWebApp(buildtype, version, destination, zip_path,
manifest_template, webapp_type, appid, app_client_id, app_name,
app_description, app_capabilities, manifest_key, files,
locales_listfile, jinja_paths, service_environment, use_gcd):
files_listfile, locales_listfile, jinja_paths,
service_environment, use_gcd):
"""Does the main work of building the webapp directory and zipfile.
Args:
......@@ -121,8 +122,8 @@ def buildWebApp(buildtype, version, destination, zip_path,
manifest_template: jinja2 template file for manifest.
webapp_type: webapp type ("v1", "v2", "v2_pnacl" or "app_remoting").
appid: A string with the Remoting Application Id (only used for app
remoting webapps). If supplied, it defaults to using the
test API server.
remoting webapps). If supplied, it defaults to using the
test API server.
app_client_id: The OAuth2 client ID for the webapp.
app_name: A string with the name of the application.
app_description: A string with the description of the application.
......@@ -131,9 +132,14 @@ def buildWebApp(buildtype, version, destination, zip_path,
manifest_key: The manifest key for the webapp.
files: An array of strings listing the paths for resources to include
in this webapp.
files_listfile: The name of a file containing a list of files, one per
line, identifying the resources to include in this webapp.
This is an alternate to specifying the files directly via
the 'files' option. The files listed in this file are
appended to the files passed via the 'files' option, if any.
locales_listfile: The name of a file containing a list of locales, one per
line, which are copied, along with their directory structure, from
the _locales directory down.
line, which are copied, along with their directory
structure, from the _locales directory down.
jinja_paths: An array of paths to search for {%include} directives in
addition to the directory containing the manifest template.
service_environment: Used to point the webapp to one of the
......@@ -149,6 +155,12 @@ def buildWebApp(buildtype, version, destination, zip_path,
for s in input:
locales.append(s.rstrip())
# Load the files from the files_listfile.
if files_listfile:
with open(files_listfile) as input:
for s in input:
files.append(s.rstrip())
# Ensure a fresh directory.
try:
shutil.rmtree(destination)
......@@ -437,6 +449,7 @@ def main():
parser.add_argument('--appid')
parser.add_argument('--app_client_id', default='')
parser.add_argument('--manifest_key', default='')
parser.add_argument('--files_listfile', default='', metavar='PATH')
parser.add_argument('--locales_listfile', default='', metavar='PATH')
parser.add_argument('--jinja_paths', nargs='*', default=[], metavar='PATH')
parser.add_argument('--service_environment', default='', metavar='ENV')
......
......@@ -72,6 +72,16 @@ template("remoting_webapp") {
"$target_gen_dir/wcs_sandbox.html",
]
# Create a file that contains a list of all the resource files needed
# to build the webapp. This is needed to avoid problems on platforms that
# limit the size of a command line.
file_list = "$target_gen_dir/${target_name}_file_list.txt"
files = []
files += rebase_path(generated_html_files, root_build_dir)
files += rebase_path(remoting_webapp_crd_files, root_build_dir)
files += rebase_path(extra_files, root_build_dir)
write_file(file_list, files)
args = [
buildtype,
version_full,
......@@ -80,9 +90,10 @@ template("remoting_webapp") {
rebase_path("crd/manifest.json.jinja2", root_build_dir),
webapp_type,
]
args += rebase_path(generated_html_files, root_build_dir)
args += rebase_path(remoting_webapp_crd_files, root_build_dir)
args += rebase_path(extra_files, root_build_dir)
args += [
"--files_listfile",
rebase_path(file_list, root_build_dir),
]
args += [
"--locales_listfile",
listfile_rel,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment