| 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 css_code_generator | 8 import css_code_generator |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 import shutil | 43 import shutil |
| 44 import subprocess | 44 import subprocess |
| 45 import time | 45 import time |
| 46 from dartmetadata import DartMetadata | 46 from dartmetadata import DartMetadata |
| 47 from generator import TypeRegistry | 47 from generator import TypeRegistry |
| 48 from htmleventgenerator import HtmlEventGenerator | 48 from htmleventgenerator import HtmlEventGenerator |
| 49 from htmlrenamer import HtmlRenamer | 49 from htmlrenamer import HtmlRenamer |
| 50 from systemhtml import DartLibraryEmitter, Dart2JSBackend,\ | 50 from systemhtml import DartLibraryEmitter, Dart2JSBackend,\ |
| 51 HtmlDartInterfaceGenerator, DartLibrary, DartLibraries,\ | 51 HtmlDartInterfaceGenerator, DartLibrary, DartLibraries,\ |
| 52 HTML_LIBRARY_NAMES | 52 HTML_LIBRARY_NAMES |
| 53 from systemnative import CPPLibraryEmitter, DartiumBackend, \ | 53 from systemnative import CPPLibraryEmitter, DartiumBackend |
| 54 GetNativeLibraryEmitter | |
| 55 from templateloader import TemplateLoader | 54 from templateloader import TemplateLoader |
| 56 | 55 |
| 57 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) | 56 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) |
| 58 | 57 |
| 59 import utils | 58 import utils |
| 60 | 59 |
| 61 | 60 |
| 62 _logger = logging.getLogger('dartdomgenerator') | 61 _logger = logging.getLogger('dartdomgenerator') |
| 63 | 62 |
| 64 class GeneratorOptions(object): | 63 class GeneratorOptions(object): |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 template_paths = ['html/dartium', 'html/impl', 'html/interface', ''] | 159 template_paths = ['html/dartium', 'html/impl', 'html/interface', ''] |
| 161 template_loader = TemplateLoader(template_dir, | 160 template_loader = TemplateLoader(template_dir, |
| 162 template_paths, | 161 template_paths, |
| 163 {'DARTIUM': True, 'DART2JS': False}) | 162 {'DARTIUM': True, 'DART2JS': False}) |
| 164 backend_options = GeneratorOptions( | 163 backend_options = GeneratorOptions( |
| 165 template_loader, webkit_database, type_registry, renamer, | 164 template_loader, webkit_database, type_registry, renamer, |
| 166 metadata) | 165 metadata) |
| 167 cpp_output_dir = os.path.join(dartium_output_dir, 'cpp') | 166 cpp_output_dir = os.path.join(dartium_output_dir, 'cpp') |
| 168 cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir) | 167 cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir) |
| 169 dart_output_dir = os.path.join(dartium_output_dir, 'dart') | 168 dart_output_dir = os.path.join(dartium_output_dir, 'dart') |
| 170 native_library_emitter = \ | |
| 171 GetNativeLibraryEmitter(emitters, template_loader, | |
| 172 dartium_output_dir, dart_output_dir, | |
| 173 auxiliary_dir) | |
| 174 backend_factory = lambda interface:\ | 169 backend_factory = lambda interface:\ |
| 175 DartiumBackend(interface, native_library_emitter, | 170 DartiumBackend(interface, cpp_library_emitter, backend_options) |
| 176 cpp_library_emitter, backend_options) | |
| 177 dart_libraries = DartLibraries( | 171 dart_libraries = DartLibraries( |
| 178 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir) | 172 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir) |
| 179 | 173 |
| 180 print '\nGenerating dartium:\n' | 174 print '\nGenerating dartium:\n' |
| 181 start_time = time.time() | 175 start_time = time.time() |
| 182 | 176 |
| 183 RunGenerator(dart_libraries, dart_output_dir, | 177 RunGenerator(dart_libraries, dart_output_dir, |
| 184 template_loader, backend_factory) | 178 template_loader, backend_factory) |
| 185 print 'Generated dartium in %s seconds' % round(time.time() - start_time, 2) | 179 print 'Generated dartium in %s seconds' % round(time.time() - start_time, 2) |
| 186 | 180 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) | 279 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) |
| 286 | 280 |
| 287 if 'htmldartium' in systems: | 281 if 'htmldartium' in systems: |
| 288 _logger.info('Generating dartium single files.') | 282 _logger.info('Generating dartium single files.') |
| 289 file_generation_start_time = time.time() | 283 file_generation_start_time = time.time() |
| 290 | 284 |
| 291 for library_name in HTML_LIBRARY_NAMES: | 285 for library_name in HTML_LIBRARY_NAMES: |
| 292 GenerateSingleFile( | 286 GenerateSingleFile( |
| 293 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), | 287 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), |
| 294 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) | 288 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) |
| 295 GenerateSingleFile( | |
| 296 os.path.join(dartium_output_dir, '_blink_dartium.dart'), | |
| 297 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium')) | |
| 298 | 289 |
| 299 print '\nGenerating single file %s seconds' % round(time.time() - file_generat
ion_start_time, 2) | 290 print '\nGenerating single file %s seconds' % round(time.time() - file_generat
ion_start_time, 2) |
| 300 | 291 |
| 301 end_time = time.time() | 292 end_time = time.time() |
| 302 | 293 |
| 303 print '\nDone (dartdomgenerator) %s seconds' % round(end_time - start_time, 2) | 294 print '\nDone (dartdomgenerator) %s seconds' % round(end_time - start_time, 2) |
| 304 | 295 |
| 305 if __name__ == '__main__': | 296 if __name__ == '__main__': |
| 306 sys.exit(main()) | 297 sys.exit(main()) |
| OLD | NEW |