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

Side by Side Diff: lib/html/scripts/dartdomgenerator.py

Issue 11018012: Get rid of System class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 2 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 | « no previous file | lib/html/scripts/dartgenerator.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 multiemitter 12 import multiemitter
13 import optparse 13 import optparse
14 import os 14 import os
15 import shutil 15 import shutil
16 import subprocess 16 import subprocess
17 import sys 17 import sys
18 from generator import TypeRegistry 18 from generator import TypeRegistry
19 from htmlrenamer import HtmlRenamer 19 from htmlrenamer import HtmlRenamer
20 from systembase import GeneratorOptions 20 from systembase import GeneratorOptions
21 from systemhtml import DartLibraryEmitter, HtmlInterfacesSystem,\ 21 from systemhtml import DartLibraryEmitter, Dart2JSBackend,\
22 Dart2JSBackend 22 HtmlDartInterfaceGenerator, HtmlSystemShared
23 from systemnative import CPPLibraryEmitter, DartiumBackend 23 from systemnative import CPPLibraryEmitter, DartiumBackend
24 from templateloader import TemplateLoader 24 from templateloader import TemplateLoader
25 25
26 _logger = logging.getLogger('dartdomgenerator') 26 _logger = logging.getLogger('dartdomgenerator')
27 27
28 _webkit_renames = { 28 _webkit_renames = {
29 # W3C -> WebKit name conversion 29 # W3C -> WebKit name conversion
30 # TODO(vsm): Maybe Store these renames in the IDLs. 30 # TODO(vsm): Maybe Store these renames in the IDLs.
31 'ApplicationCache': 'DOMApplicationCache', 31 'ApplicationCache': 'DOMApplicationCache',
32 'BarProp': 'BarInfo', 32 'BarProp': 'BarInfo',
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 emitters = multiemitter.MultiEmitter() 75 emitters = multiemitter.MultiEmitter()
76 renamer = HtmlRenamer(webkit_database) 76 renamer = HtmlRenamer(webkit_database)
77 type_registry = TypeRegistry(webkit_database, renamer) 77 type_registry = TypeRegistry(webkit_database, renamer)
78 78
79 def RunGenerator(dart_library_template, dart_output_dir, dart_library_path, 79 def RunGenerator(dart_library_template, dart_output_dir, dart_library_path,
80 template_loader, backend_factory): 80 template_loader, backend_factory):
81 options = GeneratorOptions( 81 options = GeneratorOptions(
82 template_loader, webkit_database, type_registry, renamer) 82 template_loader, webkit_database, type_registry, renamer)
83 dart_library_emitter = DartLibraryEmitter( 83 dart_library_emitter = DartLibraryEmitter(
84 emitters, dart_library_template, dart_output_dir) 84 emitters, dart_library_template, dart_output_dir)
85 html_system = HtmlInterfacesSystem( 85 shared_system = HtmlSystemShared(webkit_database)
Anton Muhin 2012/10/01 15:44:44 ping: should it belong here?
podivilov 2012/10/02 15:55:18 kind of :) see http://codereview.chromium.org/1102
Anton Muhin 2012/10/02 15:59:22 I meant it doesn't close on RunGenerator and can p
podivilov 2012/10/02 17:11:55 HtmlEventGenerator depends on template_loader and
Anton Muhin 2012/10/03 06:20:37 Pavel, given that referenced CL is already submitt
86 options, dart_library_emitter, backend_factory) 86
87 def generate_interface(interface):
88 backend = backend_factory(interface)
89 interface_generator = HtmlDartInterfaceGenerator(
90 shared_system, options, dart_library_emitter, interface, backend)
91 interface_generator.Generate()
92
87 generator.Generate( 93 generator.Generate(
88 webkit_database, html_system, common_database, _webkit_renames) 94 webkit_database, common_database, _webkit_renames, generate_interface)
89 dart_library_emitter.EmitLibrary(dart_library_path, auxiliary_dir) 95 dart_library_emitter.EmitLibrary(dart_library_path, auxiliary_dir)
90 96
91 if dart2js_output_dir: 97 if dart2js_output_dir:
92 template_paths = ['html/dart2js', 'html/impl', 'html/interface', ''] 98 template_paths = ['html/dart2js', 'html/impl', 'html/interface', '']
93 template_loader = TemplateLoader(template_dir, 99 template_loader = TemplateLoader(template_dir,
94 template_paths, 100 template_paths,
95 {'DARTIUM': False, 'DART2JS': True}) 101 {'DARTIUM': False, 'DART2JS': True})
96 backend_options = GeneratorOptions( 102 backend_options = GeneratorOptions(
97 template_loader, webkit_database, type_registry, renamer) 103 template_loader, webkit_database, type_registry, renamer)
98 backend_factory = lambda interface:\ 104 backend_factory = lambda interface:\
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 _logger.info('Copy html_dart2js to dart2js/') 192 _logger.info('Copy html_dart2js to dart2js/')
187 GenerateSingleFile(os.path.join(dart2js_output_dir, 'html_dart2js.dart'), 193 GenerateSingleFile(os.path.join(dart2js_output_dir, 'html_dart2js.dart'),
188 '../dart2js') 194 '../dart2js')
189 if 'htmldartium' in systems: 195 if 'htmldartium' in systems:
190 _logger.info('Copy html_dartium to dartium/') 196 _logger.info('Copy html_dartium to dartium/')
191 GenerateSingleFile(os.path.join(dartium_output_dir, 'html_dartium.dart'), 197 GenerateSingleFile(os.path.join(dartium_output_dir, 'html_dartium.dart'),
192 '../dartium') 198 '../dartium')
193 199
194 if __name__ == '__main__': 200 if __name__ == '__main__':
195 sys.exit(main()) 201 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | lib/html/scripts/dartgenerator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698