naiveproxy/chrome/browser/resources/optimize_webui.gni

135 lines
3.4 KiB
Plaintext
Raw Normal View History

2018-12-10 05:59:24 +03:00
# Copyright 2017 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.
template("node") {
action(target_name) {
forward_variables_from(invoker, "*")
# Declare dependencies to all involved tools.
inputs += [
"//third_party/node/node.py",
"//third_party/node/node_modules.py",
"//third_party/node/node_modules.tar.gz.sha1",
]
if (is_linux) {
inputs += [ "//third_party/node/linux/node-linux-x64.tar.gz.sha1" ]
}
if (is_win) {
inputs += [ "//third_party/node/win/node.exe.sha1" ]
}
if (is_mac) {
inputs += [ "//third_party/node/mac/node-darwin-x64.tar.gz.sha1" ]
}
}
}
template("optimize_webui") {
node(target_name) {
script = "//chrome/browser/resources/optimize_webui.py"
inputs = [
"//chrome/browser/resources/unpack_pak.py",
]
# This depfile is generated by optimize_webui.py
depfile = "${target_gen_dir}/${target_name}.d"
outputs = []
foreach(_out, invoker.html_out_files) {
outputs += [ "$target_gen_dir/$_out" ]
}
if (defined(invoker.html_out_files_polymer2)) {
foreach(_out, invoker.html_out_files_polymer2) {
outputs += [ "$target_gen_dir/$_out" ]
}
}
foreach(_out, invoker.js_out_files) {
outputs += [ "$target_gen_dir/$_out" ]
}
deps = invoker.deps
# Note that we have to manually pass the sources to our script if the
# script needs them as inputs.
args = [
"--host",
invoker.host,
"--input",
invoker.input,
"--out_folder",
rebase_path(target_gen_dir, root_build_dir),
"--depfile",
rebase_path(depfile, root_build_dir),
]
args += [ "--html_in_files" ] + invoker.html_in_files
args += [ "--html_out_files" ] + invoker.html_out_files
if (defined(invoker.html_out_files_polymer2)) {
args += [ "--html_out_files_polymer2" ] + invoker.html_out_files_polymer2
}
args += [ "--js_out_files" ] + invoker.js_out_files
if (defined(invoker.excludes)) {
args += [ "--exclude" ] + invoker.excludes
}
if (defined(invoker.insert_in_head)) {
args += [
"--insert_in_head",
invoker.insert_in_head,
]
}
}
}
template("polymer_css_build") {
node(target_name) {
script = "//chrome/browser/resources/polymer_css_build_gn.py"
# Input and outputs files must be in the same order.
inputs = []
foreach(_input, invoker.input_files) {
inputs += [ "$target_gen_dir/$_input" ]
}
outputs = []
foreach(_output, invoker.output_files) {
outputs += [ "$target_gen_dir/$_output" ]
}
deps = invoker.deps
args = [
"--out_folder",
rebase_path(target_gen_dir, root_build_dir),
"--input_files",
] + invoker.input_files + [ "--output_files" ] + invoker.output_files
}
}
template("unpak") {
action(target_name) {
script = "//chrome/browser/resources/unpack_pak.py"
inputs = [
"$target_gen_dir/${invoker.pak_file}",
]
outputs = [
"$target_gen_dir/${invoker.out_folder}/unpack.stamp",
]
deps = invoker.deps
args = [
"--out_folder",
rebase_path("$target_gen_dir/${invoker.out_folder}", root_build_dir),
"--pak_file",
rebase_path("$target_gen_dir/${invoker.pak_file}", root_build_dir),
]
}
}