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

Unified Diff: mojo/public/tools/bindings/format_typemap_generator_args.py

Issue 1832703002: Mojo: Simplify typemap usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-bindings-variant-import
Patch Set: add missing mash dependency Created 4 years, 8 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
Index: mojo/public/tools/bindings/format_typemap_generator_args.py
diff --git a/mojo/public/tools/bindings/format_typemap_generator_args.py b/mojo/public/tools/bindings/format_typemap_generator_args.py
new file mode 100755
index 0000000000000000000000000000000000000000..5057d6cdacaf8411d059a9e456fecaf5df41531c
--- /dev/null
+++ b/mojo/public/tools/bindings/format_typemap_generator_args.py
@@ -0,0 +1,34 @@
+#!/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.
+
+import sys
+
+# This utility converts mojom dependencies into their corresponding typemap
+# paths and formats them to be consumed by generate_type_mappings.py.
+
+
+def FormatTypemap(typemap_filename):
+ # A simple typemap is valid Python with a minor alteration.
+ with open(typemap_filename) as f:
+ typemap_content = f.read().replace('=\n', '=')
+ typemap = {}
+ exec typemap_content in typemap
+
+ for header in typemap.get('public_headers', []):
+ yield 'public_headers=%s' % header
+ for header in typemap.get('traits_headers', []):
+ yield 'traits_headers=%s' % header
+ for header in typemap.get('type_mappings', []):
+ yield 'type_mappings=%s' % header
+
+
+def main():
+ typemaps = sys.argv[1:]
+ print ' '.join('--start-typemap %s' % ' '.join(FormatTypemap(typemap))
+ for typemap in typemaps)
+
+
+if __name__ == '__main__':
+ sys.exit(main())
« no previous file with comments | « mojo/public/tools/bindings/chromium_bindings_configuration.gni ('k') | mojo/public/tools/bindings/generate_type_mappings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698