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 | |
9 import dartgenerator | 8 import dartgenerator |
10 import database | 9 import database |
11 import fremontcutbuilder | 10 import fremontcutbuilder |
12 import logging | 11 import logging |
13 import monitored | 12 import monitored |
14 import multiemitter | 13 import multiemitter |
15 import optparse | 14 import optparse |
16 import os | 15 import os |
17 import shutil | 16 import shutil |
18 import subprocess | 17 import subprocess |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 def GenerateSingleFile(library_path, output_dir, generated_output_dir=None): | 156 def GenerateSingleFile(library_path, output_dir, generated_output_dir=None): |
158 library_dir = os.path.dirname(library_path) | 157 library_dir = os.path.dirname(library_path) |
159 library_filename = os.path.basename(library_path) | 158 library_filename = os.path.basename(library_path) |
160 copy_dart_script = os.path.relpath('../../copy_dart.py', | 159 copy_dart_script = os.path.relpath('../../copy_dart.py', |
161 library_dir) | 160 library_dir) |
162 output_dir = os.path.relpath(output_dir, library_dir) | 161 output_dir = os.path.relpath(output_dir, library_dir) |
163 command = ' '.join(['cd', library_dir, ';', | 162 command = ' '.join(['cd', library_dir, ';', |
164 copy_dart_script, output_dir, library_filename]) | 163 copy_dart_script, output_dir, library_filename]) |
165 subprocess.call([command], shell=True) | 164 subprocess.call([command], shell=True) |
166 | 165 |
167 def UpdateCssProperties(): | |
168 """Regenerate the CssStyleDeclaration template file with the current CSS | |
169 properties.""" | |
170 _logger.info('Updating Css Properties.') | |
171 css_code_generator.GenerateCssTemplateFile() | |
172 | |
173 def main(): | 166 def main(): |
174 parser = optparse.OptionParser() | 167 parser = optparse.OptionParser() |
175 parser.add_option('--parallel', dest='parallel', | 168 parser.add_option('--parallel', dest='parallel', |
176 action='store_true', default=False, | 169 action='store_true', default=False, |
177 help='Use fremontcut in parallel mode.') | 170 help='Use fremontcut in parallel mode.') |
178 parser.add_option('--rebuild', dest='rebuild', | 171 parser.add_option('--rebuild', dest='rebuild', |
179 action='store_true', default=False, | 172 action='store_true', default=False, |
180 help='Rebuild the database from IDL using fremontcut.') | 173 help='Rebuild the database from IDL using fremontcut.') |
181 parser.add_option('--systems', dest='systems', | 174 parser.add_option('--systems', dest='systems', |
182 action='store', type='string', | 175 action='store', type='string', |
(...skipping 27 matching lines...) Expand all Loading... |
210 current_dir, '..', '..', utils.GetBuildDir(utils.GuessOS()), | 203 current_dir, '..', '..', utils.GetBuildDir(utils.GuessOS()), |
211 'generated') | 204 'generated') |
212 | 205 |
213 dart2js_output_dir = None | 206 dart2js_output_dir = None |
214 if 'htmldart2js' in systems: | 207 if 'htmldart2js' in systems: |
215 dart2js_output_dir = os.path.join(output_dir, 'dart2js') | 208 dart2js_output_dir = os.path.join(output_dir, 'dart2js') |
216 dartium_output_dir = None | 209 dartium_output_dir = None |
217 if 'htmldartium' in systems: | 210 if 'htmldartium' in systems: |
218 dartium_output_dir = os.path.join(output_dir, 'dartium') | 211 dartium_output_dir = os.path.join(output_dir, 'dartium') |
219 | 212 |
220 UpdateCssProperties() | |
221 if options.rebuild: | 213 if options.rebuild: |
222 # Parse the IDL and create the database. | 214 # Parse the IDL and create the database. |
223 database = fremontcutbuilder.main(options.parallel) | 215 database = fremontcutbuilder.main(options.parallel) |
224 else: | 216 else: |
225 # Load the previously generated database. | 217 # Load the previously generated database. |
226 database = LoadDatabase(database_dir, options.use_database_cache) | 218 database = LoadDatabase(database_dir, options.use_database_cache) |
227 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir, | 219 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir, |
228 options.update_dom_metadata, options.dart_use_blink) | 220 options.update_dom_metadata, options.dart_use_blink) |
229 | 221 |
230 if 'htmldart2js' in systems: | 222 if 'htmldart2js' in systems: |
231 _logger.info('Generating dart2js single files.') | 223 _logger.info('Generating dart2js single files.') |
232 for library_name in HTML_LIBRARY_NAMES: | 224 for library_name in HTML_LIBRARY_NAMES: |
233 GenerateSingleFile( | 225 GenerateSingleFile( |
234 os.path.join(dart2js_output_dir, '%s_dart2js.dart' % library_name), | 226 os.path.join(dart2js_output_dir, '%s_dart2js.dart' % library_name), |
235 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) | 227 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) |
236 if 'htmldartium' in systems: | 228 if 'htmldartium' in systems: |
237 _logger.info('Generating dartium single files.') | 229 _logger.info('Generating dartium single files.') |
238 for library_name in HTML_LIBRARY_NAMES: | 230 for library_name in HTML_LIBRARY_NAMES: |
239 GenerateSingleFile( | 231 GenerateSingleFile( |
240 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), | 232 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), |
241 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) | 233 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) |
242 GenerateSingleFile( | 234 GenerateSingleFile( |
243 os.path.join(dartium_output_dir, '_blink_dartium.dart'), | 235 os.path.join(dartium_output_dir, '_blink_dartium.dart'), |
244 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium')) | 236 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium')) |
245 | 237 |
246 if __name__ == '__main__': | 238 if __name__ == '__main__': |
247 sys.exit(main()) | 239 sys.exit(main()) |
OLD | NEW |