OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer_cli.src.build_mode; | 5 library analyzer_cli.src.build_mode; |
6 | 6 |
7 import 'dart:io' as io; | 7 import 'dart:io' as io; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit; | 9 import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit; |
10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 try { | 69 try { |
70 // Add in the dart-sdk argument if `dartSdkPath` is not null, otherwise it | 70 // Add in the dart-sdk argument if `dartSdkPath` is not null, otherwise it |
71 // will try to find the currently installed sdk. | 71 // will try to find the currently installed sdk. |
72 var arguments = new List<String>.from(request.arguments); | 72 var arguments = new List<String>.from(request.arguments); |
73 if (dartSdkPath != null && | 73 if (dartSdkPath != null && |
74 !arguments.any((arg) => arg.startsWith('--dart-sdk'))) { | 74 !arguments.any((arg) => arg.startsWith('--dart-sdk'))) { |
75 arguments.add('--dart-sdk=$dartSdkPath'); | 75 arguments.add('--dart-sdk=$dartSdkPath'); |
76 } | 76 } |
77 // Prepare options. | 77 // Prepare options. |
78 CommandLineOptions options = | 78 CommandLineOptions options = |
79 CommandLineOptions.parse(arguments, (String msg) { | 79 CommandLineOptions.parse(arguments, printAndFail: (String msg) { |
80 throw new ArgumentError(msg); | 80 throw new ArgumentError(msg); |
81 }); | 81 }); |
82 // Analyze and respond. | 82 // Analyze and respond. |
83 analyze(options); | 83 analyze(options); |
84 String msg = _getErrorOutputBuffersText(); | 84 String msg = _getErrorOutputBuffersText(); |
85 return new WorkResponse() | 85 return new WorkResponse() |
86 ..exitCode = EXIT_CODE_OK | 86 ..exitCode = EXIT_CODE_OK |
87 ..output = msg; | 87 ..output = msg; |
88 } catch (e, st) { | 88 } catch (e, st) { |
89 String msg = _getErrorOutputBuffersText(); | 89 String msg = _getErrorOutputBuffersText(); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 * Build the inverse mapping of [uriToSourceMap]. | 476 * Build the inverse mapping of [uriToSourceMap]. |
477 */ | 477 */ |
478 static Map<String, Uri> _computePathToUriMap(Map<Uri, File> uriToSourceMap) { | 478 static Map<String, Uri> _computePathToUriMap(Map<Uri, File> uriToSourceMap) { |
479 Map<String, Uri> pathToUriMap = <String, Uri>{}; | 479 Map<String, Uri> pathToUriMap = <String, Uri>{}; |
480 uriToSourceMap.forEach((Uri uri, File file) { | 480 uriToSourceMap.forEach((Uri uri, File file) { |
481 pathToUriMap[file.path] = uri; | 481 pathToUriMap[file.path] = uri; |
482 }); | 482 }); |
483 return pathToUriMap; | 483 return pathToUriMap; |
484 } | 484 } |
485 } | 485 } |
OLD | NEW |