| Index: pkg/analysis_server/lib/src/context_manager.dart
|
| diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
|
| index db0b06e9e7e1908823c80944a9596fd34bad2b46..2f115f671677a67e3585cfa789dea89e79d93357 100644
|
| --- a/pkg/analysis_server/lib/src/context_manager.dart
|
| +++ b/pkg/analysis_server/lib/src/context_manager.dart
|
| @@ -18,7 +18,6 @@ import 'package:analyzer/source/path_filter.dart';
|
| import 'package:analyzer/source/pub_package_map_provider.dart';
|
| import 'package:analyzer/source/sdk_ext.dart';
|
| import 'package:analyzer/src/context/builder.dart';
|
| -import 'package:analyzer/src/context/context.dart' as context;
|
| import 'package:analyzer/src/dart/analysis/driver.dart';
|
| import 'package:analyzer/src/dart/sdk/sdk.dart';
|
| import 'package:analyzer/src/generated/engine.dart';
|
| @@ -529,8 +528,6 @@ class ContextManagerImpl implements ContextManager {
|
| */
|
| final InstrumentationService _instrumentationService;
|
|
|
| - final bool enableNewAnalysisDriver;
|
| -
|
| @override
|
| ContextManagerCallbacks callbacks;
|
|
|
| @@ -545,12 +542,6 @@ class ContextManagerImpl implements ContextManager {
|
| new HashMap<Folder, AnalysisDriver>();
|
|
|
| /**
|
| - * A table mapping [Folder]s to the [AnalysisContext]s associated with them.
|
| - */
|
| - final Map<Folder, AnalysisContext> _folderMap =
|
| - new HashMap<Folder, AnalysisContext>();
|
| -
|
| - /**
|
| * Stream subscription we are using to watch each analysis root directory for
|
| * changes.
|
| */
|
| @@ -564,8 +555,7 @@ class ContextManagerImpl implements ContextManager {
|
| this._packageMapProvider,
|
| this.analyzedFilesGlobs,
|
| this._instrumentationService,
|
| - this.defaultContextOptions,
|
| - this.enableNewAnalysisDriver) {
|
| + this.defaultContextOptions) {
|
| absolutePathContext = resourceProvider.absolutePathContext;
|
| pathContext = resourceProvider.pathContext;
|
| }
|
| @@ -574,11 +564,7 @@ class ContextManagerImpl implements ContextManager {
|
| Iterable<AnalysisContext> get analysisContexts => folderMap.values;
|
|
|
| Map<Folder, AnalysisContext> get folderMap {
|
| - if (enableNewAnalysisDriver) {
|
| - throw new StateError('Should not be used with the new analysis driver');
|
| - } else {
|
| - return _folderMap;
|
| - }
|
| + throw new StateError('Should not be used with the new analysis driver');
|
| }
|
|
|
| @override
|
| @@ -1008,29 +994,15 @@ class ContextManagerImpl implements ContextManager {
|
| void _checkForAnalysisOptionsUpdate(
|
| String path, ContextInfo info, ChangeType changeType) {
|
| if (AnalysisEngine.isAnalysisOptionsFileName(path, pathContext)) {
|
| - if (enableNewAnalysisDriver) {
|
| - AnalysisDriver driver = info.analysisDriver;
|
| - String contextRoot = info.folder.path;
|
| - ContextBuilder builder =
|
| - callbacks.createContextBuilder(info.folder, defaultContextOptions);
|
| - AnalysisOptions options = builder.getAnalysisOptions(contextRoot,
|
| - contextRoot: driver.contextRoot);
|
| - SourceFactory factory =
|
| - builder.createSourceFactory(contextRoot, options);
|
| - driver.configure(analysisOptions: options, sourceFactory: factory);
|
| - // TODO(brianwilkerson) Set exclusion patterns.
|
| - } else {
|
| - var analysisContext = info.context;
|
| - if (analysisContext is context.AnalysisContextImpl) {
|
| - Map<String, Object> options =
|
| - readOptions(info.folder, info.disposition.packages);
|
| - processOptionsForContext(info, options,
|
| - optionsRemoved: changeType == ChangeType.REMOVE);
|
| - analysisContext.sourceFactory = _createSourceFactory(
|
| - analysisContext, analysisContext.analysisOptions, info.folder);
|
| - callbacks.applyChangesToContext(info.folder, new ChangeSet());
|
| - }
|
| - }
|
| + AnalysisDriver driver = info.analysisDriver;
|
| + String contextRoot = info.folder.path;
|
| + ContextBuilder builder =
|
| + callbacks.createContextBuilder(info.folder, defaultContextOptions);
|
| + AnalysisOptions options = builder.getAnalysisOptions(contextRoot,
|
| + contextRoot: driver.contextRoot);
|
| + SourceFactory factory = builder.createSourceFactory(contextRoot, options);
|
| + driver.configure(analysisOptions: options, sourceFactory: factory);
|
| + // TODO(brianwilkerson) Set exclusion patterns.
|
| }
|
| }
|
|
|
| @@ -1045,13 +1017,8 @@ class ContextManagerImpl implements ContextManager {
|
| AnalysisOptions options = builder.getAnalysisOptions(contextRoot,
|
| contextRoot: info.analysisDriver?.contextRoot);
|
| SourceFactory factory = builder.createSourceFactory(contextRoot, options);
|
| - if (enableNewAnalysisDriver) {
|
| - AnalysisDriver driver = info.analysisDriver;
|
| - driver.configure(analysisOptions: options, sourceFactory: factory);
|
| - } else {
|
| - info.context.analysisOptions = options;
|
| - info.context.sourceFactory = factory;
|
| - }
|
| + AnalysisDriver driver = info.analysisDriver;
|
| + driver.configure(analysisOptions: options, sourceFactory: factory);
|
| }
|
| }
|
|
|
| @@ -1062,31 +1029,14 @@ class ContextManagerImpl implements ContextManager {
|
| * file.)
|
| */
|
| List<String> _computeFlushedFiles(ContextInfo info) {
|
| - if (enableNewAnalysisDriver) {
|
| - Set<String> flushedFiles = info.analysisDriver.addedFiles.toSet();
|
| - for (ContextInfo contextInfo in rootInfo.descendants) {
|
| - AnalysisDriver other = contextInfo.analysisDriver;
|
| - if (other != info.analysisDriver) {
|
| - flushedFiles.removeAll(other.addedFiles);
|
| - }
|
| + Set<String> flushedFiles = info.analysisDriver.addedFiles.toSet();
|
| + for (ContextInfo contextInfo in rootInfo.descendants) {
|
| + AnalysisDriver other = contextInfo.analysisDriver;
|
| + if (other != info.analysisDriver) {
|
| + flushedFiles.removeAll(other.addedFiles);
|
| }
|
| - return flushedFiles.toList(growable: false);
|
| - } else {
|
| - AnalysisContext context = info.context;
|
| - HashSet<String> flushedFiles = new HashSet<String>();
|
| - for (Source source in context.sources) {
|
| - flushedFiles.add(source.fullName);
|
| - }
|
| - for (ContextInfo contextInfo in rootInfo.descendants) {
|
| - AnalysisContext contextN = contextInfo.context;
|
| - if (context != contextN) {
|
| - for (Source source in contextN.sources) {
|
| - flushedFiles.remove(source.fullName);
|
| - }
|
| - }
|
| - }
|
| - return flushedFiles.toList(growable: false);
|
| }
|
| + return flushedFiles.toList(growable: false);
|
| }
|
|
|
| /**
|
| @@ -1187,22 +1137,14 @@ class ContextManagerImpl implements ContextManager {
|
| applyToAnalysisOptions(options, optionMap);
|
|
|
| info.setDependencies(dependencies);
|
| - if (enableNewAnalysisDriver) {
|
| - String includedPath = folder.path;
|
| - List<String> containedExcludedPaths = excludedPaths
|
| - .where((String excludedPath) =>
|
| - pathContext.isWithin(includedPath, excludedPath))
|
| - .toList();
|
| - processOptionsForDriver(info, options, optionMap);
|
| - info.analysisDriver = callbacks.addAnalysisDriver(folder,
|
| - new ContextRoot(folder.path, containedExcludedPaths), options);
|
| - } else {
|
| - info.context = callbacks.addContext(folder, options);
|
| - _folderMap[folder] = info.context;
|
| - info.context.name = folder.path;
|
| - processOptionsForContext(info, optionMap);
|
| - }
|
| -
|
| + String includedPath = folder.path;
|
| + List<String> containedExcludedPaths = excludedPaths
|
| + .where((String excludedPath) =>
|
| + pathContext.isWithin(includedPath, excludedPath))
|
| + .toList();
|
| + processOptionsForDriver(info, options, optionMap);
|
| + info.analysisDriver = callbacks.addAnalysisDriver(
|
| + folder, new ContextRoot(folder.path, containedExcludedPaths), options);
|
| return info;
|
| }
|
|
|
| @@ -1470,15 +1412,7 @@ class ContextManagerImpl implements ContextManager {
|
| if (resource is File) {
|
| File file = resource;
|
| if (_shouldFileBeAnalyzed(file)) {
|
| - if (enableNewAnalysisDriver) {
|
| - info.analysisDriver.addFile(path);
|
| - } else {
|
| - ChangeSet changeSet = new ChangeSet();
|
| - Source source = createSourceInContext(info.context, file);
|
| - changeSet.addedSource(source);
|
| - callbacks.applyChangesToContext(info.folder, changeSet);
|
| - info.sources[path] = source;
|
| - }
|
| + info.analysisDriver.addFile(path);
|
| }
|
| }
|
| break;
|
| @@ -1515,34 +1449,11 @@ class ContextManagerImpl implements ContextManager {
|
| }
|
| }
|
|
|
| - if (enableNewAnalysisDriver) {
|
| - callbacks.applyFileRemoved(info.analysisDriver, path);
|
| - } else {
|
| - List<Source> sources = info.context.getSourcesWithFullName(path);
|
| - if (!sources.isEmpty) {
|
| - ChangeSet changeSet = new ChangeSet();
|
| - sources.forEach((Source source) {
|
| - changeSet.removedSource(source);
|
| - });
|
| - callbacks.applyChangesToContext(info.folder, changeSet);
|
| - info.sources.remove(path);
|
| - }
|
| - }
|
| + callbacks.applyFileRemoved(info.analysisDriver, path);
|
| break;
|
| case ChangeType.MODIFY:
|
| - if (enableNewAnalysisDriver) {
|
| - for (AnalysisDriver driver in driverMap.values) {
|
| - driver.changeFile(path);
|
| - }
|
| - } else {
|
| - List<Source> sources = info.context.getSourcesWithFullName(path);
|
| - if (!sources.isEmpty) {
|
| - ChangeSet changeSet = new ChangeSet();
|
| - sources.forEach((Source source) {
|
| - changeSet.changedSource(source);
|
| - });
|
| - callbacks.applyChangesToContext(info.folder, changeSet);
|
| - }
|
| + for (AnalysisDriver driver in driverMap.values) {
|
| + driver.changeFile(path);
|
| }
|
| break;
|
| }
|
| @@ -1702,18 +1613,11 @@ class ContextManagerImpl implements ContextManager {
|
| }
|
|
|
| void _updateContextPackageUriResolver(Folder contextFolder) {
|
| - if (enableNewAnalysisDriver) {
|
| - ContextInfo info = getContextInfoFor(contextFolder);
|
| - AnalysisDriver driver = info.analysisDriver;
|
| - SourceFactory sourceFactory =
|
| - _createSourceFactory(null, driver.analysisOptions, contextFolder);
|
| - driver.configure(sourceFactory: sourceFactory);
|
| - } else {
|
| - AnalysisContext context = folderMap[contextFolder];
|
| - context.sourceFactory =
|
| - _createSourceFactory(context, context.analysisOptions, contextFolder);
|
| - callbacks.updateContextPackageUriResolver(context);
|
| - }
|
| + ContextInfo info = getContextInfoFor(contextFolder);
|
| + AnalysisDriver driver = info.analysisDriver;
|
| + SourceFactory sourceFactory =
|
| + _createSourceFactory(null, driver.analysisOptions, contextFolder);
|
| + driver.configure(sourceFactory: sourceFactory);
|
| }
|
|
|
| /**
|
|
|