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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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: |
85 common_database.LoadFromCache() | 85 common_database.LoadFromCache() |
86 else: | 86 else: |
87 common_database.Load() | 87 common_database.Load() |
88 # Remove these types since they are mapped directly to dart. | |
89 common_database.DeleteInterface('DOMStringMap') | |
90 common_database.DeleteInterface('DOMStringList') | |
91 | 88 |
92 generator.RenameTypes(common_database, { | 89 generator.RenameTypes(common_database, { |
93 # W3C -> Dart renames | 90 # W3C -> Dart renames |
94 'AbstractView': 'Window', | 91 'AbstractView': 'Window', |
95 'Function': 'EventListener', | 92 'Function': 'EventListener', |
96 'DOMStringMap': 'Map<String, String>', | |
97 'DOMStringList': 'List<String>', | |
98 }, True) | 93 }, True) |
| 94 |
99 generator.FilterMembersWithUnidentifiedTypes(common_database) | 95 generator.FilterMembersWithUnidentifiedTypes(common_database) |
100 webkit_database = common_database.Clone() | 96 webkit_database = common_database.Clone() |
101 | 97 |
102 # Generate Dart interfaces for the WebKit DOM. | 98 # Generate Dart interfaces for the WebKit DOM. |
103 generator.FilterInterfaces(database = webkit_database, | 99 generator.FilterInterfaces(database = webkit_database, |
104 or_annotations = ['WebKit', 'Dart'], | 100 or_annotations = ['WebKit', 'Dart'], |
105 exclude_displaced = ['WebKit'], | 101 exclude_displaced = ['WebKit'], |
106 exclude_suppressed = ['WebKit', 'Dart']) | 102 exclude_suppressed = ['WebKit', 'Dart']) |
107 generator.RenameTypes(webkit_database, _webkit_renames, True) | 103 generator.RenameTypes(webkit_database, _webkit_renames, True) |
108 | 104 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 database_dir, use_database_cache) | 185 database_dir, use_database_cache) |
190 | 186 |
191 if html_systems: | 187 if html_systems: |
192 output_dir = options.output_dir or os.path.join(current_dir, | 188 output_dir = options.output_dir or os.path.join(current_dir, |
193 '../../html/generated') | 189 '../../html/generated') |
194 GenerateDOM(html_systems, True, output_dir, | 190 GenerateDOM(html_systems, True, output_dir, |
195 database_dir, use_database_cache or dom_systems) | 191 database_dir, use_database_cache or dom_systems) |
196 | 192 |
197 if __name__ == '__main__': | 193 if __name__ == '__main__': |
198 sys.exit(main()) | 194 sys.exit(main()) |
OLD | NEW |