OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library dart2js.profile_many; | |
6 | |
7 import 'dart:async'; | |
8 | |
9 import 'dart2js.dart' as cmdline; | |
10 | |
11 const String USAGE = """ | |
12 Usage: dart2js_profile_many.dart [OPTIONS] [FILES] | |
13 | |
14 Invokes dart2js separately for each file using the given options. | |
15 This is for profiling multiple compilations in the Dart Observatory. | |
16 """; | |
17 | |
18 printUsage() { | |
19 print(USAGE); | |
20 } | |
21 | |
22 void main(List<String> args) { | |
23 List options = []; | |
24 List files = []; | |
25 | |
26 for (String arg in args) { | |
27 if (arg.startsWith('-')) { | |
28 options.add(arg); | |
29 } else { | |
30 files.add(arg); | |
31 } | |
32 } | |
33 | |
34 if (files.length == 0) { | |
35 printUsage(); | |
36 return; | |
37 } | |
38 | |
39 cmdline.exitFunc = (code) { | |
40 throw "Exit with code $code"; | |
41 }; | |
42 | |
43 Future.forEach(files, (String file) { | |
44 List subargs = []; | |
45 subargs.addAll(options); | |
46 subargs.add(file); | |
47 return cmdline.compilerMain(subargs).catchError((e) {}); | |
48 }).then((_) { | |
49 print("Done"); | |
50 }); | |
51 } | |
OLD | NEW |