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

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

Issue 1416683004: Port enable_resource_whitelist_generation GYP->GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move cflags to public_config Created 5 years, 1 month 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 | « no previous file | no next file » | 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 a5cf81a67568c6f40a10bfbd1c7e3fb8feafa662..083e3d93e437b8c73b8690ebba73feb43a34e858 100644
--- a/build/secondary/tools/grit/grit_rule.gni
+++ b/build/secondary/tools/grit/grit_rule.gni
@@ -83,6 +83,11 @@ import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
+declare_args() {
+ # Enables used resource whitelist generation.
+ enable_resource_whitelist_generation = false
+}
+
grit_defines = []
# Mac and iOS want Title Case strings.
@@ -335,10 +340,17 @@ template("grit") {
rebased_output_dir = rebase_path(output_dir, root_build_dir)
source_path = rebase_path(invoker.source, root_build_dir)
+ grit_flags = []
+ if (enable_resource_whitelist_generation) {
+ grit_flags += [ "-h" ]
+ if (is_win) {
+ grit_flags += [ "#define {textual_id} __pragma(message(\"whitelisted_resource_{numeric_id}\")) {numeric_id}" ]
+ } else {
+ grit_flags += [ "#define {textual_id} _Pragma(\"whitelisted_resource_{numeric_id}\") {numeric_id}" ]
+ }
+ }
if (defined(invoker.grit_flags)) {
- grit_flags = invoker.grit_flags
- } else {
- grit_flags = [] # These are optional so default to empty list.
+ grit_flags += invoker.grit_flags
}
assert_files_flags = []
@@ -371,6 +383,13 @@ template("grit") {
!invoker.use_qualified_include) {
include_dirs = [ output_dir ]
}
+
+ if ((is_linux || is_android) && enable_resource_whitelist_generation) {
+ cflags = [
+ "-Wunknown-pragmas",
+ "-Wno-error=unknown-pragmas",
+ ]
+ }
visibility = target_visibility
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698