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

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

Issue 10698108: Stop passing HtmlSystemShared around and move html renaming to IDLTypeInfo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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/dom/scripts/dartgenerator.py » ('j') | lib/dom/scripts/dartgenerator.py » ('J')
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 logging.config 10 import logging.config
11 import multiemitter 11 import multiemitter
12 import optparse 12 import optparse
13 import os 13 import os
14 import shutil 14 import shutil
15 import subprocess 15 import subprocess
16 import sys 16 import sys
17 from systemfrog import FrogSystem 17 from systemfrog import FrogSystem
18 from systemhtml import HtmlInterfacesSystem, HtmlFrogSystem 18 from systemhtml import HtmlInterfacesSystem, HtmlFrogSystem, HtmlSystemShared
19 from systeminterface import InterfacesSystem 19 from systeminterface import InterfacesSystem
20 from systemnative import NativeImplementationSystem 20 from systemnative import NativeImplementationSystem
21 from templateloader import TemplateLoader 21 from templateloader import TemplateLoader
22 22
23 _logger = logging.getLogger('dartdomgenerator') 23 _logger = logging.getLogger('dartdomgenerator')
24 24
25 _webkit_renames = { 25 _webkit_renames = {
26 # W3C -> WebKit name conversion 26 # W3C -> WebKit name conversion
27 # TODO(vsm): Maybe Store these renames in the IDLs. 27 # TODO(vsm): Maybe Store these renames in the IDLs.
28 'ApplicationCache': 'DOMApplicationCache', 28 'ApplicationCache': 'DOMApplicationCache',
(...skipping 24 matching lines...) Expand all
53 webkit_database = common_database.Clone() 53 webkit_database = common_database.Clone()
54 54
55 # Generate Dart interfaces for the WebKit DOM. 55 # Generate Dart interfaces for the WebKit DOM.
56 generator.FilterInterfaces(database = webkit_database, 56 generator.FilterInterfaces(database = webkit_database,
57 or_annotations = ['WebKit', 'Dart'], 57 or_annotations = ['WebKit', 'Dart'],
58 exclude_displaced = ['WebKit'], 58 exclude_displaced = ['WebKit'],
59 exclude_suppressed = ['WebKit', 'Dart']) 59 exclude_suppressed = ['WebKit', 'Dart'])
60 generator.RenameTypes(webkit_database, _webkit_renames, True) 60 generator.RenameTypes(webkit_database, _webkit_renames, True)
61 generator.FixEventTargets(webkit_database) 61 generator.FixEventTargets(webkit_database)
62 62
63 def Generate(system): 63 def Generate(system, interface_renames={}):
64 generator.Generate(webkit_database, system, 64 generator.Generate(webkit_database, system,
65 super_database=common_database, 65 super_database=common_database,
66 webkit_renames=_webkit_renames) 66 webkit_renames=_webkit_renames,
67 interface_renames=interface_renames)
67 68
68 emitters = multiemitter.MultiEmitter() 69 emitters = multiemitter.MultiEmitter()
69 70
70 for system_name in system_names: 71 for system_name in system_names:
71 if system_name in ['htmlfrog', 'htmldartium']: 72 if system_name in ['htmlfrog', 'htmldartium']:
72 output_dir = html_output_dir 73 output_dir = html_output_dir
73 if system_name == 'htmlfrog': 74 if system_name == 'htmlfrog':
74 backend = HtmlFrogSystem( 75 backend = HtmlFrogSystem(
75 TemplateLoader(template_dir, 76 TemplateLoader(template_dir,
76 ['html/frog', 'html/impl', 'html', ''], 77 ['html/frog', 'html/impl', 'html', ''],
77 {'DARTIUM': False, 'FROG': True}), 78 {'DARTIUM': False, 'FROG': True}),
78 webkit_database, emitters, output_dir) 79 webkit_database, emitters, output_dir)
79 else: 80 else:
80 backend = NativeImplementationSystem( 81 backend = NativeImplementationSystem(
81 TemplateLoader(template_dir, ['dom/native', 'html/dartium', 82 TemplateLoader(template_dir, ['dom/native', 'html/dartium',
82 'html/impl', ''], 83 'html/impl', ''],
83 {'DARTIUM': True, 'FROG': False}), 84 {'DARTIUM': True, 'FROG': False}),
84 webkit_database, emitters, output_dir, auxiliary_dir) 85 webkit_database, emitters, output_dir, auxiliary_dir)
85 html_system = HtmlInterfacesSystem( 86 html_system = HtmlInterfacesSystem(
86 TemplateLoader(template_dir, ['html/interface', 'html/impl', 'html', 87 TemplateLoader(template_dir, ['html/interface', 'html/impl', 'html',
87 '']), 88 '']),
88 webkit_database, emitters, output_dir, backend) 89 webkit_database, emitters, output_dir, backend)
89 Generate(html_system) 90 Generate(html_system, HtmlSystemShared(webkit_database).MakeHtmlRenames())
90 else: 91 else:
91 output_dir = dom_output_dir 92 output_dir = dom_output_dir
92 interface_system = InterfacesSystem( 93 interface_system = InterfacesSystem(
93 TemplateLoader(template_dir, ['dom/interface', 'dom', '']), 94 TemplateLoader(template_dir, ['dom/interface', 'dom', '']),
94 webkit_database, emitters, output_dir) 95 webkit_database, emitters, output_dir)
95 if system_name == 'dummy': 96 if system_name == 'dummy':
96 implementation_system = dartgenerator.DummyImplementationSystem( 97 implementation_system = dartgenerator.DummyImplementationSystem(
97 TemplateLoader(template_dir, ['dom/dummy', 'dom', '']), 98 TemplateLoader(template_dir, ['dom/dummy', 'dom', '']),
98 webkit_database, emitters, output_dir) 99 webkit_database, emitters, output_dir)
99 elif system_name == 'frog': 100 elif system_name == 'frog':
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 dom_output_dir = options.output_dir or os.path.join(current_dir, 166 dom_output_dir = options.output_dir or os.path.join(current_dir,
166 '../generated') 167 '../generated')
167 html_output_dir = options.output_dir or os.path.join(current_dir, 168 html_output_dir = options.output_dir or os.path.join(current_dir,
168 '../../html/generated') 169 '../../html/generated')
169 Generate(systems, database_dir, options.use_database_cache, 170 Generate(systems, database_dir, options.use_database_cache,
170 dom_output_dir, html_output_dir) 171 dom_output_dir, html_output_dir)
171 GenerateSingleFile(systems) 172 GenerateSingleFile(systems)
172 173
173 if __name__ == '__main__': 174 if __name__ == '__main__':
174 sys.exit(main()) 175 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | lib/dom/scripts/dartgenerator.py » ('j') | lib/dom/scripts/dartgenerator.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698