summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/common.gypi2
-rw-r--r--build/repack_action.gypi9
-rw-r--r--chrome/chrome_repack_locales.gypi2
-rwxr-xr-xchrome/tools/build/repack_locales.py8
-rwxr-xr-xtools/resources/find_used_resources.py5
5 files changed, 21 insertions, 5 deletions
diff --git a/build/common.gypi b/build/common.gypi
index f919949..58c48ef 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -1895,7 +1895,7 @@
'grit_defines': ['-D', 'enable_notifications'],
}],
['enable_resource_whitelist_generation==1', {
- 'grit_rc_header_format': ['-h', '#define {textual_id} _Pragma("{textual_id}") {numeric_id}'],
+ 'grit_rc_header_format': ['-h', '#define {textual_id} _Pragma("whitelisted_resource_{numeric_id}") {numeric_id}'],
}],
['enable_mdns==1 or OS=="mac"', {
'grit_defines': ['-D', 'enable_service_discovery'],
diff --git a/build/repack_action.gypi b/build/repack_action.gypi
index e4bbf68..be91ac7 100644
--- a/build/repack_action.gypi
+++ b/build/repack_action.gypi
@@ -11,6 +11,7 @@
{
'variables': {
'repack_path': '<(DEPTH)/tools/grit/grit/format/repack.py',
+ 'repack_options%': [],
},
'inputs': [
'<(repack_path)',
@@ -19,5 +20,11 @@
'outputs': [
'<(pak_output)'
],
- 'action': ['python', '<(repack_path)', '<(pak_output)', '<@(pak_inputs)'],
+ 'action': [
+ 'python',
+ '<(repack_path)',
+ '<@(repack_options)',
+ '<(pak_output)',
+ '<@(pak_inputs)',
+ ],
}
diff --git a/chrome/chrome_repack_locales.gypi b/chrome/chrome_repack_locales.gypi
index 0e24ee2..28515c7 100644
--- a/chrome/chrome_repack_locales.gypi
+++ b/chrome/chrome_repack_locales.gypi
@@ -7,6 +7,7 @@
{
'variables': {
'repack_locales_path': 'tools/build/repack_locales.py',
+ 'repack_options%': [],
'conditions': [
['branding=="Chrome"', {
'branding_flag': ['-b', 'google_chrome',],
@@ -31,6 +32,7 @@
'-s', '<(SHARED_INTERMEDIATE_DIR)',
'-x', '<(SHARED_INTERMEDIATE_DIR)/.',
'--use-ash', '<(use_ash)',
+ '<@(repack_options)',
'<@(pak_locales)',
],
}
diff --git a/chrome/tools/build/repack_locales.py b/chrome/tools/build/repack_locales.py
index 96f47eb..6dbcef5 100755
--- a/chrome/tools/build/repack_locales.py
+++ b/chrome/tools/build/repack_locales.py
@@ -31,6 +31,8 @@ OS = None
USE_ASH = False
+WHITELIST = None
+
# Extra input files.
EXTRA_INPUT_FILES = []
@@ -153,7 +155,7 @@ def repack_locales(locales):
inputs = []
inputs += calc_inputs(locale)
output = calc_output(locale)
- data_pack.DataPack.RePack(output, inputs)
+ data_pack.DataPack.RePack(output, inputs, whitelist_file=WHITELIST)
def DoMain(argv):
@@ -163,6 +165,7 @@ def DoMain(argv):
global INT_DIR
global OS
global USE_ASH
+ global WHITELIST
global EXTRA_INPUT_FILES
parser = optparse.OptionParser("usage: %prog [options] locales")
@@ -185,6 +188,8 @@ def DoMain(argv):
help="The target OS. (e.g. mac, linux, win, etc.)")
parser.add_option("--use-ash", action="store", dest="use_ash",
help="Whether to include ash strings")
+ parser.add_option("--whitelist", action="store", help="Full path to the "
+ "whitelist used to filter output pak file resource IDs")
options, locales = parser.parse_args(argv)
if not locales:
@@ -199,6 +204,7 @@ def DoMain(argv):
EXTRA_INPUT_FILES = options.extra_input
OS = options.os
USE_ASH = options.use_ash == '1'
+ WHITELIST = options.whitelist
if not OS:
if sys.platform == 'darwin':
diff --git a/tools/resources/find_used_resources.py b/tools/resources/find_used_resources.py
index 60af3e5..3fc3bce 100755
--- a/tools/resources/find_used_resources.py
+++ b/tools/resources/find_used_resources.py
@@ -18,7 +18,8 @@ script parses out the list of used resource ids. These resource ids show up in
the build output after building Chrome with gyp variable
enable_resource_whitelist_generation set to 1. This gyp flag causes the compiler
to print out a UnknownPragma message every time a resource id is used. E.g.:
-foo.cc:22:0: warning: ignoring #pragma IDS_FOO_BAR [-Wunknown-pragmas]
+foo.cc:22:0: warning: ignoring #pragma whitelisted_resource_12345
+[-Wunknown-pragmas]
"""
@@ -29,7 +30,7 @@ def GetResourceIdsInPragmaWarnings(input):
"""
used_resources = set()
unknown_pragma_warning_pattern = re.compile('warning: ignoring #pragma '
- '(?P<resource_id>[A-Z0-9_]*) \[-Wunknown-pragmas\]')
+ 'whitelisted_resource_(?P<resource_id>[0-9]*) \[-Wunknown-pragmas\]')
for ln in input:
match = unknown_pragma_warning_pattern.search(ln)
if match: