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 13 matching lines...) Expand all Loading... | |
| 24 'BarProp': 'BarInfo', | 24 'BarProp': 'BarInfo', |
| 25 'DedicatedWorkerGlobalScope': 'DedicatedWorkerContext', | 25 'DedicatedWorkerGlobalScope': 'DedicatedWorkerContext', |
| 26 'FormData': 'DOMFormData', | 26 'FormData': 'DOMFormData', |
| 27 'Selection': 'DOMSelection', | 27 'Selection': 'DOMSelection', |
| 28 'SharedWorkerGlobalScope': 'SharedWorkerContext', | 28 'SharedWorkerGlobalScope': 'SharedWorkerContext', |
| 29 'Window': 'DOMWindow', | 29 'Window': 'DOMWindow', |
| 30 'WorkerGlobalScope': 'WorkerContext'} | 30 'WorkerGlobalScope': 'WorkerContext'} |
| 31 | 31 |
| 32 _webkit_renames_inverse = dict((v,k) for k, v in _webkit_renames.iteritems()) | 32 _webkit_renames_inverse = dict((v,k) for k, v in _webkit_renames.iteritems()) |
| 33 | 33 |
| 34 def GenerateDOM(output_dir): | 34 def GenerateDOM(native, output_dir): |
| 35 # TODO(sra): Make this entry point also generate HTML. | 35 # TODO(sra): Make this entry point also generate HTML. |
| 36 current_dir = os.path.dirname(__file__) | 36 current_dir = os.path.dirname(__file__) |
| 37 | 37 |
| 38 generator = dartgenerator.DartGenerator( | 38 generator = dartgenerator.DartGenerator( |
| 39 auxiliary_dir=os.path.join(current_dir, '..', 'src'), | 39 auxiliary_dir=os.path.join(current_dir, '..', 'src'), |
| 40 template_dir=os.path.join(current_dir, '..', 'templates'), | 40 template_dir=os.path.join(current_dir, '..', 'templates'), |
| 41 base_package='') | 41 base_package='') |
| 42 generator.LoadAuxiliary() | 42 generator.LoadAuxiliary() |
| 43 | 43 |
| 44 common_database = database.Database( | 44 common_database = database.Database( |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 72 exclude_suppressed = ['WebKit', 'Dart']) | 72 exclude_suppressed = ['WebKit', 'Dart']) |
| 73 generator.RenameTypes(webkit_database, _webkit_renames) | 73 generator.RenameTypes(webkit_database, _webkit_renames) |
| 74 | 74 |
| 75 generator.Generate(database = webkit_database, | 75 generator.Generate(database = webkit_database, |
| 76 output_dir = webkit_output_dir, | 76 output_dir = webkit_output_dir, |
| 77 lib_dir = output_dir, | 77 lib_dir = output_dir, |
| 78 module_source_preference = ['WebKit', 'Dart'], | 78 module_source_preference = ['WebKit', 'Dart'], |
| 79 source_filter = ['WebKit', 'Dart'], | 79 source_filter = ['WebKit', 'Dart'], |
| 80 super_database = common_database, | 80 super_database = common_database, |
| 81 common_prefix = 'common', | 81 common_prefix = 'common', |
| 82 super_map = _webkit_renames_inverse) | 82 super_map = _webkit_renames_inverse, |
| 83 native = native) | |
| 83 | 84 |
| 84 generator.Flush() | 85 generator.Flush() |
| 85 | 86 |
| 86 # Install default DOM library. | 87 if not native: |
|
antonm
2012/01/26 11:06:14
cannot you move this logic into main of this file
podivilov
2012/01/26 14:18:57
Done.
| |
| 87 default = os.path.join(output_dir, DOM_DEFAULT_LIBRARY) | 88 # Install default DOM library. |
| 88 target = os.path.join(output_dir, DOM_LIBRARY) | 89 default = os.path.join(output_dir, DOM_DEFAULT_LIBRARY) |
| 89 shutil.copyfile(default, target) | 90 target = os.path.join(output_dir, DOM_LIBRARY) |
| 91 shutil.copyfile(default, target) | |
| 90 | 92 |
| 91 def main(): | 93 def main(): |
| 92 current_dir = os.path.dirname(__file__) | 94 current_dir = os.path.dirname(__file__) |
| 93 logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) | 95 logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) |
| 94 GenerateDOM(os.path.join(current_dir, '..')) | 96 GenerateDOM(False, os.path.join(current_dir, '..')) |
| 95 | 97 |
| 96 if __name__ == '__main__': | 98 if __name__ == '__main__': |
| 97 sys.exit(main()) | 99 sys.exit(main()) |
| OLD | NEW |