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

Side by Side Diff: compiler/scripts/dartc_build_wrapper.py

Issue 9950019: Renamed the 'dartc' launch script to 'dart-analysis' and adds it to dart-sdk (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Short circuit the copying of dart_analyzer completely from the build Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
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
4 # BSD-style license that can be found in the LICENSE file.
5
6 """Wrapper around dartc for use from GYP."""
7
8 import optparse
9 import os
10 from os import path
11 import shutil
12 import subprocess
13 import sys
14
15
16 def _BuildOptions():
17 op = optparse.OptionParser(usage='usage: %prog [options] FILE')
18 op.add_option('--out')
19 op.add_option('--dartc')
20 op.add_option('--dartc-option', action='append', dest='dartc_options',
21 default=[])
22 op.add_option('--incremental', action='store_false',
23 default=os.getenv('DARTC_INCREMENTAL', default=False))
24 return op
25
26
27 def _ParseOptions(cmd_line):
28 op = _BuildOptions()
29 (options, args) = op.parse_args(args=cmd_line)
30 if not options.out:
31 op.error('Flag "--out" not provided')
32 if not options.dartc:
33 op.error('Flag "--dartc" not provided')
34 return (options, args)
35
36
37 def main():
38 (options, args) = _ParseOptions(sys.argv[1:])
39 if path.exists(options.out):
40 is_out_of_date = path.getmtime(options.dartc) > path.getmtime(options.out)
41 if is_out_of_date or not options.incremental:
42 print 'Deleting %r.' % options.out
43 shutil.rmtree(options.out)
44 command_array = [options.dartc]
45 command_array.extend(['-out', options.out])
46 command_array.extend(options.dartc_options)
47 command_array.extend(args)
48 print ' '.join([repr(a) for a in command_array])
49 proc = subprocess.Popen(command_array)
50 proc.communicate()
51 sys.exit(proc.wait())
52
53
54 if __name__ == '__main__':
55 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698