OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:io'; | 5 import 'dart:io'; |
6 import 'package:analyzer/src/context/cache.dart'; | 6 import 'package:analyzer/src/context/cache.dart'; |
7 import 'package:analyzer/task/model.dart'; | 7 import 'package:analyzer/task/model.dart'; |
8 import 'package:args/args.dart'; | 8 import 'package:args/args.dart'; |
9 import 'package:kernel/analyzer/loader.dart'; | 9 import 'package:kernel/analyzer/loader.dart'; |
10 import 'package:kernel/kernel.dart'; | 10 import 'package:kernel/kernel.dart'; |
(...skipping 27 matching lines...) Expand all Loading... |
38 if (options.rest.length != 1) { | 38 if (options.rest.length != 1) { |
39 print('Exactly one file must be given'); | 39 print('Exactly one file must be given'); |
40 exit(1); | 40 exit(1); |
41 } | 41 } |
42 | 42 |
43 String sdk = options['sdk']; | 43 String sdk = options['sdk']; |
44 String packagePath = options['packages']; | 44 String packagePath = options['packages']; |
45 bool strongMode = options['strong']; | 45 bool strongMode = options['strong']; |
46 | 46 |
47 String path = options.rest.single; | 47 String path = options.rest.single; |
| 48 var uri = new Uri(scheme: 'file', path: new File(path).absolute.path); |
48 var packages = | 49 var packages = |
49 getPackagesDirectory(new Uri(scheme: 'file', path: packagePath)); | 50 getPackagesDirectory(new Uri(scheme: 'file', path: packagePath)); |
50 Repository repository = new Repository(); | 51 Repository repository = new Repository(); |
51 | 52 |
52 new DartLoader( | 53 new DartLoader( |
53 repository, | 54 repository, |
54 new DartOptions( | 55 new DartOptions( |
55 strongMode: strongMode, sdk: sdk, packagePath: packagePath), | 56 strongMode: strongMode, sdk: sdk, packagePath: packagePath), |
56 packages) | 57 packages) |
57 .loadProgram(path); | 58 .loadProgram(uri); |
58 | 59 |
59 CacheEntry.recomputedCounts.forEach((key, value) { | 60 CacheEntry.recomputedCounts.forEach((key, value) { |
60 print('Recomputed $key $value times'); | 61 print('Recomputed $key $value times'); |
61 }); | 62 }); |
62 | 63 |
63 AnalysisTask.stopwatchMap.forEach((key, Stopwatch watch) { | 64 AnalysisTask.stopwatchMap.forEach((key, Stopwatch watch) { |
64 print('$key took ${watch.elapsedMilliseconds} ms'); | 65 print('$key took ${watch.elapsedMilliseconds} ms'); |
65 }); | 66 }); |
66 } | 67 } |
OLD | NEW |