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

Side by Side Diff: tools/dom/scripts/chromegenerator.py

Issue 12316032: Added more Chrome.* libraries to dart:chrome (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed local hardcoded paths Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module generates Dart Chrome APIs from the Chrome IDL files.""" 6 """This module generates Dart Chrome APIs from the Chrome IDL files."""
7 7
8 import sys 8 import sys
9 import os 9 import os
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 """ 58 """
59 59
60 # The format for adding files to TEMPLATE_CONTENT. Will be substituted with the 60 # The format for adding files to TEMPLATE_CONTENT. Will be substituted with the
61 # filename (not including the extension) of the IDL/JSON file. 61 # filename (not including the extension) of the IDL/JSON file.
62 TEMPLATE_FILE_FORMAT = 'part "$AUXILIARY_DIR/chrome/%s.dart";' 62 TEMPLATE_FILE_FORMAT = 'part "$AUXILIARY_DIR/chrome/%s.dart";'
63 63
64 # A list of schema files to generate. 64 # A list of schema files to generate.
65 # TODO(sashab): Later, use the ones from API_DIR/api.gyp and 65 # TODO(sashab): Later, use the ones from API_DIR/api.gyp and
66 # API_DIR/_permission_features.json (for 'platform_apps'). 66 # API_DIR/_permission_features.json (for 'platform_apps').
67 API_FILES = [ 67 API_FILES = [
68 "alarms.idl",
68 "app_window.idl", 69 "app_window.idl",
69 "app_runtime.idl", 70 "app_runtime.idl",
71 "bluetooth.idl",
72 "context_menus.json",
73 "file_system.idl",
74 "media_galleries.idl",
75 "media_galleries_private.idl",
76 "push_messaging.idl",
77 "serial.idl",
78 "socket.idl",
79 "sync_file_system.idl",
80 "system_indicator.idl",
81 "system_info_display.idl",
82 "usb.idl",
83 # TODO(sashab): Add experimental APIs here, too.
70 ] 84 ]
71 85
72 if __name__ == "__main__": 86 if __name__ == "__main__":
73 # Generate each file. 87 # Generate each file.
74 for filename in API_FILES: 88 for filename in API_FILES:
75 result = os.system('python "%s" -g dart -D "%s" -d "%s" -r "%s" "%s"' % ( 89 result = os.system('python "%s" -g dart -D "%s" -d "%s" -r "%s" "%s"' % (
76 COMPILER, OVERRIDES_DIR, OUTPUT_DIR, API_DIR, 90 COMPILER, OVERRIDES_DIR, OUTPUT_DIR, API_DIR,
77 os.path.join(API_DIR, filename))) 91 os.path.join(API_DIR, filename)))
78 if result != 0: 92 if result != 0:
79 print "Error occurred during generation of %s" % ( 93 print "Error occurred during generation of %s" % (
80 os.path.join(API_DIR, filename)) 94 os.path.join(API_DIR, filename))
81 sys.exit(1) 95 sys.exit(1)
82 else: 96 else:
83 print "Generated %s successfully to %s.dart" % ( 97 print "Generated %s successfully to %s.dart" % (
84 os.path.join(API_DIR, filename), 98 os.path.join(API_DIR, filename),
85 os.path.join(OUTPUT_DIR, os.path.splitext(filename)[0])) 99 os.path.join(OUTPUT_DIR, os.path.splitext(filename)[0]))
86 100
87 # Generate the template. 101 # Generate the template.
88 files_to_add = (TEMPLATE_FILE_FORMAT % os.path.splitext(f)[0] 102 files_to_add = (TEMPLATE_FILE_FORMAT % os.path.splitext(f)[0]
89 for f in API_FILES) 103 for f in API_FILES)
90 with open(OUTPUT_TEMPLATE, 'w') as template_file: 104 with open(OUTPUT_TEMPLATE, 'w') as template_file:
91 template_file.write(TEMPLATE_CONTENT) 105 template_file.write(TEMPLATE_CONTENT)
92 template_file.write('\n'.join(files_to_add)) 106 template_file.write('\n'.join(files_to_add))
93 print "Generated template succesfully." 107 print "Generated template succesfully."
94 108
95 109
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698