electron/build/templated_file.gni
Samuel Attard 7201845894
refactor: auto generate electron_version.h from the version file (#18866)
* refactor: auto generate electron_version.h from the version file

* Update BUILD.gn

Co-Authored-By: Jeremy Apthorp <nornagon@nornagon.net>
2019-06-19 14:31:55 -07:00

39 lines
1,020 B
Text

template("templated_file") {
assert(defined(invoker.template), "Need template file to run")
assert(defined(invoker.output), "Need output file to run")
if (defined(invoker.values)) {
args_path = "$target_gen_dir/$target_name.args"
write_file(args_path, invoker.values, "json")
}
action(target_name) {
forward_variables_from(invoker,
[
"deps",
"public_deps",
"inputs",
"outputs",
])
inputs = [
invoker.template,
]
outputs = [
invoker.output,
]
script = "//electron/build/generate-template.py"
args = [
rebase_path(invoker.template),
rebase_path(invoker.output),
]
if (defined(invoker.values)) {
args += rebase_path(args_path)
}
if (defined(invoker.args_files)) {
args += rebase_path(invoker.args_files)
inputs += invoker.args_files
}
}
}