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' hide Resource; | 9 import 'dart:core' hide Resource; |
10 import 'dart:io' as io; | 10 import 'dart:io' as io; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 StreamController<ContextsChangedEvent> _onContextsChangedController = | 292 StreamController<ContextsChangedEvent> _onContextsChangedController = |
293 new StreamController<ContextsChangedEvent>.broadcast(); | 293 new StreamController<ContextsChangedEvent>.broadcast(); |
294 | 294 |
295 /** | 295 /** |
296 * The file resolver provider used to override the way file URI's are | 296 * The file resolver provider used to override the way file URI's are |
297 * resolved in some contexts. | 297 * resolved in some contexts. |
298 */ | 298 */ |
299 ResolverProvider fileResolverProvider; | 299 ResolverProvider fileResolverProvider; |
300 | 300 |
301 /** | 301 /** |
| 302 * The package resolver provider used to override the way package URI's are |
| 303 * resolved in some contexts. |
| 304 */ |
| 305 ResolverProvider packageResolverProvider; |
| 306 |
| 307 /** |
302 * The manager of pub package summaries. | 308 * The manager of pub package summaries. |
303 */ | 309 */ |
304 PubSummaryManager pubSummaryManager; | 310 PubSummaryManager pubSummaryManager; |
305 | 311 |
306 /** | 312 /** |
307 * Initialize a newly created server to receive requests from and send | 313 * Initialize a newly created server to receive requests from and send |
308 * responses to the given [channel]. | 314 * responses to the given [channel]. |
309 * | 315 * |
310 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are | 316 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are |
311 * propagated up the call stack. The default is true to allow analysis | 317 * propagated up the call stack. The default is true to allow analysis |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 contextManager = new ContextManagerImpl( | 350 contextManager = new ContextManagerImpl( |
345 resourceProvider, | 351 resourceProvider, |
346 sdkManager, | 352 sdkManager, |
347 packageResolverProvider, | 353 packageResolverProvider, |
348 packageMapProvider, | 354 packageMapProvider, |
349 analyzedFilesGlobs, | 355 analyzedFilesGlobs, |
350 instrumentationService, | 356 instrumentationService, |
351 defaultContextOptions); | 357 defaultContextOptions); |
352 } | 358 } |
353 this.fileResolverProvider = fileResolverProvider; | 359 this.fileResolverProvider = fileResolverProvider; |
| 360 this.packageResolverProvider = packageResolverProvider; |
354 ServerContextManagerCallbacks contextManagerCallbacks = | 361 ServerContextManagerCallbacks contextManagerCallbacks = |
355 new ServerContextManagerCallbacks(this, resourceProvider); | 362 new ServerContextManagerCallbacks(this, resourceProvider); |
356 contextManager.callbacks = contextManagerCallbacks; | 363 contextManager.callbacks = contextManagerCallbacks; |
357 _noErrorNotification = options.noErrorNotification; | 364 _noErrorNotification = options.noErrorNotification; |
358 AnalysisEngine.instance.logger = new AnalysisLogger(this); | 365 AnalysisEngine.instance.logger = new AnalysisLogger(this); |
359 _onAnalysisStartedController = new StreamController.broadcast(); | 366 _onAnalysisStartedController = new StreamController.broadcast(); |
360 _onFileAnalyzedController = new StreamController.broadcast(); | 367 _onFileAnalyzedController = new StreamController.broadcast(); |
361 _onPriorityChangeController = | 368 _onPriorityChangeController = |
362 new StreamController<PriorityChangeEvent>.broadcast(); | 369 new StreamController<PriorityChangeEvent>.broadcast(); |
363 running = true; | 370 running = true; |
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 } else { | 1661 } else { |
1655 defaultPackagesDirectoryPath = path; | 1662 defaultPackagesDirectoryPath = path; |
1656 } | 1663 } |
1657 } | 1664 } |
1658 } | 1665 } |
1659 | 1666 |
1660 ContextBuilder builder = new ContextBuilder(resourceProvider, | 1667 ContextBuilder builder = new ContextBuilder(resourceProvider, |
1661 analysisServer.sdkManager, analysisServer.overlayState); | 1668 analysisServer.sdkManager, analysisServer.overlayState); |
1662 builder.defaultOptions = options; | 1669 builder.defaultOptions = options; |
1663 builder.fileResolverProvider = analysisServer.fileResolverProvider; | 1670 builder.fileResolverProvider = analysisServer.fileResolverProvider; |
| 1671 builder.packageResolverProvider = analysisServer.packageResolverProvider; |
1664 builder.defaultPackageFilePath = defaultPackageFilePath; | 1672 builder.defaultPackageFilePath = defaultPackageFilePath; |
1665 builder.defaultPackagesDirectoryPath = defaultPackagesDirectoryPath; | 1673 builder.defaultPackagesDirectoryPath = defaultPackagesDirectoryPath; |
1666 return builder; | 1674 return builder; |
1667 } | 1675 } |
1668 | 1676 |
1669 @override | 1677 @override |
1670 void moveContext(Folder from, Folder to) { | 1678 void moveContext(Folder from, Folder to) { |
1671 // There is nothing to do. | 1679 // There is nothing to do. |
1672 // This method is mostly for tests. | 1680 // This method is mostly for tests. |
1673 // Context managers manage folders and contexts themselves. | 1681 // Context managers manage folders and contexts themselves. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 /** | 1796 /** |
1789 * The [PerformanceTag] for time spent in server request handlers. | 1797 * The [PerformanceTag] for time spent in server request handlers. |
1790 */ | 1798 */ |
1791 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1799 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
1792 | 1800 |
1793 /** | 1801 /** |
1794 * The [PerformanceTag] for time spent in split store microtasks. | 1802 * The [PerformanceTag] for time spent in split store microtasks. |
1795 */ | 1803 */ |
1796 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1804 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
1797 } | 1805 } |
OLD | NEW |