OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, 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 import optparse | 6 import optparse |
7 import os | 7 import os |
8 import stat | 8 import stat |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 stat.S_IROTH | stat.S_IXOTH) | 70 stat.S_IROTH | stat.S_IXOTH) |
71 | 71 |
72 def SelfHost(): | 72 def SelfHost(): |
73 def b(s): | 73 def b(s): |
74 """Adds ANSI escape-code for bold-face""" | 74 """Adds ANSI escape-code for bold-face""" |
75 return "\033[1m%s\033[0m" % s | 75 return "\033[1m%s\033[0m" % s |
76 | 76 |
77 # VM Checked/CompileAll, produces checked | 77 # VM Checked/CompileAll, produces checked |
78 print 'Started' | 78 print 'Started' |
79 start = time.time() | 79 start = time.time() |
80 RunCommand('./frog.py', | 80 RunCommand('./frog/frog.py', |
81 '--vm_flags=--compile_all --enable_type_checks --enable_asserts', | 81 '--vm_flags=--compile_all --enable_type_checks --enable_asserts', |
82 '--', '--compile_all', '--enable_type_checks', '--out=minfrog', | 82 '--', '--compile_all', '--enable_type_checks', |
83 'minfrog.dart') | 83 '--out=frog/minfrog', 'frog/minfrog.dart') |
84 elapsed = time.time() - start | 84 elapsed = time.time() - start |
85 mode = 'in checked mode + compile all' | 85 mode = 'in checked mode + compile all' |
86 print 'Compiling minfrog on Dart VM took %s seconds %s' % ( | 86 print 'Compiling minfrog on Dart VM took %s seconds %s' % ( |
87 b('%.1f' % elapsed), b(mode)) | 87 b('%.1f' % elapsed), b(mode)) |
88 os.chmod('./minfrog', EXECUTABLE) | 88 os.chmod('./frog/minfrog', EXECUTABLE) |
89 | 89 |
90 # VM Production | 90 # VM Production |
91 start = time.time() | 91 start = time.time() |
92 RunCommand('./frog.py', '--', '--out=minfrog', 'minfrog.dart') | 92 RunCommand('./frog/frog.py', '--', '--out=frog/minfrog', 'frog/minfrog.dart') |
93 elapsed = time.time() - start | 93 elapsed = time.time() - start |
94 mode = 'in production mode' | 94 mode = 'in production mode' |
95 print 'Compiling minfrog on Dart VM took %s seconds %s' % ( | 95 print 'Compiling minfrog on Dart VM took %s seconds %s' % ( |
96 b('%.1f' % elapsed), b(mode)) | 96 b('%.1f' % elapsed), b(mode)) |
97 os.chmod('./minfrog', EXECUTABLE) | 97 os.chmod('./frog/minfrog', EXECUTABLE) |
98 | 98 |
99 # Selfhost Production | 99 # Selfhost Production |
100 start = time.time() | 100 start = time.time() |
101 # TODO(jmesserly): --warnings_as_errors disabled until corelib is moved to | 101 # TODO(jmesserly): --warnings_as_errors disabled until corelib is moved to |
102 # new factory syntax. | 102 # new factory syntax. |
103 RunCommand('./minfrog', '--out=minfrog', # '--warnings_as_errors', | 103 RunCommand('./frog/minfrog', '--out=frog/minfrog', # '--warnings_as_errors', |
104 'minfrog.dart', 'tests/hello.dart', verbose=True) | 104 'frog/minfrog.dart', 'frog/tests/hello.dart', verbose=True) |
105 elapsed = time.time() - start | 105 elapsed = time.time() - start |
106 size = os.path.getsize('./minfrog') / 1024 | 106 size = os.path.getsize('./frog/minfrog') / 1024 |
107 print 'Bootstrapping minfrog took %s seconds %s' % (b('%.1f' % elapsed), | 107 print 'Bootstrapping minfrog took %s seconds %s' % (b('%.1f' % elapsed), |
108 b('in production mode')) | 108 b('in production mode')) |
109 print 'Generated %s minfrog is %s kB' % (b('production'), b(size)) | 109 print 'Generated %s minfrog is %s kB' % (b('production'), b(size)) |
110 | 110 |
111 | 111 |
112 def main(): | 112 def main(): |
| 113 dart_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 114 os.chdir(dart_dir) |
| 115 |
113 (options, args) = BuildOptions().parse_args() | 116 (options, args) = BuildOptions().parse_args() |
114 | 117 |
115 RunCommand('../tools/build.py', '--mode=release') | 118 RunCommand('./tools/build.py', '--mode=release', 'dart2js') |
116 | 119 |
117 if not options.leg_only: | 120 if not options.leg_only: |
118 SelfHost() | 121 SelfHost() |
119 | 122 |
120 test_cmd = ['../tools/test.py', '--report', '--timeout=30', | 123 test_cmd = ['./tools/test.py', '--report', '--timeout=30', |
121 '--progress=color', '--mode=release', '--checked'] | 124 '--progress=color', '--mode=release', '--checked'] |
122 | 125 |
123 if options.notest: return | 126 if options.notest: return |
124 | 127 |
125 if args: | 128 if args: |
126 if options.leg_only: | 129 if options.leg_only: |
127 test_cmd.append('--component=leg') | 130 test_cmd.append('--component=leg') |
128 else: | 131 else: |
129 test_cmd.append('--component=frogsh,leg') | 132 test_cmd.append('--component=frogsh,leg') |
130 test_cmd.extend(args) | 133 test_cmd.extend(args) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 cmd = test_cmd + ['--component=legium', 'client'] | 177 cmd = test_cmd + ['--component=legium', 'client'] |
175 RunCommand(*cmd, verbose=True) | 178 RunCommand(*cmd, verbose=True) |
176 | 179 |
177 | 180 |
178 if __name__ == '__main__': | 181 if __name__ == '__main__': |
179 try: | 182 try: |
180 sys.exit(main()) | 183 sys.exit(main()) |
181 except Error as e: | 184 except Error as e: |
182 sys.stderr.write('%s\n' % e) | 185 sys.stderr.write('%s\n' % e) |
183 sys.exit(1) | 186 sys.exit(1) |
OLD | NEW |