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'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 357 } |
358 } | 358 } |
359 | 359 |
360 // Default to a Dart URI resolver if no embedder is found. | 360 // Default to a Dart URI resolver if no embedder is found. |
361 sdkResolver ??= new DartUriResolver(sdk); | 361 sdkResolver ??= new DartUriResolver(sdk); |
362 | 362 |
363 // TODO(brianwilkerson) This doesn't handle sdk extensions. | 363 // TODO(brianwilkerson) This doesn't handle sdk extensions. |
364 List<UriResolver> resolvers = <UriResolver>[ | 364 List<UriResolver> resolvers = <UriResolver>[ |
365 sdkResolver, | 365 sdkResolver, |
366 resolver, | 366 resolver, |
367 new FileUriResolver() | 367 new file_system.ResourceUriResolver(PhysicalResourceProvider.INSTANCE) |
368 ]; | 368 ]; |
369 return new SourceFactory(resolvers); | 369 return new SourceFactory(resolvers); |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
373 UriResolver packageUriResolver; | 373 UriResolver packageUriResolver; |
374 | 374 |
375 if (options.packageRootPath != null) { | 375 if (options.packageRootPath != null) { |
376 JavaFile packageDirectory = new JavaFile(options.packageRootPath); | 376 JavaFile packageDirectory = new JavaFile(options.packageRootPath); |
377 packageUriResolver = new PackageUriResolver([packageDirectory]); | 377 packageUriResolver = new PackageUriResolver([packageDirectory]); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 if (packageInfo.packageMap != null) { | 420 if (packageInfo.packageMap != null) { |
421 resolvers.add(new SdkExtUriResolver(packageInfo.packageMap)); | 421 resolvers.add(new SdkExtUriResolver(packageInfo.packageMap)); |
422 } | 422 } |
423 | 423 |
424 // Then package URIs. | 424 // Then package URIs. |
425 if (packageUriResolver != null) { | 425 if (packageUriResolver != null) { |
426 resolvers.add(packageUriResolver); | 426 resolvers.add(packageUriResolver); |
427 } | 427 } |
428 | 428 |
429 // Finally files. | 429 // Finally files. |
430 resolvers.add(new FileUriResolver()); | 430 resolvers.add( |
| 431 new file_system.ResourceUriResolver(PhysicalResourceProvider.INSTANCE)); |
431 | 432 |
432 return new SourceFactory(resolvers, packageInfo.packages); | 433 return new SourceFactory(resolvers, packageInfo.packages); |
433 } | 434 } |
434 | 435 |
435 /// Collect all analyzable files at [filePath], recursively if it's a | 436 /// Collect all analyzable files at [filePath], recursively if it's a |
436 /// directory, ignoring links. | 437 /// directory, ignoring links. |
437 Iterable<File> _collectFiles(String filePath) { | 438 Iterable<File> _collectFiles(String filePath) { |
438 List<File> files = <File>[]; | 439 List<File> files = <File>[]; |
439 File file = new File(filePath); | 440 File file = new File(filePath); |
440 if (file.existsSync()) { | 441 if (file.existsSync()) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 plugins.add(linterPlugin); | 621 plugins.add(linterPlugin); |
621 plugins.addAll(_userDefinedPlugins); | 622 plugins.addAll(_userDefinedPlugins); |
622 | 623 |
623 ExtensionManager manager = new ExtensionManager(); | 624 ExtensionManager manager = new ExtensionManager(); |
624 manager.processPlugins(plugins); | 625 manager.processPlugins(plugins); |
625 } | 626 } |
626 | 627 |
627 /// Analyze a single source. | 628 /// Analyze a single source. |
628 ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) { | 629 ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) { |
629 int startTime = currentTimeMillis(); | 630 int startTime = currentTimeMillis(); |
630 AnalyzerImpl analyzer = | 631 AnalyzerImpl analyzer = new AnalyzerImpl( |
631 new AnalyzerImpl(_context, incrementalSession, source, options, stats, s
tartTime); | 632 _context, incrementalSession, source, options, stats, startTime); |
632 var errorSeverity = analyzer.analyzeSync(); | 633 var errorSeverity = analyzer.analyzeSync(); |
633 if (errorSeverity == ErrorSeverity.ERROR) { | 634 if (errorSeverity == ErrorSeverity.ERROR) { |
634 exitCode = errorSeverity.ordinal; | 635 exitCode = errorSeverity.ordinal; |
635 } | 636 } |
636 if (options.warningsAreFatal && errorSeverity == ErrorSeverity.WARNING) { | 637 if (options.warningsAreFatal && errorSeverity == ErrorSeverity.WARNING) { |
637 exitCode = errorSeverity.ordinal; | 638 exitCode = errorSeverity.ordinal; |
638 } | 639 } |
639 return errorSeverity; | 640 return errorSeverity; |
640 } | 641 } |
641 | 642 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 for (var package in packages) { | 857 for (var package in packages) { |
857 var packageName = path.basename(package.path); | 858 var packageName = path.basename(package.path); |
858 var realPath = package.resolveSymbolicLinksSync(); | 859 var realPath = package.resolveSymbolicLinksSync(); |
859 result[packageName] = [ | 860 result[packageName] = [ |
860 PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 861 PhysicalResourceProvider.INSTANCE.getFolder(realPath) |
861 ]; | 862 ]; |
862 } | 863 } |
863 return result; | 864 return result; |
864 } | 865 } |
865 } | 866 } |
OLD | NEW |