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 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 */ | 1596 */ |
1597 final ResourceProvider resourceProvider; | 1597 final ResourceProvider resourceProvider; |
1598 | 1598 |
1599 ServerContextManagerCallbacks(this.analysisServer, this.resourceProvider); | 1599 ServerContextManagerCallbacks(this.analysisServer, this.resourceProvider); |
1600 | 1600 |
1601 @override | 1601 @override |
1602 AnalysisContext addContext(Folder folder, AnalysisOptions options) { | 1602 AnalysisContext addContext(Folder folder, AnalysisOptions options) { |
1603 ContextBuilder builder = createContextBuilder(folder, options); | 1603 ContextBuilder builder = createContextBuilder(folder, options); |
1604 AnalysisContext context = builder.buildContext(folder.path); | 1604 AnalysisContext context = builder.buildContext(folder.path); |
1605 | 1605 |
1606 // TODO(brianwilkerson) Move bundle discovery into ContextBuilder | |
1607 if (analysisServer.options.enablePubSummaryManager) { | |
1608 List<LinkedPubPackage> linkedBundles = | |
1609 analysisServer.pubSummaryManager.getLinkedBundles(context); | |
1610 if (linkedBundles.isNotEmpty) { | |
1611 SummaryDataStore store = new SummaryDataStore([]); | |
1612 for (LinkedPubPackage package in linkedBundles) { | |
1613 store.addBundle(null, package.unlinked); | |
1614 store.addBundle(null, package.linked); | |
1615 } | |
1616 (context as InternalAnalysisContext).resultProvider = | |
1617 new InputPackagesResultProvider(context, store); | |
1618 } | |
1619 } | |
1620 | |
1621 analysisServer.folderMap[folder] = context; | 1606 analysisServer.folderMap[folder] = context; |
1622 analysisServer._onContextsChangedController | 1607 analysisServer._onContextsChangedController |
1623 .add(new ContextsChangedEvent(added: [context])); | 1608 .add(new ContextsChangedEvent(added: [context])); |
1624 analysisServer.schedulePerformAnalysisOperation(context); | 1609 analysisServer.schedulePerformAnalysisOperation(context); |
1625 | 1610 |
1626 return context; | 1611 return context; |
1627 } | 1612 } |
1628 | 1613 |
1629 @override | 1614 @override |
1630 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { | 1615 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { |
(...skipping 30 matching lines...) Expand all Loading... |
1661 } | 1646 } |
1662 } | 1647 } |
1663 | 1648 |
1664 ContextBuilder builder = new ContextBuilder(resourceProvider, | 1649 ContextBuilder builder = new ContextBuilder(resourceProvider, |
1665 analysisServer.sdkManager, analysisServer.overlayState); | 1650 analysisServer.sdkManager, analysisServer.overlayState); |
1666 builder.defaultOptions = options; | 1651 builder.defaultOptions = options; |
1667 builder.fileResolverProvider = analysisServer.fileResolverProvider; | 1652 builder.fileResolverProvider = analysisServer.fileResolverProvider; |
1668 builder.packageResolverProvider = analysisServer.packageResolverProvider; | 1653 builder.packageResolverProvider = analysisServer.packageResolverProvider; |
1669 builder.defaultPackageFilePath = defaultPackageFilePath; | 1654 builder.defaultPackageFilePath = defaultPackageFilePath; |
1670 builder.defaultPackagesDirectoryPath = defaultPackagesDirectoryPath; | 1655 builder.defaultPackagesDirectoryPath = defaultPackagesDirectoryPath; |
| 1656 if (analysisServer.options.enablePubSummaryManager) { |
| 1657 builder.pubSummaryManager = analysisServer.pubSummaryManager; |
| 1658 } |
1671 return builder; | 1659 return builder; |
1672 } | 1660 } |
1673 | 1661 |
1674 @override | 1662 @override |
1675 void moveContext(Folder from, Folder to) { | 1663 void moveContext(Folder from, Folder to) { |
1676 // There is nothing to do. | 1664 // There is nothing to do. |
1677 // This method is mostly for tests. | 1665 // This method is mostly for tests. |
1678 // Context managers manage folders and contexts themselves. | 1666 // Context managers manage folders and contexts themselves. |
1679 } | 1667 } |
1680 | 1668 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 /** | 1781 /** |
1794 * The [PerformanceTag] for time spent in server request handlers. | 1782 * The [PerformanceTag] for time spent in server request handlers. |
1795 */ | 1783 */ |
1796 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1784 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
1797 | 1785 |
1798 /** | 1786 /** |
1799 * The [PerformanceTag] for time spent in split store microtasks. | 1787 * The [PerformanceTag] for time spent in split store microtasks. |
1800 */ | 1788 */ |
1801 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1789 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
1802 } | 1790 } |
OLD | NEW |