| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analysis.server; | 5 library analysis.server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:core'; | 9 import 'dart:core'; |
| 10 import 'dart:io' as io; | 10 import 'dart:io' as io; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 import 'package:analyzer/src/dart/analysis/file_byte_store.dart'; | 44 import 'package:analyzer/src/dart/analysis/file_byte_store.dart'; |
| 45 import 'package:analyzer/src/dart/analysis/file_state.dart' as nd; | 45 import 'package:analyzer/src/dart/analysis/file_state.dart' as nd; |
| 46 import 'package:analyzer/src/dart/analysis/status.dart' as nd; | 46 import 'package:analyzer/src/dart/analysis/status.dart' as nd; |
| 47 import 'package:analyzer/src/dart/ast/utilities.dart'; | 47 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| 48 import 'package:analyzer/src/dart/element/ast_provider.dart'; | 48 import 'package:analyzer/src/dart/element/ast_provider.dart'; |
| 49 import 'package:analyzer/src/generated/engine.dart'; | 49 import 'package:analyzer/src/generated/engine.dart'; |
| 50 import 'package:analyzer/src/generated/sdk.dart'; | 50 import 'package:analyzer/src/generated/sdk.dart'; |
| 51 import 'package:analyzer/src/generated/source.dart'; | 51 import 'package:analyzer/src/generated/source.dart'; |
| 52 import 'package:analyzer/src/generated/source_io.dart'; | 52 import 'package:analyzer/src/generated/source_io.dart'; |
| 53 import 'package:analyzer/src/generated/utilities_general.dart'; | 53 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 54 import 'package:analyzer/src/summary/pub_summary.dart'; | |
| 55 import 'package:analyzer/src/task/dart.dart'; | 54 import 'package:analyzer/src/task/dart.dart'; |
| 56 import 'package:analyzer/src/util/glob.dart'; | 55 import 'package:analyzer/src/util/glob.dart'; |
| 57 import 'package:analyzer/task/dart.dart'; | 56 import 'package:analyzer/task/dart.dart'; |
| 58 import 'package:plugin/plugin.dart'; | 57 import 'package:plugin/plugin.dart'; |
| 59 | 58 |
| 60 typedef void OptionUpdater(AnalysisOptionsImpl options); | 59 typedef void OptionUpdater(AnalysisOptionsImpl options); |
| 61 | 60 |
| 62 /** | 61 /** |
| 63 * Enum representing reasons why analysis might be done for a given file. | 62 * Enum representing reasons why analysis might be done for a given file. |
| 64 */ | 63 */ |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 * resolved in some contexts. | 312 * resolved in some contexts. |
| 314 */ | 313 */ |
| 315 ResolverProvider fileResolverProvider; | 314 ResolverProvider fileResolverProvider; |
| 316 | 315 |
| 317 /** | 316 /** |
| 318 * The package resolver provider used to override the way package URI's are | 317 * The package resolver provider used to override the way package URI's are |
| 319 * resolved in some contexts. | 318 * resolved in some contexts. |
| 320 */ | 319 */ |
| 321 ResolverProvider packageResolverProvider; | 320 ResolverProvider packageResolverProvider; |
| 322 | 321 |
| 323 /** | |
| 324 * The manager of pub package summaries. | |
| 325 */ | |
| 326 PubSummaryManager pubSummaryManager; | |
| 327 | |
| 328 nd.PerformanceLog _analysisPerformanceLogger; | 322 nd.PerformanceLog _analysisPerformanceLogger; |
| 329 ByteStore byteStore; | 323 ByteStore byteStore; |
| 330 nd.AnalysisDriverScheduler analysisDriverScheduler; | 324 nd.AnalysisDriverScheduler analysisDriverScheduler; |
| 331 | 325 |
| 332 /** | 326 /** |
| 333 * The set of the files that are currently priority. | 327 * The set of the files that are currently priority. |
| 334 */ | 328 */ |
| 335 final Set<String> priorityFiles = new Set<String>(); | 329 final Set<String> priorityFiles = new Set<String>(); |
| 336 | 330 |
| 337 /** | 331 /** |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 performanceAfterStartup = new ServerPerformance(); | 411 performanceAfterStartup = new ServerPerformance(); |
| 418 _performance = performanceAfterStartup; | 412 _performance = performanceAfterStartup; |
| 419 }); | 413 }); |
| 420 }); | 414 }); |
| 421 _setupIndexInvalidation(); | 415 _setupIndexInvalidation(); |
| 422 if (options.enableNewAnalysisDriver) { | 416 if (options.enableNewAnalysisDriver) { |
| 423 searchEngine = new SearchEngineImpl2(driverMap.values); | 417 searchEngine = new SearchEngineImpl2(driverMap.values); |
| 424 } else if (index != null) { | 418 } else if (index != null) { |
| 425 searchEngine = new SearchEngineImpl(index, getAstProvider); | 419 searchEngine = new SearchEngineImpl(index, getAstProvider); |
| 426 } | 420 } |
| 427 pubSummaryManager = | |
| 428 new PubSummaryManager(resourceProvider, '${io.pid}.temp'); | |
| 429 Notification notification = new ServerConnectedParams(VERSION, io.pid, | 421 Notification notification = new ServerConnectedParams(VERSION, io.pid, |
| 430 sessionId: instrumentationService.sessionId) | 422 sessionId: instrumentationService.sessionId) |
| 431 .toNotification(); | 423 .toNotification(); |
| 432 channel.sendNotification(notification); | 424 channel.sendNotification(notification); |
| 433 channel.listen(handleRequest, onDone: done, onError: error); | 425 channel.listen(handleRequest, onDone: done, onError: error); |
| 434 handlers = serverPlugin.createDomains(this); | 426 handlers = serverPlugin.createDomains(this); |
| 435 } | 427 } |
| 436 | 428 |
| 437 /** | 429 /** |
| 438 * Return the [AnalysisContext]s that are being used to analyze the analysis | 430 * Return the [AnalysisContext]s that are being used to analyze the analysis |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 index.removeContext(context); | 1778 index.removeContext(context); |
| 1787 } | 1779 } |
| 1788 }); | 1780 }); |
| 1789 } | 1781 } |
| 1790 } | 1782 } |
| 1791 | 1783 |
| 1792 class AnalysisServerOptions { | 1784 class AnalysisServerOptions { |
| 1793 bool enableIncrementalResolutionApi = false; | 1785 bool enableIncrementalResolutionApi = false; |
| 1794 bool enableIncrementalResolutionValidation = false; | 1786 bool enableIncrementalResolutionValidation = false; |
| 1795 bool enableNewAnalysisDriver = false; | 1787 bool enableNewAnalysisDriver = false; |
| 1796 bool enablePubSummaryManager = false; | |
| 1797 bool finerGrainedInvalidation = false; | 1788 bool finerGrainedInvalidation = false; |
| 1798 bool noErrorNotification = false; | 1789 bool noErrorNotification = false; |
| 1799 bool noIndex = false; | 1790 bool noIndex = false; |
| 1800 bool useAnalysisHighlight2 = false; | 1791 bool useAnalysisHighlight2 = false; |
| 1801 String fileReadMode = 'as-is'; | 1792 String fileReadMode = 'as-is'; |
| 1802 String newAnalysisDriverLog; | 1793 String newAnalysisDriverLog; |
| 1803 } | 1794 } |
| 1804 | 1795 |
| 1805 /** | 1796 /** |
| 1806 * Information about a file - an [AnalysisContext] that analyses the file, | 1797 * Information about a file - an [AnalysisContext] that analyses the file, |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 } else { | 1959 } else { |
| 1969 defaultPackagesDirectoryPath = path; | 1960 defaultPackagesDirectoryPath = path; |
| 1970 } | 1961 } |
| 1971 } | 1962 } |
| 1972 } | 1963 } |
| 1973 | 1964 |
| 1974 ContextBuilderOptions builderOptions = new ContextBuilderOptions(); | 1965 ContextBuilderOptions builderOptions = new ContextBuilderOptions(); |
| 1975 builderOptions.defaultOptions = options; | 1966 builderOptions.defaultOptions = options; |
| 1976 builderOptions.defaultPackageFilePath = defaultPackageFilePath; | 1967 builderOptions.defaultPackageFilePath = defaultPackageFilePath; |
| 1977 builderOptions.defaultPackagesDirectoryPath = defaultPackagesDirectoryPath; | 1968 builderOptions.defaultPackagesDirectoryPath = defaultPackagesDirectoryPath; |
| 1978 if (analysisServer.options.enablePubSummaryManager) { | |
| 1979 builderOptions.pubSummaryManager = analysisServer.pubSummaryManager; | |
| 1980 } | |
| 1981 ContextBuilder builder = new ContextBuilder(resourceProvider, | 1969 ContextBuilder builder = new ContextBuilder(resourceProvider, |
| 1982 analysisServer.sdkManager, analysisServer.overlayState, | 1970 analysisServer.sdkManager, analysisServer.overlayState, |
| 1983 options: builderOptions); | 1971 options: builderOptions); |
| 1984 builder.fileResolverProvider = analysisServer.fileResolverProvider; | 1972 builder.fileResolverProvider = analysisServer.fileResolverProvider; |
| 1985 builder.packageResolverProvider = analysisServer.packageResolverProvider; | 1973 builder.packageResolverProvider = analysisServer.packageResolverProvider; |
| 1986 builder.analysisDriverScheduler = analysisServer.analysisDriverScheduler; | 1974 builder.analysisDriverScheduler = analysisServer.analysisDriverScheduler; |
| 1987 builder.performanceLog = analysisServer._analysisPerformanceLogger; | 1975 builder.performanceLog = analysisServer._analysisPerformanceLogger; |
| 1988 builder.byteStore = analysisServer.byteStore; | 1976 builder.byteStore = analysisServer.byteStore; |
| 1989 builder.fileContentOverlay = analysisServer.fileContentOverlay; | 1977 builder.fileContentOverlay = analysisServer.fileContentOverlay; |
| 1990 return builder; | 1978 return builder; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2137 /** | 2125 /** |
| 2138 * The [PerformanceTag] for time spent in server request handlers. | 2126 * The [PerformanceTag] for time spent in server request handlers. |
| 2139 */ | 2127 */ |
| 2140 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2128 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 2141 | 2129 |
| 2142 /** | 2130 /** |
| 2143 * The [PerformanceTag] for time spent in split store microtasks. | 2131 * The [PerformanceTag] for time spent in split store microtasks. |
| 2144 */ | 2132 */ |
| 2145 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2133 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 2146 } | 2134 } |
| OLD | NEW |