blob: 4bc4cad230c51319c3494bd69ce7a94ac320b2d7 [file] [log] [blame]
# Copyright 2020 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.
import("//build/config/python.gni")
import("//tools/grit/grit_defines.gni")
template("preprocess_grit") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = "//tools/grit/preprocess_grit.py"
if (defined(invoker.deps)) {
deps = invoker.deps
}
inputs = []
outputs = []
foreach(in_file, invoker.in_files) {
inputs += [ invoker.in_folder + "/" + in_file ]
outputs += [ invoker.out_folder + "/" + in_file ]
}
args = [
"--in-folder",
rebase_path(invoker.in_folder, root_build_dir),
"--out-folder",
rebase_path(invoker.out_folder, root_build_dir),
"--in-files",
] + invoker.in_files + grit_defines
if (defined(invoker.defines)) {
foreach(define, invoker.defines) {
args += [
"-D",
define,
]
}
}
if (defined(invoker.out_manifest)) {
args += [
"--out-manifest",
rebase_path(invoker.out_manifest, root_build_dir),
]
outputs += [ invoker.out_manifest ]
}
}
}