From b89c53844b2ede863c9cbb6878320657db1fde71 Mon Sep 17 00:00:00 2001 From: "brettw@chromium.org" Date: Wed, 23 Jul 2014 16:32:32 +0000 Subject: Encode all grit outputs in .gn files This finishes the rest of the Grit outputs that was started in a previous pass, and removes the ability to optionally deduce outputs at GN-time (which is slow so we don't want to do it). R=viettrungluu@chromium.org Review URL: https://codereview.chromium.org/411543005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284947 0039d316-1c4b-4281-b951-d872f2087c98 --- build/secondary/tools/grit/grit_rule.gni | 54 ++++++++++++++------------------ 1 file changed, 23 insertions(+), 31 deletions(-) (limited to 'build/secondary/tools') diff --git a/build/secondary/tools/grit/grit_rule.gni b/build/secondary/tools/grit/grit_rule.gni index 178fb64..6d88f58 100644 --- a/build/secondary/tools/grit/grit_rule.gni +++ b/build/secondary/tools/grit/grit_rule.gni @@ -7,10 +7,10 @@ # # Parameters # -# source +# source (required) # Path to .grd file. # -# outputs (optional) +# outputs (required) # List of outputs from grit, relative to the target_gen_dir. If supplied, # a call to Grit to compute the outputs can be skipped which will make # GN run faster. Grit will verify at build time that this list is correct @@ -45,7 +45,13 @@ # Example # # grit("my_resources") { -# source = "myfile.grd" # source is required. +# # Source and outputs are required. +# source = "myfile.grd" +# outputs = [ +# "foo_strings.h", +# "foo_strings.pak", +# ] +# # grit_flags = [ "-E", "foo=bar" ] # Optional extra flags. # # You can also put deps here if the grit source depends on generated # # files. @@ -212,34 +218,20 @@ template("grit") { grit_inputs = [ invoker.source ] assert_files_flags = [] - if (defined(invoker.outputs)) { - # If the declaration specified outputs, we want to make sure that they - # actually match what Grit is writing. We write the list to a file (some - # of the output lists are long enough to not fit on a Windows command line) - # and ask Grit to verify those are the actual outputs at runtime. - asserted_list_file = "$target_out_dir/${target_name}_expected_outputs.txt" - write_file(asserted_list_file, - rebase_path(invoker.outputs, root_build_dir, target_gen_dir)) - assert_files_flags += [ - "--assert-file-list=" + rebase_path(asserted_list_file, root_build_dir), - ] - grit_outputs = get_path_info( - rebase_path(invoker.outputs, ".", target_gen_dir), - "abspath") - } else { - # Ask Grit for the output list. - grit_outputs_build_rel = exec_script(grit_info_script, - [ "--outputs", "$rebased_output_dir", source_path, "-f", resource_ids ] + - grit_flags, - "list lines") - - # The names returned by grit are relative to the current (build) directory, - # but references to files in this template are expected to be relative to - # the invoking BUILD.gn file's directory. Make it absolute so there's no - # ambiguity. - grit_outputs = get_path_info( - rebase_path(grit_outputs_build_rel, ".", root_build_dir), "abspath") - } + + # We want to make sure the declared outputs actually match what Grit is + # writing. We write the list to a file (some of the output lists are long + # enough to not fit on a Windows command line) and ask Grit to verify those + # are the actual outputs at runtime. + asserted_list_file = "$target_out_dir/${target_name}_expected_outputs.txt" + write_file(asserted_list_file, + rebase_path(invoker.outputs, root_build_dir, target_gen_dir)) + assert_files_flags += [ + "--assert-file-list=" + rebase_path(asserted_list_file, root_build_dir), + ] + grit_outputs = get_path_info( + rebase_path(invoker.outputs, ".", target_gen_dir), + "abspath") # The config and the action below get this visibility son only the generated # source set can depend on them. The variable "target_name" will get -- cgit v1.1