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