| 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 css_code_generator | 8 import css_code_generator |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 help='Output all informational messages') | 280 help='Output all informational messages') |
| 281 parser.add_option('--examine', dest='examine_idls', | 281 parser.add_option('--examine', dest='examine_idls', |
| 282 action='store_true', default=None, | 282 action='store_true', default=None, |
| 283 help='Analyze IDL files') | 283 help='Analyze IDL files') |
| 284 parser.add_option('--logging', dest='logging', type='int', | 284 parser.add_option('--logging', dest='logging', type='int', |
| 285 action='store', default=logging.NOTSET, | 285 action='store', default=logging.NOTSET, |
| 286 help='Level of logging 20 is Info, 30 is Warnings, 40 is Err
ors') | 286 help='Level of logging 20 is Info, 30 is Warnings, 40 is Err
ors') |
| 287 parser.add_option('--gen-interop', dest='dart_js_interop', | 287 parser.add_option('--gen-interop', dest='dart_js_interop', |
| 288 action='store_true', default=False, | 288 action='store_true', default=False, |
| 289 help='Use Javascript objects (dart:js) accessing the DOM in
_blink') | 289 help='Use Javascript objects (dart:js) accessing the DOM in
_blink') |
| 290 parser.add_option('--no-cached-patches', dest='no_cached_patches', |
| 291 action='store_true', default=False, |
| 292 help='Do not generate the sdk/lib/js/cached_patches.dart fil
e') |
| 290 | 293 |
| 291 (options, args) = parser.parse_args() | 294 (options, args) = parser.parse_args() |
| 292 | 295 |
| 293 current_dir = os.path.dirname(__file__) | 296 current_dir = os.path.dirname(__file__) |
| 294 database_dir = os.path.join(current_dir, '..', 'database') | 297 database_dir = os.path.join(current_dir, '..', 'database') |
| 295 logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) | 298 logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) |
| 296 systems = options.systems.split(',') | 299 systems = options.systems.split(',') |
| 297 | 300 |
| 298 output_dir = options.output_dir or os.path.join( | 301 output_dir = options.output_dir or os.path.join( |
| 299 current_dir, '..', '..', utils.GetBuildDir(utils.GuessOS()), | 302 current_dir, '..', '..', utils.GetBuildDir(utils.GuessOS()), |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 342 |
| 340 if 'htmldartium' in systems: | 343 if 'htmldartium' in systems: |
| 341 _logger.info('Generating dartium single files.') | 344 _logger.info('Generating dartium single files.') |
| 342 file_generation_start_time = time.time() | 345 file_generation_start_time = time.time() |
| 343 | 346 |
| 344 for library_name in HTML_LIBRARY_NAMES: | 347 for library_name in HTML_LIBRARY_NAMES: |
| 345 GenerateSingleFile( | 348 GenerateSingleFile( |
| 346 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), | 349 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), |
| 347 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) | 350 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) |
| 348 | 351 |
| 349 # Blow away the cached_patches.dart needs to be re-generated for Dartium | 352 if (not(options.no_cached_patches)): |
| 350 # see tools/dartium/generate_patches.sh | 353 # Blow away the cached_patches.dart needs to be re-generated for Dartium |
| 351 cached_patches_filename = os.path.join('..', '..', '..', 'sdk', 'lib', 'js',
'dartium', | 354 # see tools/dartium/generate_patches.sh |
| 352 'cached_patches.dart') | 355 cached_patches_filename = os.path.join('..', '..', '..', 'sdk', 'lib', 'js
', 'dartium', |
| 353 cached_patches = open(cached_patches_filename, 'w') | 356 'cached_patches.dart') |
| 354 cached_patches.write(CACHED_PATCHES); | 357 cached_patches = open(cached_patches_filename, 'w') |
| 355 cached_patches.close() | 358 cached_patches.write(CACHED_PATCHES); |
| 359 cached_patches.close() |
| 356 | 360 |
| 357 if '_blink' in systems: | 361 if '_blink' in systems: |
| 358 _logger.info('Generating dartium _blink file.') | 362 _logger.info('Generating dartium _blink file.') |
| 359 file_generation_start_time = time.time() | 363 file_generation_start_time = time.time() |
| 360 | 364 |
| 361 GenerateSingleFile( | 365 GenerateSingleFile( |
| 362 os.path.join(dartium_output_dir, '%s_dartium.dart' % '_blink'), | 366 os.path.join(dartium_output_dir, '%s_dartium.dart' % '_blink'), |
| 363 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium')) | 367 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium')) |
| 364 | 368 |
| 365 print '\nGenerating single file %s seconds' % round(time.time() - file_generat
ion_start_time, 2) | 369 print '\nGenerating single file %s seconds' % round(time.time() - file_generat
ion_start_time, 2) |
| 366 | 370 |
| 367 end_time = time.time() | 371 end_time = time.time() |
| 368 | 372 |
| 369 print '\nDone (dartdomgenerator) %s seconds' % round(end_time - start_time, 2) | 373 print '\nDone (dartdomgenerator) %s seconds' % round(end_time - start_time, 2) |
| 370 | 374 |
| 371 if __name__ == '__main__': | 375 if __name__ == '__main__': |
| 372 sys.exit(main()) | 376 sys.exit(main()) |
| OLD | NEW |