Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: tools/dom/scripts/dartdomgenerator.py

Issue 2858323003: Format dart:html and related generated files on output (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 11
12 # Setup all paths to find our PYTHON code 12 # Setup all paths to find our PYTHON code
13 13
14 # dart_dir is the location of dart's enlistment dartium (dartium-git/src/dart) 14 # dart_dir is the location of dart's enlistment dartium (dartium-git/src/dart)
15 # and Dart (dart-git/dart). 15 # and Dart (dart-git/dart).
16 dart_dir = os.path.abspath(os.path.normpath(os.path.join(os.path.dirname(__file_ _), '..', '..', '..'))) 16 dart_dir = os.path.abspath(os.path.normpath(os.path.join(os.path.dirname(__file_ _), '..', '..', '..')))
17 sys.path.insert(1, os.path.join(dart_dir, 'tools/dom/new_scripts')) 17 sys.path.insert(1, os.path.join(dart_dir, 'tools/dom/new_scripts'))
18 sys.path.insert(1, os.path.join(dart_dir, 'third_party/WebCore/bindings/scripts' )) 18 sys.path.insert(1, os.path.join(dart_dir, 'third_party/WebCore/bindings/scripts' ))
19 19
20 # Dartium's third_party directory location is dartium-git/src/third_party 20 # Dartium's third_party directory location is dartium-git/src/third_party
21 # and Dart's third_party directory location is dart-git/dart/third_party. 21 # and Dart's third_party directory location is dart-git/dart/third_party.
22 third_party_dir = os.path.join(dart_dir, 'third_party') 22 third_party_dir = os.path.join(dart_dir, 'third_party')
23 23
24 ply_dir = os.path.join(third_party_dir, 'ply') 24 ply_dir = os.path.join(third_party_dir, 'ply')
25 # If ply directory found then we're a Dart enlistment; third_party location 25 # If ply directory found then we're a Dart enlistment; third_party location
26 # is dart-git/dart/third_party 26 # is dart-git/dart/third_party
27 if not os.path.exists(ply_dir): 27 if not os.path.exists(ply_dir):
28 # For Dartium (ply directory is dartium-git/src/third_party/ply) third_party 28 # For Dartium (ply directory is dartium-git/src/third_party/ply) third_party
29 # location is dartium-git/src/third_party 29 # location is dartium-git/src/third_party
30 third_party_dir = os.path.join(dart_dir, '..', 'third_party') 30 third_party_dir = os.path.join(dart_dir, '..', 'third_party')
31 assert(os.path.exists(third_party_dir)) 31 assert(os.path.exists(third_party_dir))
32 else: 32 else:
33 # It's Dart we need to make sure that tools in injected in our search path 33 # It's Dart we need to make sure that tools in injected in our search path
34 # because this is where idl_parser is located for a Dart enlistment. Dartium 34 # because this is where idl_parser is located for a Dart enlistment. Dartium
35 # can figure out the tools directory because of the location of where the 35 # can figure out the tools directory because of the location of where the
36 # scripts blink scripts are located. 36 # scripts blink scripts are located.
37 tools_dir = os.path.join(dart_dir, 'tools') 37 tools_dir = os.path.join(dart_dir, 'tools')
38 sys.path.insert(1, tools_dir) 38 sys.path.insert(1, tools_dir)
39 39
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 def GenerateSingleFile(library_path, output_dir, generated_output_dir=None): 221 def GenerateSingleFile(library_path, output_dir, generated_output_dir=None):
222 library_dir = os.path.dirname(library_path) 222 library_dir = os.path.dirname(library_path)
223 library_filename = os.path.basename(library_path) 223 library_filename = os.path.basename(library_path)
224 copy_dart_script = os.path.relpath('../../copy_dart.py', 224 copy_dart_script = os.path.relpath('../../copy_dart.py',
225 library_dir) 225 library_dir)
226 output_dir = os.path.relpath(output_dir, library_dir) 226 output_dir = os.path.relpath(output_dir, library_dir)
227 command = ' '.join(['cd', library_dir, ';', 227 command = ' '.join(['cd', library_dir, ';',
228 copy_dart_script, output_dir, library_filename]) 228 copy_dart_script, output_dir, library_filename])
229 subprocess.call([command], shell=True) 229 subprocess.call([command], shell=True)
230 prebuilt_dartfmt = os.path.join(utils.CheckedInSdkPath(), 'bin', 'dartfmt')
231 sdk_file = os.path.join(library_dir, output_dir, library_filename)
232 formatCommand = ' '.join([prebuilt_dartfmt, '-w', sdk_file])
233 subprocess.call([formatCommand], shell=True)
230 234
terry 2017/05/05 06:54:31 Looks good to me, although I think we'll want to d
terry 2017/05/05 06:59:01 You what this is fine just as it is. This is a sm
231 def UpdateCssProperties(): 235 def UpdateCssProperties():
232 """Regenerate the CssStyleDeclaration template file with the current CSS 236 """Regenerate the CssStyleDeclaration template file with the current CSS
233 properties.""" 237 properties."""
234 _logger.info('Updating Css Properties.') 238 _logger.info('Updating Css Properties.')
235 css_code_generator.GenerateCssTemplateFile() 239 css_code_generator.GenerateCssTemplateFile()
236 240
237 CACHED_PATCHES = """ 241 CACHED_PATCHES = """
238 // START_OF_CACHED_PATCHES 242 // START_OF_CACHED_PATCHES
239 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 243 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
240 // for details. All rights reserved. Use of this source code is governed by a 244 // for details. All rights reserved. Use of this source code is governed by a
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium')) 371 os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium'))
368 372
369 print '\nGenerating single file %s seconds' % round(time.time() - file_generat ion_start_time, 2) 373 print '\nGenerating single file %s seconds' % round(time.time() - file_generat ion_start_time, 2)
370 374
371 end_time = time.time() 375 end_time = time.time()
372 376
373 print '\nDone (dartdomgenerator) %s seconds' % round(end_time - start_time, 2) 377 print '\nDone (dartdomgenerator) %s seconds' % round(end_time - start_time, 2)
374 378
375 if __name__ == '__main__': 379 if __name__ == '__main__':
376 sys.exit(main()) 380 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698