naiveproxy/chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni
2018-01-29 00:30:36 +08:00

95 lines
2.4 KiB
Plaintext

# Copyright 2016 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_chromeos)
closure_library_dir =
"//chrome/third_party/chromevox/third_party/closure-library/closure/goog"
jsbundler_modules = rebase_path([
"depstree.py",
"source.py",
"treescan.py",
],
".",
"$closure_library_dir/../bin/build")
jsbundler_modules +=
[ "//third_party/WebKit/Source/devtools/scripts/build/rjsmin.py" ]
template("run_jsbundler") {
assert(defined(invoker.mode))
assert(defined(invoker.sources))
if (defined(invoker.modules)) {
modules = invoker.modules
} else {
modules = []
}
if (defined(invoker.rewrite_rules)) {
rewrite_rules = invoker.rewrite_rules
} else {
rewrite_rules = []
}
action(target_name) {
script = "//chrome/browser/resources/chromeos/chromevox/tools/jsbundler.py"
inputs = jsbundler_modules
sources = invoker.sources
if (defined(invoker.output_file)) {
if (defined(invoker.modules)) {
depfile = "$target_out_dir/" +
get_path_info(invoker.output_file, "name") + ".d"
}
outputs = [
invoker.output_file,
]
} else {
assert(!defined(invoker.modules))
stampfile = "$target_out_dir/${target_name}_copy.stamp"
outputs = [
stampfile,
]
}
args = [
"-m",
invoker.mode,
]
if (defined(depfile)) {
args += [
"--depfile",
rebase_path(depfile, root_build_dir),
]
}
if (defined(stampfile)) {
args += [
"--stampfile",
rebase_path(stampfile, root_build_dir),
]
}
if (defined(invoker.output_file)) {
args += [
"-o",
rebase_path(invoker.output_file, root_build_dir),
]
}
if (defined(invoker.dest_dir)) {
args += [
"-d",
rebase_path(invoker.dest_dir, root_build_dir),
]
}
foreach(module, modules) {
args += [
"-M",
rebase_path(module, root_build_dir),
]
}
foreach(rule, rewrite_rules) {
args += [
"-w",
rule,
]
}
args += rebase_path(sources, root_build_dir)
}
}