Chromium Code Reviews| 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 logging.config | 10 import logging.config |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 implementation_system = FrogSystem( | 132 implementation_system = FrogSystem( |
| 133 TemplateLoader(template_dir, ['dom/frog', 'dom', '']), | 133 TemplateLoader(template_dir, ['dom/frog', 'dom', '']), |
| 134 target_database, emitters, output_dir) | 134 target_database, emitters, output_dir) |
| 135 elif system == 'htmlfrog': | 135 elif system == 'htmlfrog': |
| 136 implementation_system = HtmlFrogSystem( | 136 implementation_system = HtmlFrogSystem( |
| 137 TemplateLoader(template_dir, | 137 TemplateLoader(template_dir, |
| 138 ['html/frog', 'html/impl', 'html', ''], | 138 ['html/frog', 'html/impl', 'html', ''], |
| 139 {'DARTIUM': False, 'FROG': True}), | 139 {'DARTIUM': False, 'FROG': True}), |
| 140 target_database, emitters, output_dir) | 140 target_database, emitters, output_dir) |
| 141 elif system == 'htmldartium': | 141 elif system == 'htmldartium': |
| 142 # Generate native wrappers. | |
| 143 native_system = NativeImplementationSystem( | |
| 144 TemplateLoader(template_dir, ['dom/native', 'dom', '']), | |
| 145 dom_database, html_renames, emitters, auxiliary_dir, | |
| 146 output_dir) | |
| 147 generator.Generate(dom_database, native_system, | |
| 148 source_filter=['WebKit', 'Dart'], | |
| 149 super_database=common_database, | |
| 150 common_prefix='common', | |
| 151 webkit_renames=_webkit_renames, | |
| 152 html_renames=html_renames) | |
| 153 dom_implementation_classes = native_system.DartImplementationFiles() | |
| 142 implementation_system = HtmlDartiumSystem( | 154 implementation_system = HtmlDartiumSystem( |
| 143 TemplateLoader(template_dir, | 155 TemplateLoader(template_dir, |
| 144 ['html/dartium', 'html/impl', 'html', ''], | 156 ['html/dartium', 'html/impl', 'html', ''], |
| 145 {'DARTIUM': True, 'FROG': False}), | 157 {'DARTIUM': True, 'FROG': False}), |
| 146 target_database, emitters, auxiliary_dir, | 158 target_database, emitters, auxiliary_dir, dom_implementation_classes, |
| 147 output_dir) | 159 output_dir) |
| 148 elif system == 'native': | 160 elif system == 'native': |
|
Anton Muhin
2012/05/23 14:03:31
do we need to support it now?
podivilov
2012/05/23 14:52:40
Let me do the cleanup in a separate change. This o
Anton Muhin
2012/05/23 15:25:23
I'd rather see this CL split into several parts li
podivilov
2012/05/24 10:33:07
Done.
| |
| 149 implementation_system = NativeImplementationSystem( | 161 implementation_system = NativeImplementationSystem( |
| 150 TemplateLoader(template_dir, ['dom/native', 'dom', '']), | 162 TemplateLoader(template_dir, ['dom/native', 'dom', '']), |
| 151 target_database, html_renames, emitters, auxiliary_dir, | 163 target_database, html_renames, emitters, auxiliary_dir, |
| 152 output_dir) | 164 output_dir) |
| 153 else: | 165 else: |
| 154 raise Exception('Unsupported system %s' % system) | 166 raise Exception('Unsupported system %s' % system) |
| 155 | 167 |
| 156 # Makes interface files available for listing in the library for the | 168 # Makes interface files available for listing in the library for the |
| 157 # implementation system. | 169 # implementation system. |
| 158 implementation_system._interface_system = interface_system | 170 implementation_system._interface_system = interface_system |
| 159 | 171 |
| 160 for system in [interface_system, implementation_system]: | 172 for system in [interface_system, implementation_system]: |
| 161 generator.Generate(target_database, system, | 173 generator.Generate(target_database, system, |
| 162 source_filter=['WebKit', 'Dart'], | 174 source_filter=['WebKit', 'Dart'], |
| 163 super_database=common_database, | 175 super_database=common_database, |
| 164 common_prefix='common', | 176 common_prefix='common', |
| 165 webkit_renames=_webkit_renames, | 177 webkit_renames=_webkit_renames, |
| 166 html_renames=html_renames) | 178 html_renames=html_renames) |
| 167 | 179 |
| 168 _logger.info('Flush...') | 180 _logger.info('Flush...') |
| 169 emitters.Flush() | 181 emitters.Flush() |
| 170 | 182 |
| 183 def GenerateSingleFile(systems): | |
| 171 if 'frog' in systems: | 184 if 'frog' in systems: |
| 172 _logger.info('Copy dom_frog to frog/') | 185 _logger.info('Copy dom_frog to frog/') |
| 173 subprocess.call(['cd ../generated ; ' | 186 subprocess.call(['cd ../generated ; ' |
| 174 '../../../tools/copy_dart.py ../frog dom_frog.dart'], | 187 '../../../tools/copy_dart.py ../frog dom_frog.dart'], |
| 175 shell=True); | 188 shell=True); |
| 176 | 189 |
| 177 if 'htmlfrog' in systems: | 190 if 'htmlfrog' in systems: |
| 178 _logger.info('Copy html_frog to ../html/frog/') | 191 _logger.info('Copy html_frog to ../html/frog/') |
| 179 subprocess.call(['cd ../../html/generated ; ' | 192 subprocess.call(['cd ../../html/generated ; ' |
| 180 '../../../tools/copy_dart.py ../frog html_frog.dart'], | 193 '../../../tools/copy_dart.py ../frog html_frog.dart'], |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 database_dir = os.path.join(current_dir, '..', 'database') | 229 database_dir = os.path.join(current_dir, '..', 'database') |
| 217 logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) | 230 logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) |
| 218 systems = options.systems.split(',') | 231 systems = options.systems.split(',') |
| 219 | 232 |
| 220 dom_output_dir = options.output_dir or os.path.join(current_dir, | 233 dom_output_dir = options.output_dir or os.path.join(current_dir, |
| 221 '../generated') | 234 '../generated') |
| 222 html_output_dir = options.output_dir or os.path.join(current_dir, | 235 html_output_dir = options.output_dir or os.path.join(current_dir, |
| 223 '../../html/generated') | 236 '../../html/generated') |
| 224 Generate(systems, database_dir, options.use_database_cache, | 237 Generate(systems, database_dir, options.use_database_cache, |
| 225 dom_output_dir, html_output_dir) | 238 dom_output_dir, html_output_dir) |
| 239 GenerateSingleFile(systems) | |
| 226 | 240 |
| 227 if __name__ == '__main__': | 241 if __name__ == '__main__': |
| 228 sys.exit(main()) | 242 sys.exit(main()) |
| OLD | NEW |