Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: build/secondary/tools/grit/grit_rule.gni

Issue 411543005: Encode all grit outputs in .gn files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/secondary/chrome/BUILD.gn ('k') | chrome/app/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/secondary/tools/grit/grit_rule.gni
diff --git a/build/secondary/tools/grit/grit_rule.gni b/build/secondary/tools/grit/grit_rule.gni
index 178fb6429969836769932d578293993ab553ab37..6d88f5843aadb768c39f9422d5226dba6d728cc0 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
« no previous file with comments | « build/secondary/chrome/BUILD.gn ('k') | chrome/app/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698