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.driver; | 5 library analyzer_cli.src.driver; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
10 | 10 |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 ResourceProvider resourceProvider, CommandLineOptions options) { | 732 ResourceProvider resourceProvider, CommandLineOptions options) { |
733 if (options.analysisOptionsFile != null) { | 733 if (options.analysisOptionsFile != null) { |
734 file_system.File file = | 734 file_system.File file = |
735 resourceProvider.getFile(options.analysisOptionsFile); | 735 resourceProvider.getFile(options.analysisOptionsFile); |
736 if (!file.exists) { | 736 if (!file.exists) { |
737 printAndFail('Options file not found: ${options.analysisOptionsFile}', | 737 printAndFail('Options file not found: ${options.analysisOptionsFile}', |
738 exitCode: ErrorSeverity.ERROR.ordinal); | 738 exitCode: ErrorSeverity.ERROR.ordinal); |
739 } | 739 } |
740 } | 740 } |
741 | 741 |
| 742 String contextRoot; |
| 743 if (options.sourceFiles.isEmpty) { |
| 744 contextRoot = path.current; |
| 745 } else { |
| 746 contextRoot = options.sourceFiles[0]; |
| 747 if (!path.isAbsolute(contextRoot)) { |
| 748 contextRoot = path.absolute(contextRoot); |
| 749 } |
| 750 } |
742 AnalysisOptionsImpl contextOptions = new ContextBuilder( | 751 AnalysisOptionsImpl contextOptions = new ContextBuilder( |
743 resourceProvider, null, null, | 752 resourceProvider, null, null, |
744 options: options.contextBuilderOptions) | 753 options: options.contextBuilderOptions) |
745 .getAnalysisOptions(options.sourceFiles.isNotEmpty | 754 .getAnalysisOptions(contextRoot); |
746 ? options.sourceFiles[0] | |
747 : path.current); | |
748 | 755 |
749 contextOptions.trackCacheDependencies = false; | 756 contextOptions.trackCacheDependencies = false; |
750 contextOptions.disableCacheFlushing = options.disableCacheFlushing; | 757 contextOptions.disableCacheFlushing = options.disableCacheFlushing; |
751 contextOptions.hint = !options.disableHints; | 758 contextOptions.hint = !options.disableHints; |
752 contextOptions.generateImplicitErrors = options.showPackageWarnings; | 759 contextOptions.generateImplicitErrors = options.showPackageWarnings; |
753 contextOptions.generateSdkErrors = options.showSdkWarnings; | 760 contextOptions.generateSdkErrors = options.showSdkWarnings; |
754 | 761 |
755 return contextOptions; | 762 return contextOptions; |
756 } | 763 } |
757 | 764 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 for (var package in packages) { | 906 for (var package in packages) { |
900 var packageName = path.basename(package.path); | 907 var packageName = path.basename(package.path); |
901 var realPath = package.resolveSymbolicLinksSync(); | 908 var realPath = package.resolveSymbolicLinksSync(); |
902 result[packageName] = [ | 909 result[packageName] = [ |
903 PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 910 PhysicalResourceProvider.INSTANCE.getFolder(realPath) |
904 ]; | 911 ]; |
905 } | 912 } |
906 return result; | 913 return result; |
907 } | 914 } |
908 } | 915 } |
OLD | NEW |