Skip to content

Commit

Permalink
Reland of Fix nits in generate_resource_whitelist.* (patchset chromium#1
Browse files Browse the repository at this point in the history
 id:1 of https://codereview.chromium.org/2961413002/ )

Reason for revert:
Relanding with fix

Original issue's description:
> Revert of Fix nits in generate_resource_whitelist.* (patchset chromium#1 id:1 of https://codereview.chromium.org/2968523002/ )
>
> Reason for revert:
> This appears to have broken all the chromium.perf android compile bots. https://uberchromegw.corp.google.com/i/chromium.perf/builders/Android%20Builder/builds/173655 is an example.
>
> Original issue's description:
> > Fix nits in generate_resource_whitelist.*
> >
> > Review-Url: https://codereview.chromium.org/2968523002
> > Cr-Commit-Position: refs/heads/master@{#483477}
> > Committed: https://chromium.googlesource.com/chromium/src/+/10bc4e3b570ce253ccd4be34b146719669bbedda
>
> TBR=agrieve@chromium.org,zpeng@chromium.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Review-Url: https://codereview.chromium.org/2961413002
> Cr-Commit-Position: refs/heads/master@{#483513}
> Committed: https://chromium.googlesource.com/chromium/src/+/f6cf7568ddef65314d13badf262e96695edbc226

TBR=agrieve@chromium.org,martiniss@chromium.org

Review-Url: https://codereview.chromium.org/2966783002
Cr-Commit-Position: refs/heads/master@{#483734}
  • Loading branch information
zpeng authored and Commit Bot committed Jun 30, 2017
1 parent 8432380 commit 345172b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
6 changes: 3 additions & 3 deletions tools/resources/generate_resource_whitelist.gni
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ template("generate_resource_whitelist") {
]

args = [
"-i",
"--input",
rebase_path(invoker.input, root_build_dir),
"-o",
"--output",
rebase_path(invoker.output, root_build_dir),
"--out-dir=.",
"--output-directory=.",
]
}
}
27 changes: 14 additions & 13 deletions tools/resources/generate_resource_whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import argparse
import os
import re
import sys

USAGE = """generate_resource_whitelist.py [-h] [-i INPUT] [-o OUTPUT]
__doc__ = """generate_resource_whitelist.py [-h] [--input INPUT]
[--output OUTPUT]
INPUT specifies a file containing existing resource IDs that should be
whitelisted, where each line of INPUT contains a single resource ID.
Expand All @@ -27,9 +23,14 @@
[-Wunknown-pragmas]
On Windows, the message is simply a message via __pragma(message(...)).
"""

import argparse
import os
import re
import sys


COMPONENTS_STRINGS_HEADER = 'gen/components/strings/grit/components_strings.h'

# We don't want the resources are different between 32-bit and 64-bit build,
Expand All @@ -56,22 +57,22 @@ def _FindResourceIds(header, resource_names):


def main():
parser = argparse.ArgumentParser(usage=USAGE)
parser = argparse.ArgumentParser(usage=__doc__)
parser.add_argument(
'-i', '--input', type=argparse.FileType('r'), default=sys.stdin,
'--input', type=argparse.FileType('r'), default=sys.stdin,
help='A resource whitelist where each line contains one resource ID')
parser.add_argument(
'-o', '--output', type=argparse.FileType('w'), default=sys.stdout,
'--output', type=argparse.FileType('w'), default=sys.stdout,
help='The resource list path to write (default stdout)')
parser.add_argument(
'--out-dir', required=True,
help='The out target directory, for example out/Release')
'--output-directory', required=True,
help='The output target directory, for example out/Release')

args = parser.parse_args()

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

for resource_id in sorted(used_resources):
Expand Down

0 comments on commit 345172b

Please sign in to comment.