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