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

Side by Side Diff: build/toolchain/gcc_compile_wrapper.py

Issue 2175413004: Enable whitelist generation for all builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + change output dir Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « build/toolchain/gcc_ar_wrapper.py ('k') | build/toolchain/gcc_solink_wrapper.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Runs a compilation command.
7
8 This script exists to avoid using complex shell commands in
9 gcc_toolchain.gni's tool("cxx") and tool("cc") in case the host running the
10 compiler does not have a POSIX-like shell (e.g. Windows).
11 """
12
13 import argparse
14 import sys
15
16 import wrapper_utils
17
18
19 def main():
20 parser = argparse.ArgumentParser(description=__doc__)
21 parser.add_argument('--resource-whitelist',
22 help='Generate a resource whitelist for this target.',
23 metavar='PATH')
24 parser.add_argument('command', nargs=argparse.REMAINDER,
25 help='Compilation command')
26 args = parser.parse_args()
27
28 returncode, stderr = wrapper_utils.CaptureCommandStderr(
29 wrapper_utils.CommandToRun(args.command))
30
31 used_resources = wrapper_utils.ExtractResourceIdsFromPragmaWarnings(stderr)
32 sys.stderr.write(stderr)
33
34 if args.resource_whitelist:
35 with open(args.resource_whitelist, 'w') as f:
36 if used_resources:
37 f.write('\n'.join(str(resource) for resource in used_resources))
38 f.write('\n')
39
40
41 return returncode
42
43 if __name__ == "__main__":
44 sys.exit(main())
OLDNEW
« no previous file with comments | « build/toolchain/gcc_ar_wrapper.py ('k') | build/toolchain/gcc_solink_wrapper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698