| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 # TODO(jacobr): we almost want to add this commented out line back. | 65 # TODO(jacobr): we almost want to add this commented out line back. |
| 66 # html_renames['HTMLCollection'] = 'ElementList' | 66 # html_renames['HTMLCollection'] = 'ElementList' |
| 67 # html_renames['NodeList'] = 'ElementList' | 67 # html_renames['NodeList'] = 'ElementList' |
| 68 # html_renames['HTMLOptionsCollection'] = 'ElementList' | 68 # html_renames['HTMLOptionsCollection'] = 'ElementList' |
| 69 html_renames['DOMWindow'] = 'Window' | 69 html_renames['DOMWindow'] = 'Window' |
| 70 | 70 |
| 71 return html_renames | 71 return html_renames |
| 72 | 72 |
| 73 def GenerateDOM(systems, generate_html_systems, output_dir, | 73 def GenerateDOM(systems, generate_html_systems, output_dir, |
| 74 database_dir, use_database_cache): | 74 database_dir, use_database_cache, create_single_file): |
| 75 current_dir = os.path.dirname(__file__) | 75 current_dir = os.path.dirname(__file__) |
| 76 | 76 |
| 77 generator = dartgenerator.DartGenerator( | 77 generator = dartgenerator.DartGenerator( |
| 78 auxiliary_dir=os.path.join(current_dir, '..', 'src'), | 78 auxiliary_dir=os.path.join(current_dir, '..', 'src'), |
| 79 template_dir=os.path.join(current_dir, '..', 'templates'), | 79 template_dir=os.path.join(current_dir, '..', 'templates'), |
| 80 base_package='') | 80 base_package='') |
| 81 generator.LoadAuxiliary() | 81 generator.LoadAuxiliary() |
| 82 | 82 |
| 83 common_database = database.Database(database_dir) | 83 common_database = database.Database(database_dir) |
| 84 if use_database_cache: | 84 if use_database_cache: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 111 module_source_preference = ['WebKit', 'Dart'], | 111 module_source_preference = ['WebKit', 'Dart'], |
| 112 source_filter = ['WebKit', 'Dart'], | 112 source_filter = ['WebKit', 'Dart'], |
| 113 super_database = common_database, | 113 super_database = common_database, |
| 114 common_prefix = 'common', | 114 common_prefix = 'common', |
| 115 super_map = webkit_renames_inverse, | 115 super_map = webkit_renames_inverse, |
| 116 html_map = html_renames_inverse, | 116 html_map = html_renames_inverse, |
| 117 systems = systems) | 117 systems = systems) |
| 118 | 118 |
| 119 generator.Flush() | 119 generator.Flush() |
| 120 | 120 |
| 121 if 'frog' in systems: | 121 if create_single_file: |
| 122 _logger.info('Copy dom_frog to frog/') | 122 if 'frog' in systems: |
| 123 subprocess.call(['cd ../generated ; ' | 123 _logger.info('Copy dom_frog to frog/') |
| 124 '../../../tools/copy_dart.py ../frog dom_frog.dart'], | 124 subprocess.call(['cd ../generated ; ' |
| 125 shell=True); | 125 '../../../tools/copy_dart.py ../frog dom_frog.dart'], |
| 126 shell=True); |
| 126 | 127 |
| 127 if 'htmlfrog' in systems: | 128 if 'htmlfrog' in systems: |
| 128 _logger.info('Copy html_frog to ../html/frog/') | 129 _logger.info('Copy html_frog to ../html/frog/') |
| 129 subprocess.call(['cd ../../html/generated ; ' | 130 subprocess.call(['cd ../../html/generated ; ' |
| 130 '../../../tools/copy_dart.py ../frog html_frog.dart'], | 131 '../../../tools/copy_dart.py ../frog html_frog.dart'], |
| 131 shell=True); | 132 shell=True); |
| 132 | 133 |
| 133 if 'htmldartium' in systems: | 134 if 'htmldartium' in systems: |
| 134 _logger.info('Copy html_dartium to ../html/dartium/') | 135 _logger.info('Copy html_dartium to ../html/dartium/') |
| 135 subprocess.call(['cd ../../html/generated ; ' | 136 subprocess.call(['cd ../../html/generated ; ' |
| 136 '../../../tools/copy_dart.py ../dartium html_dartium.dart']
, | 137 '../../../tools/copy_dart.py ../dartium html_dartium.dart
'], |
| 137 shell=True); | 138 shell=True); |
| 138 | 139 |
| 139 # Copy dummy DOM where dartc build expects it. | 140 # Copy dummy DOM where dartc build expects it. |
| 140 if 'dummy' in systems: | 141 if 'dummy' in systems: |
| 141 _logger.info('Copy dom_dummy to dom.dart') | 142 _logger.info('Copy dom_dummy to dom.dart') |
| 142 subprocess.call(['cd ../generated ; ' | 143 subprocess.call(['cd ../generated ; ' |
| 143 '../../../tools/copy_dart.py dummy dom_dummy.dart ;' | 144 '../../../tools/copy_dart.py dummy dom_dummy.dart ;' |
| 144 'cp dummy/dom_dummy.dart ../dom.dart'], | 145 'cp dummy/dom_dummy.dart ../dom.dart'], |
| 145 shell=True); | 146 shell=True); |
| 146 | 147 |
| 147 def main(): | 148 def main(): |
| 148 parser = optparse.OptionParser() | 149 parser = optparse.OptionParser() |
| 149 parser.add_option('--systems', dest='systems', | 150 parser.add_option('--systems', dest='systems', |
| 150 action='store', type='string', | 151 action='store', type='string', |
| 151 default='frog,dummy,wrapping,htmlfrog,htmldartium', | 152 default='frog,dummy,wrapping,htmlfrog,htmldartium', |
| 152 help='Systems to generate (frog, native, dummy, ' | 153 help='Systems to generate (frog, native, dummy, ' |
| 153 'htmlfrog, htmldartium)') | 154 'htmlfrog, htmldartium)') |
| 154 parser.add_option('--output-dir', dest='output_dir', | 155 parser.add_option('--output-dir', dest='output_dir', |
| 155 action='store', type='string', | 156 action='store', type='string', |
| (...skipping 13 matching lines...) Expand all Loading... |
| 169 dom_systems = [s for s in systems if s not in html_system_names] | 170 dom_systems = [s for s in systems if s not in html_system_names] |
| 170 | 171 |
| 171 database_dir = os.path.join(current_dir, '..', 'database') | 172 database_dir = os.path.join(current_dir, '..', 'database') |
| 172 use_database_cache = options.use_database_cache | 173 use_database_cache = options.use_database_cache |
| 173 logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) | 174 logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) |
| 174 | 175 |
| 175 if dom_systems: | 176 if dom_systems: |
| 176 output_dir = options.output_dir or os.path.join(current_dir, | 177 output_dir = options.output_dir or os.path.join(current_dir, |
| 177 '../generated') | 178 '../generated') |
| 178 GenerateDOM(dom_systems, False, output_dir, | 179 GenerateDOM(dom_systems, False, output_dir, |
| 179 database_dir, use_database_cache) | 180 database_dir, use_database_cache, True) |
| 180 | 181 |
| 181 if html_systems: | 182 if html_systems: |
| 182 output_dir = options.output_dir or os.path.join(current_dir, | 183 output_dir = options.output_dir or os.path.join(current_dir, |
| 183 '../../html/generated') | 184 '../../html/generated') |
| 184 GenerateDOM(html_systems, True, output_dir, | 185 GenerateDOM(html_systems, True, output_dir, |
| 185 database_dir, use_database_cache or dom_systems) | 186 database_dir, use_database_cache or dom_systems, True) |
| 186 | 187 |
| 187 if __name__ == '__main__': | 188 if __name__ == '__main__': |
| 188 sys.exit(main()) | 189 sys.exit(main()) |
| OLD | NEW |