| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 _libraries = ['html', 'indexed_db', 'svg', 'web_audio'] | 32 _libraries = ['html', 'indexed_db', 'svg', 'web_audio'] |
| 33 | 33 |
| 34 class GeneratorOptions(object): | 34 class GeneratorOptions(object): |
| 35 def __init__(self, templates, database, type_registry, renamer): | 35 def __init__(self, templates, database, type_registry, renamer): |
| 36 self.templates = templates | 36 self.templates = templates |
| 37 self.database = database | 37 self.database = database |
| 38 self.type_registry = type_registry | 38 self.type_registry = type_registry |
| 39 self.renamer = renamer | 39 self.renamer = renamer |
| 40 | 40 |
| 41 # TODO(vsm): Remove once we fix Dartium to pass in the database directly. | |
| 42 def Generate(database_dir, use_database_cache, dart2js_output_dir=None, | |
| 43 dartium_output_dir=None): | |
| 44 database = LoadDatabase(database_dir, use_database_cache) | |
| 45 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir) | |
| 46 | |
| 47 def LoadDatabase(database_dir, use_database_cache): | 41 def LoadDatabase(database_dir, use_database_cache): |
| 48 common_database = database.Database(database_dir) | 42 common_database = database.Database(database_dir) |
| 49 if use_database_cache: | 43 if use_database_cache: |
| 50 common_database.LoadFromCache() | 44 common_database.LoadFromCache() |
| 51 else: | 45 else: |
| 52 common_database.Load() | 46 common_database.Load() |
| 53 return common_database | 47 return common_database |
| 54 | 48 |
| 55 def GenerateFromDatabase(common_database, dart2js_output_dir, | 49 def GenerateFromDatabase(common_database, dart2js_output_dir, |
| 56 dartium_output_dir): | 50 dartium_output_dir): |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) | 200 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) |
| 207 if 'htmldartium' in systems: | 201 if 'htmldartium' in systems: |
| 208 _logger.info('Generating dartium single files.') | 202 _logger.info('Generating dartium single files.') |
| 209 for library_name in _libraries: | 203 for library_name in _libraries: |
| 210 GenerateSingleFile( | 204 GenerateSingleFile( |
| 211 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), | 205 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), |
| 212 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) | 206 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) |
| 213 | 207 |
| 214 if __name__ == '__main__': | 208 if __name__ == '__main__': |
| 215 sys.exit(main()) | 209 sys.exit(main()) |
| OLD | NEW |