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

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

Issue 13493010: Fix the build with WEB_AUDIO disabled. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 7 years, 8 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 | « tools/dom/idl/dart/dart.idl ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »
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
11 import logging.config 11 import logging.config
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 generator import TypeRegistry 19 from generator import TypeRegistry
20 from htmleventgenerator import HtmlEventGenerator 20 from htmleventgenerator import HtmlEventGenerator
21 from htmlrenamer import HtmlRenamer 21 from htmlrenamer import HtmlRenamer
22 from systemhtml import DartLibraryEmitter, Dart2JSBackend,\ 22 from systemhtml import DartLibraryEmitter, Dart2JSBackend,\
23 HtmlDartInterfaceGenerator, DartLibrary, DartLibraries 23 HtmlDartInterfaceGenerator, DartLibrary, DartLibraries,\
24 HTML_LIBRARY_NAMES
24 from systemnative import CPPLibraryEmitter, DartiumBackend 25 from systemnative import CPPLibraryEmitter, DartiumBackend
25 from templateloader import TemplateLoader 26 from templateloader import TemplateLoader
26 27
27 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) 28 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
28 import utils 29 import utils
29 30
30 _logger = logging.getLogger('dartdomgenerator') 31 _logger = logging.getLogger('dartdomgenerator')
31 32
32 _libraries = ['chrome', 'html', 'indexed_db', 'svg', 'web_audio', 'web_gl',
33 'web_sql']
34
35 class GeneratorOptions(object): 33 class GeneratorOptions(object):
36 def __init__(self, templates, database, type_registry, renamer): 34 def __init__(self, templates, database, type_registry, renamer):
37 self.templates = templates 35 self.templates = templates
38 self.database = database 36 self.database = database
39 self.type_registry = type_registry 37 self.type_registry = type_registry
40 self.renamer = renamer 38 self.renamer = renamer
41 39
42 def LoadDatabase(database_dir, use_database_cache): 40 def LoadDatabase(database_dir, use_database_cache):
43 common_database = database.Database(database_dir) 41 common_database = database.Database(database_dir)
44 if use_database_cache: 42 if use_database_cache:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 template_loader = TemplateLoader(template_dir, 93 template_loader = TemplateLoader(template_dir,
96 template_paths, 94 template_paths,
97 {'DARTIUM': False, 'DART2JS': True}) 95 {'DARTIUM': False, 'DART2JS': True})
98 backend_options = GeneratorOptions( 96 backend_options = GeneratorOptions(
99 template_loader, webkit_database, type_registry, renamer) 97 template_loader, webkit_database, type_registry, renamer)
100 backend_factory = lambda interface:\ 98 backend_factory = lambda interface:\
101 Dart2JSBackend(interface, backend_options) 99 Dart2JSBackend(interface, backend_options)
102 100
103 dart_output_dir = os.path.join(dart2js_output_dir, 'dart') 101 dart_output_dir = os.path.join(dart2js_output_dir, 'dart')
104 dart_libraries = DartLibraries( 102 dart_libraries = DartLibraries(
105 _libraries, template_loader, 'dart2js', dart2js_output_dir) 103 HTML_LIBRARY_NAMES, template_loader, 'dart2js', dart2js_output_dir)
106 104
107 RunGenerator(dart_libraries, dart_output_dir, 105 RunGenerator(dart_libraries, dart_output_dir,
108 template_loader, backend_factory) 106 template_loader, backend_factory)
109 107
110 if dartium_output_dir: 108 if dartium_output_dir:
111 template_paths = ['html/dartium', 'html/impl', 'html/interface', ''] 109 template_paths = ['html/dartium', 'html/impl', 'html/interface', '']
112 template_loader = TemplateLoader(template_dir, 110 template_loader = TemplateLoader(template_dir,
113 template_paths, 111 template_paths,
114 {'DARTIUM': True, 'DART2JS': False}) 112 {'DARTIUM': True, 'DART2JS': False})
115 backend_options = GeneratorOptions( 113 backend_options = GeneratorOptions(
116 template_loader, webkit_database, type_registry, renamer) 114 template_loader, webkit_database, type_registry, renamer)
117 cpp_output_dir = os.path.join(dartium_output_dir, 'cpp') 115 cpp_output_dir = os.path.join(dartium_output_dir, 'cpp')
118 cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir) 116 cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir)
119 backend_factory = lambda interface:\ 117 backend_factory = lambda interface:\
120 DartiumBackend(interface, cpp_library_emitter, backend_options) 118 DartiumBackend(interface, cpp_library_emitter, backend_options)
121 119
122 dart_output_dir = os.path.join(dartium_output_dir, 'dart') 120 dart_output_dir = os.path.join(dartium_output_dir, 'dart')
123 dart_libraries = DartLibraries( 121 dart_libraries = DartLibraries(
124 _libraries, template_loader, 'dartium', dartium_output_dir) 122 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir)
125 123
126 RunGenerator(dart_libraries, dart_output_dir, 124 RunGenerator(dart_libraries, dart_output_dir,
127 template_loader, backend_factory) 125 template_loader, backend_factory)
128 cpp_library_emitter.EmitDerivedSources( 126 cpp_library_emitter.EmitDerivedSources(
129 template_loader.Load('cpp_derived_sources.template'), 127 template_loader.Load('cpp_derived_sources.template'),
130 dartium_output_dir) 128 dartium_output_dir)
131 cpp_library_emitter.EmitResolver( 129 cpp_library_emitter.EmitResolver(
132 template_loader.Load('cpp_resolver.template'), dartium_output_dir) 130 template_loader.Load('cpp_resolver.template'), dartium_output_dir)
133 131
134 _logger.info('Flush...') 132 _logger.info('Flush...')
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if options.rebuild: 186 if options.rebuild:
189 # Parse the IDL and create the database. 187 # Parse the IDL and create the database.
190 database = fremontcutbuilder.main(options.parallel) 188 database = fremontcutbuilder.main(options.parallel)
191 else: 189 else:
192 # Load the previously generated database. 190 # Load the previously generated database.
193 database = LoadDatabase(database_dir, options.use_database_cache) 191 database = LoadDatabase(database_dir, options.use_database_cache)
194 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir) 192 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir)
195 193
196 if 'htmldart2js' in systems: 194 if 'htmldart2js' in systems:
197 _logger.info('Generating dart2js single files.') 195 _logger.info('Generating dart2js single files.')
198 for library_name in _libraries: 196 for library_name in HTML_LIBRARY_NAMES:
199 GenerateSingleFile( 197 GenerateSingleFile(
200 os.path.join(dart2js_output_dir, '%s_dart2js.dart' % library_name), 198 os.path.join(dart2js_output_dir, '%s_dart2js.dart' % library_name),
201 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) 199 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js'))
202 if 'htmldartium' in systems: 200 if 'htmldartium' in systems:
203 _logger.info('Generating dartium single files.') 201 _logger.info('Generating dartium single files.')
204 for library_name in _libraries: 202 for library_name in HTML_LIBRARY_NAMES:
205 GenerateSingleFile( 203 GenerateSingleFile(
206 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), 204 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name),
207 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) 205 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium'))
208 206
209 if __name__ == '__main__': 207 if __name__ == '__main__':
210 sys.exit(main()) 208 sys.exit(main())
OLDNEW
« no previous file with comments | « tools/dom/idl/dart/dart.idl ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698