| 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 |
| 11 import logging | 11 import logging |
| 12 import monitored | 12 import monitored |
| 13 import multiemitter | 13 import multiemitter |
| 14 import optparse | 14 import optparse |
| 15 import os | 15 import os |
| 16 import shutil | 16 import shutil |
| 17 import subprocess | 17 import subprocess |
| 18 import sys | 18 import sys |
| 19 from dartmetadata import DartMetadata | 19 from dartmetadata import DartMetadata |
| 20 from generator import TypeRegistry | 20 from generator import TypeRegistry |
| 21 from htmleventgenerator import HtmlEventGenerator | 21 from htmleventgenerator import HtmlEventGenerator |
| 22 from htmlrenamer import HtmlRenamer | 22 from htmlrenamer import HtmlRenamer |
| 23 from systemhtml import DartLibraryEmitter, Dart2JSBackend,\ | 23 from systemhtml import DartLibraryEmitter, Dart2JSBackend,\ |
| 24 HtmlDartInterfaceGenerator, DartLibrary, DartLibraries,\ | 24 HtmlDartInterfaceGenerator, DartLibrary, DartLibraries,\ |
| 25 HTML_LIBRARY_NAMES | 25 HTML_LIBRARY_NAMES |
| 26 from systemnative import CPPLibraryEmitter, DartiumBackend | 26 from systemnative import CPPLibraryEmitter, DartiumBackend, \ |
| 27 GetNativeLibraryEmitter, dart_use_blink |
| 27 from templateloader import TemplateLoader | 28 from templateloader import TemplateLoader |
| 28 | 29 |
| 29 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) | 30 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) |
| 30 import utils | 31 import utils |
| 31 | 32 |
| 32 _logger = logging.getLogger('dartdomgenerator') | 33 _logger = logging.getLogger('dartdomgenerator') |
| 33 | 34 |
| 34 class GeneratorOptions(object): | 35 class GeneratorOptions(object): |
| 35 def __init__(self, templates, database, type_registry, renamer, | 36 def __init__(self, templates, database, type_registry, renamer, |
| 36 metadata): | 37 metadata): |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 dart_libraries = DartLibraries( | 111 dart_libraries = DartLibraries( |
| 111 HTML_LIBRARY_NAMES, template_loader, 'dart2js', dart2js_output_dir) | 112 HTML_LIBRARY_NAMES, template_loader, 'dart2js', dart2js_output_dir) |
| 112 | 113 |
| 113 RunGenerator(dart_libraries, dart_output_dir, | 114 RunGenerator(dart_libraries, dart_output_dir, |
| 114 template_loader, backend_factory) | 115 template_loader, backend_factory) |
| 115 | 116 |
| 116 if dartium_output_dir: | 117 if dartium_output_dir: |
| 117 template_paths = ['html/dartium', 'html/impl', 'html/interface', ''] | 118 template_paths = ['html/dartium', 'html/impl', 'html/interface', ''] |
| 118 template_loader = TemplateLoader(template_dir, | 119 template_loader = TemplateLoader(template_dir, |
| 119 template_paths, | 120 template_paths, |
| 120 {'DARTIUM': True, 'DART2JS': False}) | 121 {'DARTIUM': True, 'DART2JS': False, |
| 122 'DART_USE_BLINK' : dart_use_blink}) |
| 121 backend_options = GeneratorOptions( | 123 backend_options = GeneratorOptions( |
| 122 template_loader, webkit_database, type_registry, renamer, | 124 template_loader, webkit_database, type_registry, renamer, |
| 123 metadata) | 125 metadata) |
| 124 cpp_output_dir = os.path.join(dartium_output_dir, 'cpp') | 126 cpp_output_dir = os.path.join(dartium_output_dir, 'cpp') |
| 125 cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir) | 127 cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir) |
| 128 dart_output_dir = os.path.join(dartium_output_dir, 'dart') |
| 129 native_library_emitter = \ |
| 130 GetNativeLibraryEmitter(emitters, template_loader, |
| 131 dartium_output_dir, dart_output_dir, |
| 132 auxiliary_dir) |
| 126 backend_factory = lambda interface:\ | 133 backend_factory = lambda interface:\ |
| 127 DartiumBackend(interface, cpp_library_emitter, backend_options) | 134 DartiumBackend(interface, native_library_emitter, |
| 128 | 135 cpp_library_emitter, backend_options) |
| 129 dart_output_dir = os.path.join(dartium_output_dir, 'dart') | |
| 130 dart_libraries = DartLibraries( | 136 dart_libraries = DartLibraries( |
| 131 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir) | 137 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir) |
| 132 | |
| 133 RunGenerator(dart_libraries, dart_output_dir, | 138 RunGenerator(dart_libraries, dart_output_dir, |
| 134 template_loader, backend_factory) | 139 template_loader, backend_factory) |
| 135 cpp_library_emitter.EmitDerivedSources( | 140 cpp_library_emitter.EmitDerivedSources( |
| 136 template_loader.Load('cpp_derived_sources.template'), | 141 template_loader.Load('cpp_derived_sources.template'), |
| 137 dartium_output_dir) | 142 dartium_output_dir) |
| 138 cpp_library_emitter.EmitResolver( | 143 cpp_library_emitter.EmitResolver( |
| 139 template_loader.Load('cpp_resolver.template'), dartium_output_dir) | 144 template_loader.Load('cpp_resolver.template'), dartium_output_dir) |
| 140 cpp_library_emitter.EmitClassIdTable( | 145 cpp_library_emitter.EmitClassIdTable( |
| 141 webkit_database, dartium_output_dir, type_registry, renamer) | 146 webkit_database, dartium_output_dir, type_registry, renamer) |
| 142 emitters.Flush() | 147 emitters.Flush() |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) | 221 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) |
| 217 if 'htmldartium' in systems: | 222 if 'htmldartium' in systems: |
| 218 _logger.info('Generating dartium single files.') | 223 _logger.info('Generating dartium single files.') |
| 219 for library_name in HTML_LIBRARY_NAMES: | 224 for library_name in HTML_LIBRARY_NAMES: |
| 220 GenerateSingleFile( | 225 GenerateSingleFile( |
| 221 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), | 226 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), |
| 222 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) | 227 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) |
| 223 | 228 |
| 224 if __name__ == '__main__': | 229 if __name__ == '__main__': |
| 225 sys.exit(main()) | 230 sys.exit(main()) |
| OLD | NEW |