| 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 fremontcutbuilder | 10 import fremontcutbuilder |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 library_dir = os.path.dirname(library_path) | 149 library_dir = os.path.dirname(library_path) |
| 150 library_filename = os.path.basename(library_path) | 150 library_filename = os.path.basename(library_path) |
| 151 copy_dart_script = os.path.relpath('../../../tools/copy_dart.py', library_dir) | 151 copy_dart_script = os.path.relpath('../../../tools/copy_dart.py', library_dir) |
| 152 output_dir = os.path.relpath(output_dir, library_dir) | 152 output_dir = os.path.relpath(output_dir, library_dir) |
| 153 command = ' '.join(['cd', library_dir, ';', | 153 command = ' '.join(['cd', library_dir, ';', |
| 154 copy_dart_script, output_dir, library_filename]) | 154 copy_dart_script, output_dir, library_filename]) |
| 155 subprocess.call([command], shell=True) | 155 subprocess.call([command], shell=True) |
| 156 | 156 |
| 157 def main(): | 157 def main(): |
| 158 parser = optparse.OptionParser() | 158 parser = optparse.OptionParser() |
| 159 parser.add_option('--parallel', dest='parallel', |
| 160 action='store_true', default=False, |
| 161 help='Use fremontcut in parallel mode.') |
| 159 parser.add_option('--rebuild', dest='rebuild', | 162 parser.add_option('--rebuild', dest='rebuild', |
| 160 action='store_true', default=False, | 163 action='store_true', default=False, |
| 161 help='Rebuild the database from IDL using fremontcut.') | 164 help='Rebuild the database from IDL using fremontcut.') |
| 162 parser.add_option('--systems', dest='systems', | 165 parser.add_option('--systems', dest='systems', |
| 163 action='store', type='string', | 166 action='store', type='string', |
| 164 default='htmldart2js,htmldartium', | 167 default='htmldart2js,htmldartium', |
| 165 help='Systems to generate (htmldart2js, htmldartium)') | 168 help='Systems to generate (htmldart2js, htmldartium)') |
| 166 parser.add_option('--output-dir', dest='output_dir', | 169 parser.add_option('--output-dir', dest='output_dir', |
| 167 action='store', type='string', | 170 action='store', type='string', |
| 168 default=None, | 171 default=None, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 182 output_dir = options.output_dir or os.path.join(current_dir, '../generated') | 185 output_dir = options.output_dir or os.path.join(current_dir, '../generated') |
| 183 dart2js_output_dir = None | 186 dart2js_output_dir = None |
| 184 if 'htmldart2js' in systems: | 187 if 'htmldart2js' in systems: |
| 185 dart2js_output_dir = os.path.join(output_dir, 'dart2js') | 188 dart2js_output_dir = os.path.join(output_dir, 'dart2js') |
| 186 dartium_output_dir = None | 189 dartium_output_dir = None |
| 187 if 'htmldartium' in systems: | 190 if 'htmldartium' in systems: |
| 188 dartium_output_dir = os.path.join(output_dir, 'dartium') | 191 dartium_output_dir = os.path.join(output_dir, 'dartium') |
| 189 | 192 |
| 190 if options.rebuild: | 193 if options.rebuild: |
| 191 # Parse the IDL and create the database. | 194 # Parse the IDL and create the database. |
| 192 database = fremontcutbuilder.main() | 195 database = fremontcutbuilder.main(options.parallel) |
| 193 else: | 196 else: |
| 194 # Load the previously generated database. | 197 # Load the previously generated database. |
| 195 database = LoadDatabase(database_dir, options.use_database_cache) | 198 database = LoadDatabase(database_dir, options.use_database_cache) |
| 196 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir) | 199 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir) |
| 197 | 200 |
| 198 if 'htmldart2js' in systems: | 201 if 'htmldart2js' in systems: |
| 199 _logger.info('Copy html_dart2js to dart2js/') | 202 _logger.info('Copy html_dart2js to dart2js/') |
| 200 GenerateSingleFile(os.path.join(dart2js_output_dir, 'html_dart2js.dart'), | 203 GenerateSingleFile(os.path.join(dart2js_output_dir, 'html_dart2js.dart'), |
| 201 '../dart2js') | 204 '../dart2js') |
| 202 if 'htmldartium' in systems: | 205 if 'htmldartium' in systems: |
| 203 _logger.info('Copy html_dartium to dartium/') | 206 _logger.info('Copy html_dartium to dartium/') |
| 204 GenerateSingleFile(os.path.join(dartium_output_dir, 'html_dartium.dart'), | 207 GenerateSingleFile(os.path.join(dartium_output_dir, 'html_dartium.dart'), |
| 205 '../dartium') | 208 '../dartium') |
| 206 | 209 |
| 207 if __name__ == '__main__': | 210 if __name__ == '__main__': |
| 208 sys.exit(main()) | 211 sys.exit(main()) |
| OLD | NEW |