Skip to content

Commit

Permalink
Remove redundant logic from generate_resource_whitelist.py
Browse files Browse the repository at this point in the history
The --use-existing-resource-ids flag was added in
https://codereview.chromium.org/2278983002 in an attempt to maintain
compatibility with official builder scripts. These have been updated,
and the flag can now be removed.

BUG=

Review-Url: https://codereview.chromium.org/2401463002
Cr-Commit-Position: refs/heads/master@{#423510}
  • Loading branch information
estevenson authored and Commit bot committed Oct 6, 2016
1 parent 4ec6768 commit cbf236f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
1 change: 0 additions & 1 deletion tools/resources/generate_resource_whitelist.gni
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ template("generate_resource_whitelist") {
"-o",
rebase_path(invoker.output, root_build_dir),
"--out-dir=.",
"--use-existing-resource-ids",
]
}
}
26 changes: 1 addition & 25 deletions tools/resources/generate_resource_whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,6 @@ def _FindResourceIds(header, resource_names):
return set(res_ids)


# TODO(estevenson): Remove this after updating official build scripts.
def _GetResourceIdsInPragmaWarnings(input):
"""Returns set of resource ids that are inside unknown pragma warnings
for the given input.
"""
used_resources = set()
unknown_pragma_warning_pattern = re.compile(
'whitelisted_resource_(?P<resource_id>[0-9]+)')
for ln in input:
match = unknown_pragma_warning_pattern.search(ln)
if match:
resource_id = int(match.group('resource_id'))
used_resources.add(resource_id)
return used_resources


def main():
parser = argparse.ArgumentParser(usage=USAGE)
parser.add_argument(
Expand All @@ -82,18 +66,10 @@ def main():
parser.add_argument(
'--out-dir', required=True,
help='The out target directory, for example out/Release')
parser.add_argument(
'--use-existing-resource-ids', action='store_true', default=False,
help='Specifies that the input file already contains resource ids')

args = parser.parse_args()

used_resources = set()
if args.use_existing_resource_ids:
used_resources.update([int(resource_id) for resource_id in args.input])
else:
used_resources.update(_GetResourceIdsInPragmaWarnings(args.input))

used_resources = set(int(resource_id) for resource_id in args.input)
used_resources |= _FindResourceIds(
os.path.join(args.out_dir, COMPONENTS_STRINGS_HEADER),
ARCH_SPECIFIC_RESOURCES)
Expand Down

0 comments on commit cbf236f

Please sign in to comment.