Revert "Revert "Reapply "Switch to the new analysis driver in analyzer_cli."""

This reverts commit 64df435361.

Originally landed as cda7520e5c
No new changes.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2698263002 .
This commit is contained in:
Konstantin Shcheglov 2017-02-16 09:43:31 -08:00
parent 364b8575de
commit b7f17423da
4 changed files with 21 additions and 6 deletions

View file

@ -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);
}

View file

@ -581,7 +581,9 @@ class Driver implements CommandLineStarter {
scheduler,
log,
resourceProvider,
analysisDriverMemoryByteStore,
options.useAnalysisDriverMemoryByteStore
? analysisDriverMemoryByteStore
: analysisDriverFileByteStore,
new FileContentOverlay(),
'test',
context.sourceFactory,

View file

@ -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 {

View file

@ -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" "$@"