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

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: 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
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('--whitelist-file',
22 help='File containing whitelisted resources for target.',
23 metavar='FILE')
24 parser.add_argument('--whitelist', action='store_true',
25 help='Indicates that whitelisting should be performed.')
26 parser.add_argument('command', nargs=argparse.REMAINDER,
27 help='Compilation command')
28 args = parser.parse_args()
29
30 returncode, _, stderr = wrapper_utils.GetCommandOutput(
31 wrapper_utils.CommandToRun(args.command))
32 if returncode != 0 or not args.whitelist:
agrieve 2016/07/27 01:42:27 Need to write stderr before returning.
estevenson 2016/07/28 21:56:45 Done.
33 return returncode
34
35 used_resources = wrapper_utils.GetResourceIdsInPragmaWarnings(stderr)
36 stderr = wrapper_utils.FilterUnknownPragmas(stderr)
37 if stderr:
38 sys.stderr.write(stderr)
39
40 if used_resources:
agrieve 2016/07/27 01:42:27 If a file used to have a resource, and is changed
estevenson 2016/07/28 21:56:45 Done.
41 with open(args.whitelist_file, 'w') as f:
42 f.write('\n'.join(str(resource) for resource in used_resources))
43 f.write('\n')
44
45 return returncode
46
47 if __name__ == "__main__":
48 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698