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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 common_database.DeleteInterface('DOMStringMap') | 47 common_database.DeleteInterface('DOMStringMap') |
48 common_database.DeleteInterface('DOMStringList') | 48 common_database.DeleteInterface('DOMStringList') |
49 generator.RenameTypes(common_database, { | 49 generator.RenameTypes(common_database, { |
50 # W3C -> Dart renames | 50 # W3C -> Dart renames |
51 'AbstractView': 'Window', | 51 'AbstractView': 'Window', |
52 'Function': 'EventListener', | 52 'Function': 'EventListener', |
53 'DOMStringMap': 'Map<String, String>', | 53 'DOMStringMap': 'Map<String, String>', |
54 'DOMStringList': 'List<String>', | 54 'DOMStringList': 'List<String>', |
55 }) | 55 }) |
56 generator.FilterMembersWithUnidentifiedTypes(common_database) | 56 generator.FilterMembersWithUnidentifiedTypes(common_database) |
| 57 webkit_database = common_database.Clone() |
| 58 # FIXME: get rid of _original_idl_types map in dartgenerator.py and |
| 59 # call ConvertToDartTypes before cloning. |
57 generator.ConvertToDartTypes(common_database) | 60 generator.ConvertToDartTypes(common_database) |
58 webkit_database = common_database.Clone() | 61 generator.ConvertToDartTypes(webkit_database) |
59 | 62 |
60 generated_output_dir = os.path.join(output_dir, 'generated') | 63 generated_output_dir = os.path.join(output_dir, 'generated') |
61 if os.path.exists(generated_output_dir): | 64 if os.path.exists(generated_output_dir): |
62 _logger.info('Cleaning output directory %s' % generated_output_dir) | 65 _logger.info('Cleaning output directory %s' % generated_output_dir) |
63 shutil.rmtree(generated_output_dir) | 66 shutil.rmtree(generated_output_dir) |
64 | 67 |
65 | 68 |
66 # Generate Dart interfaces for the WebKit DOM. | 69 # Generate Dart interfaces for the WebKit DOM. |
67 webkit_output_dir = generated_output_dir | 70 webkit_output_dir = generated_output_dir |
68 generator.FilterInterfaces(database = webkit_database, | 71 generator.FilterInterfaces(database = webkit_database, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 # Copy dummy DOM where dartc build expects it. | 115 # Copy dummy DOM where dartc build expects it. |
113 if 'dummy' in systems: | 116 if 'dummy' in systems: |
114 # TODO(sra): Make other tools pick this up directly, or do a copy_dart into | 117 # TODO(sra): Make other tools pick this up directly, or do a copy_dart into |
115 # a specific directory. | 118 # a specific directory. |
116 source = os.path.join(output_dir, 'dom_dummy.dart') | 119 source = os.path.join(output_dir, 'dom_dummy.dart') |
117 target = os.path.join(output_dir, 'dom.dart') | 120 target = os.path.join(output_dir, 'dom.dart') |
118 shutil.copyfile(source, target) | 121 shutil.copyfile(source, target) |
119 | 122 |
120 if __name__ == '__main__': | 123 if __name__ == '__main__': |
121 sys.exit(main()) | 124 sys.exit(main()) |
OLD | NEW |