From b7f17423da4b31d4bb8adcf33af422ded876c67d Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Thu, 16 Feb 2017 09:43:31 -0800 Subject: [PATCH] Revert "Revert "Reapply "Switch to the new analysis driver in analyzer_cli.""" This reverts commit 64df435361535e9e64deadc98e2ee22507d19bb0. Originally landed as https://github.com/dart-lang/sdk/commit/cda7520e5c19425637351be5eae04af7e3136111 No new changes. R=brianwilkerson@google.com BUG= Review-Url: https://codereview.chromium.org/2698263002 . --- pkg/analyzer_cli/lib/src/analyzer_impl.dart | 5 +++-- pkg/analyzer_cli/lib/src/driver.dart | 4 +++- pkg/analyzer_cli/lib/src/options.dart | 14 ++++++++++++-- sdk/bin/dartanalyzer | 4 +++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/pkg/analyzer_cli/lib/src/analyzer_impl.dart b/pkg/analyzer_cli/lib/src/analyzer_impl.dart index 5df078a224d..73ff30b2d4a 100644 --- a/pkg/analyzer_cli/lib/src/analyzer_impl.dart +++ b/pkg/analyzer_cli/lib/src/analyzer_impl.dart @@ -266,8 +266,9 @@ class AnalyzerImpl { if (analysisDriver != null) { String path = librarySource.fullName; analysisDriver.priorityFiles = [path]; - AnalysisResult analysisResult = await analysisDriver.getResult(path); - return analysisResult.unit.element.library; + UnitElementResult elementResult = + await analysisDriver.getUnitElement(path); + return elementResult.element.library; } else { return context.computeLibraryElement(librarySource); } diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart index eb90671e88a..f3c57a2ae99 100644 --- a/pkg/analyzer_cli/lib/src/driver.dart +++ b/pkg/analyzer_cli/lib/src/driver.dart @@ -581,7 +581,9 @@ class Driver implements CommandLineStarter { scheduler, log, resourceProvider, - analysisDriverMemoryByteStore, + options.useAnalysisDriverMemoryByteStore + ? analysisDriverMemoryByteStore + : analysisDriverFileByteStore, new FileContentOverlay(), 'test', context.sourceFactory, diff --git a/pkg/analyzer_cli/lib/src/options.dart b/pkg/analyzer_cli/lib/src/options.dart index 7dd9de9317a..915d0436602 100644 --- a/pkg/analyzer_cli/lib/src/options.dart +++ b/pkg/analyzer_cli/lib/src/options.dart @@ -33,7 +33,7 @@ typedef void ExitHandler(int code); /// Analyzer commandline configuration options. class CommandLineOptions { - final bool enableNewAnalysisDriver = false; + final bool enableNewAnalysisDriver = true; /// The path to output analysis results when in build mode. final String buildAnalysisOutput; @@ -143,6 +143,9 @@ class CommandLineOptions { /// Whether to treat lints as fatal final bool lintsAreFatal; + /// Whether to use memory byte store for analysis driver. + final bool useAnalysisDriverMemoryByteStore; + /// Initialize options from the given parsed [args]. CommandLineOptions._fromArgs(ArgResults args) : buildAnalysisOutput = args['build-analysis-output'], @@ -181,7 +184,9 @@ class CommandLineOptions { strongMode = args['strong'], implicitCasts = !args['no-implicit-casts'], implicitDynamic = !args['no-implicit-dynamic'], - lintsAreFatal = args['fatal-lints']; + lintsAreFatal = args['fatal-lints'], + useAnalysisDriverMemoryByteStore = + args['use-analysis-driver-memory-byte-store']; /// The path to an analysis options file String get analysisOptionsFile => @@ -453,6 +458,11 @@ class CommandLineOptions { help: 'Check types in constant evaluation.', defaultsTo: false, negatable: false, + hide: hide) + ..addFlag('use-analysis-driver-memory-byte-store', + help: 'Use memory byte store, not the file system cache.', + defaultsTo: false, + negatable: false, hide: hide); try { diff --git a/sdk/bin/dartanalyzer b/sdk/bin/dartanalyzer index 34ce8956351..bad9306fdd1 100755 --- a/sdk/bin/dartanalyzer +++ b/sdk/bin/dartanalyzer @@ -45,4 +45,6 @@ DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)" ANALYZER="$DART_ROOT/pkg/analyzer_cli/bin/analyzer.dart" -exec "$DART" "--packages=$DART_ROOT/.packages" "${EXTRA_VM_OPTIONS[@]}" "$ANALYZER" "$SDK_ARG" "$@" +DEV_OPTIONS="--use-analysis-driver-memory-byte-store" + +exec "$DART" "--packages=$DART_ROOT/.packages" "${EXTRA_VM_OPTIONS[@]}" "$ANALYZER" "$DEV_OPTIONS" "$SDK_ARG" "$@"