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

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

Issue 450693005: Eliminate the old non blink code paths from idl generation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/dom/scripts/go.sh » ('j') | tools/dom/scripts/htmldartgenerator.py » ('J')
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) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, 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 is the entry point to create Dart APIs from the IDL database.""" 6 """This is the entry point to create Dart APIs from the IDL database."""
7 7
8 import dartgenerator 8 import dartgenerator
9 import database 9 import database
10 import fremontcutbuilder 10 import fremontcutbuilder
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 def LoadDatabase(database_dir, use_database_cache): 44 def LoadDatabase(database_dir, use_database_cache):
45 common_database = database.Database(database_dir) 45 common_database = database.Database(database_dir)
46 if use_database_cache: 46 if use_database_cache:
47 common_database.LoadFromCache() 47 common_database.LoadFromCache()
48 else: 48 else:
49 common_database.Load() 49 common_database.Load()
50 return common_database 50 return common_database
51 51
52 def GenerateFromDatabase(common_database, dart2js_output_dir, 52 def GenerateFromDatabase(common_database, dart2js_output_dir,
53 dartium_output_dir, update_dom_metadata=False, 53 dartium_output_dir, update_dom_metadata=False):
54 dart_use_blink=False):
55 current_dir = os.path.dirname(__file__) 54 current_dir = os.path.dirname(__file__)
56 auxiliary_dir = os.path.join(current_dir, '..', 'src') 55 auxiliary_dir = os.path.join(current_dir, '..', 'src')
57 template_dir = os.path.join(current_dir, '..', 'templates') 56 template_dir = os.path.join(current_dir, '..', 'templates')
58 57
59 generator = dartgenerator.DartGenerator() 58 generator = dartgenerator.DartGenerator()
60 generator.LoadAuxiliary(auxiliary_dir) 59 generator.LoadAuxiliary(auxiliary_dir)
61 60
62 generator.FilterMembersWithUnidentifiedTypes(common_database) 61 generator.FilterMembersWithUnidentifiedTypes(common_database)
63 webkit_database = common_database.Clone() 62 webkit_database = common_database.Clone()
64 63
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 HTML_LIBRARY_NAMES, template_loader, 'dart2js', dart2js_output_dir) 113 HTML_LIBRARY_NAMES, template_loader, 'dart2js', dart2js_output_dir)
115 114
116 RunGenerator(dart_libraries, dart_output_dir, 115 RunGenerator(dart_libraries, dart_output_dir,
117 template_loader, backend_factory) 116 template_loader, backend_factory)
118 117
119 if dartium_output_dir: 118 if dartium_output_dir:
120 template_paths = ['html/dartium', 'html/impl', 'html/interface', ''] 119 template_paths = ['html/dartium', 'html/impl', 'html/interface', '']
121 template_loader = TemplateLoader(template_dir, 120 template_loader = TemplateLoader(template_dir,
122 template_paths, 121 template_paths,
123 {'DARTIUM': True, 'DART2JS': False, 122 {'DARTIUM': True, 'DART2JS': False,
124 'DART_USE_BLINK' : dart_use_blink}) 123 'DART_USE_BLINK' : True})
Emily Fortuna 2014/08/07 18:35:11 shall we just delete this key from the map?
Leaf 2014/08/07 19:38:24 Done.
125 backend_options = GeneratorOptions( 124 backend_options = GeneratorOptions(
126 template_loader, webkit_database, type_registry, renamer, 125 template_loader, webkit_database, type_registry, renamer,
127 metadata) 126 metadata)
128 cpp_output_dir = os.path.join(dartium_output_dir, 'cpp') 127 cpp_output_dir = os.path.join(dartium_output_dir, 'cpp')
129 cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir) 128 cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir)
130 dart_output_dir = os.path.join(dartium_output_dir, 'dart') 129 dart_output_dir = os.path.join(dartium_output_dir, 'dart')
131 native_library_emitter = \ 130 native_library_emitter = \
132 GetNativeLibraryEmitter(emitters, template_loader, 131 GetNativeLibraryEmitter(emitters, template_loader,
133 dartium_output_dir, dart_output_dir, 132 dartium_output_dir, dart_output_dir,
134 auxiliary_dir) 133 auxiliary_dir)
135 backend_factory = lambda interface:\ 134 backend_factory = lambda interface:\
136 DartiumBackend(interface, native_library_emitter, 135 DartiumBackend(interface, native_library_emitter,
137 cpp_library_emitter, backend_options, dart_use_blink) 136 cpp_library_emitter, backend_options)
138 dart_libraries = DartLibraries( 137 dart_libraries = DartLibraries(
139 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir) 138 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir)
140 RunGenerator(dart_libraries, dart_output_dir, 139 RunGenerator(dart_libraries, dart_output_dir,
141 template_loader, backend_factory) 140 template_loader, backend_factory)
142 cpp_library_emitter.EmitDerivedSources( 141 cpp_library_emitter.EmitDerivedSources(
143 template_loader.Load('cpp_derived_sources.template'), 142 template_loader.Load('cpp_derived_sources.template'),
144 dartium_output_dir) 143 dartium_output_dir)
145 cpp_library_emitter.EmitResolver( 144 cpp_library_emitter.EmitResolver(
146 template_loader.Load('cpp_resolver.template'), dartium_output_dir) 145 template_loader.Load('cpp_resolver.template'), dartium_output_dir)
147 cpp_library_emitter.EmitClassIdTable( 146 cpp_library_emitter.EmitClassIdTable(
(...skipping 24 matching lines...) Expand all
172 action='store_true', default=False, 171 action='store_true', default=False,
173 help='Rebuild the database from IDL using fremontcut.') 172 help='Rebuild the database from IDL using fremontcut.')
174 parser.add_option('--systems', dest='systems', 173 parser.add_option('--systems', dest='systems',
175 action='store', type='string', 174 action='store', type='string',
176 default='htmldart2js,htmldartium', 175 default='htmldart2js,htmldartium',
177 help='Systems to generate (htmldart2js, htmldartium)') 176 help='Systems to generate (htmldart2js, htmldartium)')
178 parser.add_option('--output-dir', dest='output_dir', 177 parser.add_option('--output-dir', dest='output_dir',
179 action='store', type='string', 178 action='store', type='string',
180 default=None, 179 default=None,
181 help='Directory to put the generated files') 180 help='Directory to put the generated files')
182 parser.add_option('--use-blink', dest='dart_use_blink',
183 action='store_true',
184 default=False,
185 help='''Delegate all native calls to dart:blink''')
186 parser.add_option('--use-database-cache', dest='use_database_cache', 181 parser.add_option('--use-database-cache', dest='use_database_cache',
187 action='store_true', 182 action='store_true',
188 default=False, 183 default=False,
189 help='''Use the cached database from the previous run to 184 help='''Use the cached database from the previous run to
190 improve startup performance''') 185 improve startup performance''')
191 parser.add_option('--update-dom-metadata', dest='update_dom_metadata', 186 parser.add_option('--update-dom-metadata', dest='update_dom_metadata',
192 action='store_true', 187 action='store_true',
193 default=False, 188 default=False,
194 help='''Update the metadata list of DOM APIs''') 189 help='''Update the metadata list of DOM APIs''')
195 (options, args) = parser.parse_args() 190 (options, args) = parser.parse_args()
(...skipping 14 matching lines...) Expand all
210 if 'htmldartium' in systems: 205 if 'htmldartium' in systems:
211 dartium_output_dir = os.path.join(output_dir, 'dartium') 206 dartium_output_dir = os.path.join(output_dir, 'dartium')
212 207
213 if options.rebuild: 208 if options.rebuild:
214 # Parse the IDL and create the database. 209 # Parse the IDL and create the database.
215 database = fremontcutbuilder.main(options.parallel) 210 database = fremontcutbuilder.main(options.parallel)
216 else: 211 else:
217 # Load the previously generated database. 212 # Load the previously generated database.
218 database = LoadDatabase(database_dir, options.use_database_cache) 213 database = LoadDatabase(database_dir, options.use_database_cache)
219 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir, 214 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir,
220 options.update_dom_metadata, options.dart_use_blink) 215 options.update_dom_metadata)
221 216
222 if 'htmldart2js' in systems: 217 if 'htmldart2js' in systems:
223 _logger.info('Generating dart2js single files.') 218 _logger.info('Generating dart2js single files.')
224 for library_name in HTML_LIBRARY_NAMES: 219 for library_name in HTML_LIBRARY_NAMES:
225 GenerateSingleFile( 220 GenerateSingleFile(
226 os.path.join(dart2js_output_dir, '%s_dart2js.dart' % library_name), 221 os.path.join(dart2js_output_dir, '%s_dart2js.dart' % library_name),
227 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) 222 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js'))
228 if 'htmldartium' in systems: 223 if 'htmldartium' in systems:
229 _logger.info('Generating dartium single files.') 224 _logger.info('Generating dartium single files.')
230 for library_name in HTML_LIBRARY_NAMES: 225 for library_name in HTML_LIBRARY_NAMES:
231 GenerateSingleFile( 226 GenerateSingleFile(
232 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), 227 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name),
233 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) 228 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium'))
234 GenerateSingleFile( 229 GenerateSingleFile(
235 os.path.join(dartium_output_dir, '_blink_dartium.dart'), 230 os.path.join(dartium_output_dir, '_blink_dartium.dart'),
236 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium')) 231 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium'))
237 232
238 if __name__ == '__main__': 233 if __name__ == '__main__':
239 sys.exit(main()) 234 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/dom/scripts/go.sh » ('j') | tools/dom/scripts/htmldartgenerator.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698