Commit b53f916c authored by brettw@chromium.org's avatar brettw@chromium.org

Update the tracing grit GN rule

Previously this rule had a lot of custom stuff to work around the fact that the grit rule couldn't run at GN time to get the inputs and outputs. Now that the inputs are lazy, we can use the template.

R=viettrungluu@chromium.org

Review URL: https://codereview.chromium.org/414623002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284948 0039d316-1c4b-4281-b951-d872f2087c98
parent b89c5384
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
# python tools/grit/grit_info.py --outputs . path/to/your.grd # python tools/grit/grit_info.py --outputs . path/to/your.grd
# And strip the leading "./" from the output files. # And strip the leading "./" from the output files.
# #
# defines (optional)
# Extra defines to pass to grit (on top of the global grit_defines list).
#
# grit_flags (optional) # grit_flags (optional)
# List of strings containing extra command-line flags to pass to Grit. # List of strings containing extra command-line flags to pass to Grit.
# #
...@@ -261,7 +264,16 @@ template("grit") { ...@@ -261,7 +264,16 @@ template("grit") {
"-o", rebased_output_dir, "-o", rebased_output_dir,
"--depdir", ".", "--depdir", ".",
"--depfile", rebase_path(depfile, root_build_dir), "--depfile", rebase_path(depfile, root_build_dir),
] + grit_defines + grit_flags + assert_files_flags ] + grit_defines
# Add extra defines with -D flags.
if (defined(invoker.defines)) {
foreach (i, invoker.defines) {
args += [ "-D", i ]
}
}
args += grit_flags + assert_files_flags
visibility = target_visibility visibility = target_visibility
......
...@@ -12,7 +12,7 @@ tracing_gen_dir = "$root_gen_dir/content/browser/tracing" ...@@ -12,7 +12,7 @@ tracing_gen_dir = "$root_gen_dir/content/browser/tracing"
tracing_grd = "$tracing_gen_dir/tracing_resources.grd" tracing_grd = "$tracing_gen_dir/tracing_resources.grd"
action("generate_tracing_grd") { action("generate_tracing_grd") {
visibility = ":resources" visibility = ":*"
script = "generate_trace_viewer_grd.py" script = "generate_trace_viewer_grd.py"
input_pages = [ input_pages = [
...@@ -31,36 +31,19 @@ action("generate_tracing_grd") { ...@@ -31,36 +31,19 @@ action("generate_tracing_grd") {
] ]
} }
# This can't use the grit template because the grd file is generated at build grit("resources") {
# time, so the trick of using grit_info to get the real inputs/outputs at GYP source = tracing_grd
# time isn't possible.
action("resources") {
script = "//tools/grit/grit.py"
# Get the list of grit script sources.
grit_inputs_build_rel =
exec_script("//tools/grit/grit_info.py", [ "--inputs" ], "list lines")
inputs = rebase_path(grit_inputs_build_rel, ".", root_build_dir) + [
grit_resource_id_file,
]
outputs = [ outputs = [
"$target_gen_dir/grit/tracing_resources.h", "grit/tracing_resources.h",
"$target_gen_dir/tracing_resources.pak", "tracing_resources.pak",
] ]
args = [ # resource_ids has an entry for our .grd file that looks like:
"-i", rebase_path(tracing_grd, root_build_dir), "build", # "<(SHARED_INTERMEDIATE_DIR)/content/browser/tracing/tracing_resources.grd"
"-f", rebase_path(grit_resource_id_file, root_build_dir), # and what we pass here should make that resolve to our .grd file.
"-o", rebase_path(target_gen_dir, root_build_dir), defines = [
# resource_ids has an entry for our .grd file that looks like: "SHARED_INTERMEDIATE_DIR=" + rebase_path(root_gen_dir, root_build_dir),
# "<(SHARED_INTERMEDIATE_DIR)/content/browser/tracing/tracing_resources.grd"
# and what we pass here should make that resolve to our .grd file.
"-DSHARED_INTERMEDIATE_DIR=" +
rebase_path(root_gen_dir, root_build_dir),
] + grit_defines
deps = [
":generate_tracing_grd",
] ]
deps = [ ":generate_tracing_grd" ]
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment