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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 """Regenerate the CssStyleDeclaration template file with the current CSS | 212 """Regenerate the CssStyleDeclaration template file with the current CSS |
213 properties.""" | 213 properties.""" |
214 _logger.info('Updating Css Properties.') | 214 _logger.info('Updating Css Properties.') |
215 css_code_generator.GenerateCssTemplateFile() | 215 css_code_generator.GenerateCssTemplateFile() |
216 | 216 |
217 def main(): | 217 def main(): |
218 parser = optparse.OptionParser() | 218 parser = optparse.OptionParser() |
219 parser.add_option('--parallel', dest='parallel', | 219 parser.add_option('--parallel', dest='parallel', |
220 action='store_true', default=False, | 220 action='store_true', default=False, |
221 help='Use fremontcut in parallel mode.') | 221 help='Use fremontcut in parallel mode.') |
222 parser.add_option('--rebuild', dest='rebuild', | |
223 action='store_true', default=False, | |
224 help='Rebuild the database from IDL using fremontcut.') | |
225 parser.add_option('--systems', dest='systems', | 222 parser.add_option('--systems', dest='systems', |
226 action='store', type='string', | 223 action='store', type='string', |
227 default='htmldart2js,htmldartium', | 224 default='htmldart2js,htmldartium', |
228 help='Systems to generate (htmldart2js, htmldartium)') | 225 help='Systems to generate (htmldart2js, htmldartium)') |
229 parser.add_option('--output-dir', dest='output_dir', | 226 parser.add_option('--output-dir', dest='output_dir', |
230 action='store', type='string', | 227 action='store', type='string', |
231 default=None, | 228 default=None, |
232 help='Directory to put the generated files') | 229 help='Directory to put the generated files') |
233 parser.add_option('--use-database-cache', dest='use_database_cache', | 230 parser.add_option('--use-database-cache', dest='use_database_cache', |
234 action='store_true', | 231 action='store_true', |
235 default=False, | 232 default=False, |
236 help='''Use the cached database from the previous run to | 233 help='''Use the cached database from the previous run to |
237 improve startup performance''') | 234 improve startup performance''') |
238 parser.add_option('--update-dom-metadata', dest='update_dom_metadata', | 235 parser.add_option('--update-dom-metadata', dest='update_dom_metadata', |
239 action='store_true', | 236 action='store_true', |
240 default=False, | 237 default=False, |
241 help='''Update the metadata list of DOM APIs''') | 238 help='''Update the metadata list of DOM APIs''') |
242 parser.add_option('--blink-parser', dest='blink_parser', | |
243 action='store_true', default=False, | |
244 help='Use New Blink IDL parser.') | |
245 parser.add_option('--verbose', dest='logging_level', | 239 parser.add_option('--verbose', dest='logging_level', |
246 action='store_false', default=logging.WARNING, | 240 action='store_false', default=logging.WARNING, |
247 help='Output all informational messages') | 241 help='Output all informational messages') |
248 parser.add_option('--logging', dest='logging', type='int', | 242 parser.add_option('--logging', dest='logging', type='int', |
249 action='store', default=logging.NOTSET, | 243 action='store', default=logging.NOTSET, |
250 help='Level of logging 20 is Info, 30 is Warnings, 40 is Err
ors') | 244 help='Level of logging 20 is Info, 30 is Warnings, 40 is Err
ors') |
251 | 245 |
252 (options, args) = parser.parse_args() | 246 (options, args) = parser.parse_args() |
253 | 247 |
254 current_dir = os.path.dirname(__file__) | 248 current_dir = os.path.dirname(__file__) |
(...skipping 12 matching lines...) Expand all Loading... |
267 if 'htmldartium' in systems: | 261 if 'htmldartium' in systems: |
268 dartium_output_dir = os.path.join(output_dir, 'dartium') | 262 dartium_output_dir = os.path.join(output_dir, 'dartium') |
269 | 263 |
270 logging_level = options.logging_level \ | 264 logging_level = options.logging_level \ |
271 if options.logging == logging.NOTSET else options.logging | 265 if options.logging == logging.NOTSET else options.logging |
272 | 266 |
273 start_time = time.time() | 267 start_time = time.time() |
274 | 268 |
275 UpdateCssProperties() | 269 UpdateCssProperties() |
276 | 270 |
277 if options.rebuild: | 271 # Parse the IDL and create the database. |
278 # Parse the IDL and create the database. | 272 database = fremontcutbuilder.main(options.parallel, logging_level=logging_leve
l) |
279 database = fremontcutbuilder.main(options.parallel, options.blink_parser, | |
280 logging_level=logging_level) | |
281 else: | |
282 # TODO(terry): Should be able to remove this... | |
283 # Load the previously generated database. | |
284 if not options.blink_parser: | |
285 database = LoadDatabase(database_dir, options.use_database_cache) | |
286 | 273 |
287 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir, | 274 GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir, |
288 options.update_dom_metadata, logging_level) | 275 options.update_dom_metadata, logging_level) |
289 | 276 |
290 file_generation_start_time = time.time() | 277 file_generation_start_time = time.time() |
291 | 278 |
292 if 'htmldart2js' in systems: | 279 if 'htmldart2js' in systems: |
293 _logger.info('Generating dart2js single files.') | 280 _logger.info('Generating dart2js single files.') |
294 | 281 |
295 for library_name in HTML_LIBRARY_NAMES: | 282 for library_name in HTML_LIBRARY_NAMES: |
(...skipping 14 matching lines...) Expand all Loading... |
310 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium')) | 297 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium')) |
311 | 298 |
312 print '\nGenerating single file %s seconds' % round(time.time() - file_generat
ion_start_time, 2) | 299 print '\nGenerating single file %s seconds' % round(time.time() - file_generat
ion_start_time, 2) |
313 | 300 |
314 end_time = time.time() | 301 end_time = time.time() |
315 | 302 |
316 print '\nDone (dartdomgenerator) %s seconds' % round(end_time - start_time, 2) | 303 print '\nDone (dartdomgenerator) %s seconds' % round(end_time - start_time, 2) |
317 | 304 |
318 if __name__ == '__main__': | 305 if __name__ == '__main__': |
319 sys.exit(main()) | 306 sys.exit(main()) |
OLD | NEW |