diff options
author | brettw <brettw@chromium.org> | 2015-03-04 09:24:45 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-04 17:25:38 +0000 |
commit | 31f4de692fea12661a046a0fc8d091ff6f04654d (patch) | |
tree | f5f607b3fda304a32c36bc1999fcefee8bf423df /remoting/tools | |
parent | 568f43629db2ee7c2121adf576c21e06554d5c2e (diff) | |
download | chromium_src-31f4de692fea12661a046a0fc8d091ff6f04654d.zip chromium_src-31f4de692fea12661a046a0fc8d091ff6f04654d.tar.gz chromium_src-31f4de692fea12661a046a0fc8d091ff6f04654d.tar.bz2 |
Add remoting and PPAPI tests to GN build
Reland of https://codereview.chromium.org/961323004
TBR=dpranke
Review URL: https://codereview.chromium.org/969173002
Cr-Commit-Position: refs/heads/master@{#319080}
Diffstat (limited to 'remoting/tools')
-rw-r--r-- | remoting/tools/build/message_compiler.gni | 51 | ||||
-rw-r--r-- | remoting/tools/build/message_compiler.py | 16 | ||||
-rw-r--r-- | remoting/tools/build/remoting_localize.gni | 113 |
3 files changed, 180 insertions, 0 deletions
diff --git a/remoting/tools/build/message_compiler.gni b/remoting/tools/build/message_compiler.gni new file mode 100644 index 0000000..20eae13 --- /dev/null +++ b/remoting/tools/build/message_compiler.gni @@ -0,0 +1,51 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +assert(is_win, "This only runs on Windows.") + +# Runs mc.exe over a list of sources. +# +# sources +# List of .mc files to process. +template("message_compiler") { + action_name = "${target_name}_mc" + source_set_name = target_name + + action_foreach(action_name) { + visibility = [ ":$source_set_name" ] + script = "//remoting/tools/build/message_compiler.py" + + sources = invoker.sources + + outputs = [ + "$target_gen_dir/{{source_name_part}}.h", + "$target_gen_dir/{{source_name_part}}.rc", + ] + + args = [ + # Where to put the header. + "-h", + rebase_path(target_gen_dir, root_build_dir), + + # Where to put the .rc file. + "-r", + rebase_path(target_gen_dir, root_build_dir), + + # Input is Unicode. + "-u", + "{{source}}", + ] + + if (defined(invoker.deps)) { + deps = invoker.deps + } + } + + source_set(source_set_name) { + sources = get_target_outputs(":$action_name") + deps = [ + ":$action_name", + ] + } +} diff --git a/remoting/tools/build/message_compiler.py b/remoting/tools/build/message_compiler.py new file mode 100644 index 0000000..60b0eaa --- /dev/null +++ b/remoting/tools/build/message_compiler.py @@ -0,0 +1,16 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Runs the Microsoft Message Compiler (mc.exe). This Python adapter is for the +# GYP build, which can only run Python and not native binaries. + +import subprocess +import sys + +# mc writes to stderr, so this explicily redirects to stdout and eats it. +try: + subprocess.check_output(["mc.exe"] + sys.argv[1:], stderr=subprocess.STDOUT) +except subprocess.CalledProcessError as e: + print e.output + sys.exit(e.returncode) diff --git a/remoting/tools/build/remoting_localize.gni b/remoting/tools/build/remoting_localize.gni new file mode 100644 index 0000000..54ff46e --- /dev/null +++ b/remoting/tools/build/remoting_localize.gni @@ -0,0 +1,113 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Calls the remoting_localize script with a jinja2 template. +# +# Arguments +# +# sources (required) +# List of jinja2 files to load. This is the template. +# +# locales (required) +# List of locales. +# +# locale_dir (optional) +# +# defines (optional) +# List of defines to pass to script. +# Example: defines = [ "FOO_HOST_PATH=bar" ] +# +# variables (optional) +# List of variables to pass to script. +# +# output (optiona) +# Substitution pattern for the output. Defaults to a file in the target +# gen dir with the extension stripped (normally the extension is ".jinja2" +# which then leaves the non-tempaltized file name). +# TODO(brettw) Need locale_output. This is a per-locale output file. +# +# encoding (optional) +# String. +# +# deps (optional) +# visibility (optional) +template("remoting_localize") { + action_foreach(target_name) { + if (defined(invoker.visibility)) { + visibility = invoker.visibility + } + + script = "//remoting/tools/build/remoting_localize.py" + + sources = invoker.sources + + if (defined(invoker.output)) { + outputs = [ + invoker.output, + ] + } else { + outputs = [ + "$target_gen_dir/{{source_name_part}}", + ] + } + + args = [] + + if (defined(invoker.locale_dir)) { + args += [ + "--locale_dir", + rebase_path(invoker.locale_dir, root_build_dir), + ] + } + + # Add defines to command line. + if (defined(invoker.defines)) { + foreach(i, invoker.defines) { + args += [ + "--define", + i, + ] + } + } + + # Add variables to command line. + if (defined(invoker.variables)) { + foreach(i, invoker.variables) { + args += [ + "--variables", + i, + ] + } + } + + # The template file is required. + args += [ + "--template", + "{{source}}", + ] + + args += [ + "--output", + rebase_path(outputs[0], root_build_dir), + ] + + if (defined(invoker.encoding)) { + args += [ + "--encoding", + invoker.encoding, + ] + } + + args += invoker.locales + + if (defined(invoker.deps)) { + deps = invoker.deps + } else { + deps = [] + } + + # This script reads the messages strings from the generated resource files. + deps += [ "//remoting/resources:strings" ] + } +} |