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

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

Issue 19090002: Update dart:chrome APIs and include chrome.fileSystem (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | tools/dom/src/chrome/app_runtime.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 "app_window.idl", 68 "app_window.idl",
69 "app_runtime.idl", 69 "app_runtime.idl",
70 "file_system.idl",
70 ] 71 ]
71 72
72 if __name__ == "__main__": 73 if __name__ == "__main__":
73 # Generate each file. 74 # Generate each file.
74 for filename in API_FILES: 75 for filename in API_FILES:
75 result = os.system('python "%s" -g dart -D "%s" -d "%s" -r "%s" "%s"' % ( 76 result = os.system('python "%s" -g dart -D "%s" -d "%s" -r "%s" "%s"' % (
76 COMPILER, OVERRIDES_DIR, OUTPUT_DIR, API_DIR, 77 COMPILER, OVERRIDES_DIR, OUTPUT_DIR, API_DIR,
77 os.path.join(API_DIR, filename))) 78 os.path.join(API_DIR, filename)))
78 if result != 0: 79 if result != 0:
79 print "Error occurred during generation of %s" % ( 80 print "Error occurred during generation of %s" % (
80 os.path.join(API_DIR, filename)) 81 os.path.join(API_DIR, filename))
81 sys.exit(1) 82 sys.exit(1)
82 else: 83 else:
83 print "Generated %s successfully to %s.dart" % ( 84 print "Generated %s successfully to %s.dart" % (
84 os.path.join(API_DIR, filename), 85 os.path.join(API_DIR, filename),
85 os.path.join(OUTPUT_DIR, os.path.splitext(filename)[0])) 86 os.path.join(OUTPUT_DIR, os.path.splitext(filename)[0]))
86 87
87 # Generate the template. 88 # Generate the template.
88 files_to_add = (TEMPLATE_FILE_FORMAT % os.path.splitext(f)[0] 89 files_to_add = (TEMPLATE_FILE_FORMAT % os.path.splitext(f)[0]
89 for f in API_FILES) 90 for f in API_FILES)
90 with open(OUTPUT_TEMPLATE, 'w') as template_file: 91 with open(OUTPUT_TEMPLATE, 'w') as template_file:
91 template_file.write(TEMPLATE_CONTENT) 92 template_file.write(TEMPLATE_CONTENT)
92 template_file.write('\n'.join(files_to_add)) 93 template_file.write('\n'.join(files_to_add))
93 print "Generated template succesfully." 94 print "Generated template succesfully."
94 95
95 96
OLDNEW
« no previous file with comments | « no previous file | tools/dom/src/chrome/app_runtime.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698