naiveproxy/remoting/credits/credits.gni

64 lines
2.2 KiB
Plaintext
Raw Normal View History

2018-01-28 19:30:36 +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.
# Generates a credits HTML file, based on the third-party dependencies of
# a provided GN target.
# Parameters:
# gn_target: The target whose dependencies should be listed in the credits.
# credits_gen_dir: Directory (without trailing slash) where the generated
# HTML will be placed, together with the copied JSS+CS files.
template("remoting_credits") {
_credits_source_dir = "//remoting/credits"
action("${target_name}__generate") {
# Generate credits.html in a temporary location, so it can be copied into
# the final location - see comment for 'copy' target.
_credits_html_file = "$target_gen_dir/$target_name/credits.html"
_credits_template = "$_credits_source_dir/credits.tmpl"
_credits_entry_template = "$_credits_source_dir/credits_entry.tmpl"
script = "//tools/licenses.py"
depfile = "$target_gen_dir/$target_name.d"
inputs = [
_credits_template,
_credits_entry_template,
]
outputs = [
_credits_html_file,
]
args = [
"credits",
rebase_path(_credits_html_file, root_build_dir),
"--file-template",
rebase_path(_credits_template, root_build_dir),
"--entry-template",
rebase_path(_credits_entry_template, root_build_dir),
"--depfile",
rebase_path(depfile, root_build_dir),
"--gn-target",
invoker.gn_target,
"--gn-out-dir",
rebase_path(root_build_dir),
]
}
# This target purposefully copies the generated HTML file (instead of
# directly generating the HTML file into credits_gen_dir), so that the caller
# can use get_target_outputs(:target_name) and the HTML file will be
# included in the returned list along with the JS+CSS files.
copy(target_name) {
_generate_target = ":${target_name}__generate"
_credits_gen_dir = invoker.credits_gen_dir
sources = [
"$_credits_source_dir/credits_css.css",
"$_credits_source_dir/credits_js.js",
] + get_target_outputs(_generate_target)
outputs = [
"$_credits_gen_dir/{{source_file_part}}",
]
deps = [
_generate_target,
]
}
}