| 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 'dart2js.dart' as cmdline; |
| 8 import 'dart:async'; |
| 9 |
| 10 const String USAGE = |
| 11 """ |
| 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 |
| 24 List options = []; |
| 25 List files = []; |
| 26 |
| 27 for (String arg in args) { |
| 28 if (arg.startsWith('-')) { |
| 29 options.add(arg); |
| 30 } else { |
| 31 files.add(arg); |
| 32 } |
| 33 } |
| 34 |
| 35 if (files.length == 0) { |
| 36 printUsage(); |
| 37 return; |
| 38 } |
| 39 |
| 40 cmdline.exitFunc = (code) { |
| 41 throw "Exit with code $code"; |
| 42 }; |
| 43 |
| 44 Future.forEach(files, (String file) { |
| 45 List subargs = []; |
| 46 subargs.addAll(options); |
| 47 subargs.add(file); |
| 48 return cmdline.compilerMain(subargs).catchError((e) { }); |
| 49 }).then((_) { |
| 50 print("Done"); |
| 51 }); |
| 52 |
| 53 |
| 54 } |
| OLD | NEW |