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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/gcc_compile_wrapper.py
diff --git a/build/toolchain/gcc_compile_wrapper.py b/build/toolchain/gcc_compile_wrapper.py
new file mode 100755
index 0000000000000000000000000000000000000000..0e04dde3d3f36a16a47086298762d7aecdbede2d
--- /dev/null
+++ b/build/toolchain/gcc_compile_wrapper.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Runs a compilation command.
+
+This script exists to avoid using complex shell commands in
+gcc_toolchain.gni's tool("cxx") and tool("cc") in case the host running the
+compiler does not have a POSIX-like shell (e.g. Windows).
+"""
+
+import argparse
+import sys
+
+import wrapper_utils
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('--resource-whitelist',
+ help='Generate a resource whitelist for this target.',
+ metavar='PATH')
+ parser.add_argument('command', nargs=argparse.REMAINDER,
+ help='Compilation command')
+ args = parser.parse_args()
+
+ returncode, stderr = wrapper_utils.CaptureCommandStderr(
+ wrapper_utils.CommandToRun(args.command))
+
+ used_resources = wrapper_utils.ExtractResourceIdsFromPragmaWarnings(stderr)
+ sys.stderr.write(stderr)
+
+ if args.resource_whitelist:
+ with open(args.resource_whitelist, 'w') as f:
+ if used_resources:
+ f.write('\n'.join(str(resource) for resource in used_resources))
+ f.write('\n')
+
+
+ return returncode
+
+if __name__ == "__main__":
+ sys.exit(main())
« 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