| 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 22 matching lines...) Expand all Loading... |
| 33 import 'package:analyzer/src/context/builder.dart'; | 33 import 'package:analyzer/src/context/builder.dart'; |
| 34 import 'package:analyzer/src/dart/ast/utilities.dart'; | 34 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| 35 import 'package:analyzer/src/dart/sdk/sdk.dart'; | 35 import 'package:analyzer/src/dart/sdk/sdk.dart'; |
| 36 import 'package:analyzer/src/generated/engine.dart'; | 36 import 'package:analyzer/src/generated/engine.dart'; |
| 37 import 'package:analyzer/src/generated/java_engine.dart'; | 37 import 'package:analyzer/src/generated/java_engine.dart'; |
| 38 import 'package:analyzer/src/generated/java_io.dart'; | 38 import 'package:analyzer/src/generated/java_io.dart'; |
| 39 import 'package:analyzer/src/generated/sdk.dart'; | 39 import 'package:analyzer/src/generated/sdk.dart'; |
| 40 import 'package:analyzer/src/generated/source.dart'; | 40 import 'package:analyzer/src/generated/source.dart'; |
| 41 import 'package:analyzer/src/generated/source_io.dart'; | 41 import 'package:analyzer/src/generated/source_io.dart'; |
| 42 import 'package:analyzer/src/generated/utilities_general.dart'; | 42 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 43 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
| 43 import 'package:analyzer/src/summary/pub_summary.dart'; | 44 import 'package:analyzer/src/summary/pub_summary.dart'; |
| 44 import 'package:analyzer/src/task/dart.dart'; | 45 import 'package:analyzer/src/task/dart.dart'; |
| 45 import 'package:analyzer/src/util/glob.dart'; | 46 import 'package:analyzer/src/util/glob.dart'; |
| 46 import 'package:analyzer/task/dart.dart'; | 47 import 'package:analyzer/task/dart.dart'; |
| 47 import 'package:plugin/plugin.dart'; | 48 import 'package:plugin/plugin.dart'; |
| 48 import 'package:yaml/yaml.dart'; | 49 import 'package:yaml/yaml.dart'; |
| 49 | 50 |
| 50 typedef void OptionUpdater(AnalysisOptionsImpl options); | 51 typedef void OptionUpdater(AnalysisOptionsImpl options); |
| 51 | 52 |
| 52 /** | 53 /** |
| (...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 for (AnalysisContext context in event.removed) { | 1538 for (AnalysisContext context in event.removed) { |
| 1538 index.removeContext(context); | 1539 index.removeContext(context); |
| 1539 } | 1540 } |
| 1540 }); | 1541 }); |
| 1541 } | 1542 } |
| 1542 } | 1543 } |
| 1543 | 1544 |
| 1544 class AnalysisServerOptions { | 1545 class AnalysisServerOptions { |
| 1545 bool enableIncrementalResolutionApi = false; | 1546 bool enableIncrementalResolutionApi = false; |
| 1546 bool enableIncrementalResolutionValidation = false; | 1547 bool enableIncrementalResolutionValidation = false; |
| 1548 bool enablePubSummaryManager = false; |
| 1547 bool finerGrainedInvalidation = false; | 1549 bool finerGrainedInvalidation = false; |
| 1548 bool noErrorNotification = false; | 1550 bool noErrorNotification = false; |
| 1549 bool noIndex = false; | 1551 bool noIndex = false; |
| 1550 bool useAnalysisHighlight2 = false; | 1552 bool useAnalysisHighlight2 = false; |
| 1551 String fileReadMode = 'as-is'; | 1553 String fileReadMode = 'as-is'; |
| 1552 } | 1554 } |
| 1553 | 1555 |
| 1554 /** | 1556 /** |
| 1555 * Information about a file - an [AnalysisContext] that analyses the file, | 1557 * Information about a file - an [AnalysisContext] that analyses the file, |
| 1556 * and the [Source] representing the file in this context. | 1558 * and the [Source] representing the file in this context. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 Folder folder, AnalysisOptions options, FolderDisposition disposition) { | 1598 Folder folder, AnalysisOptions options, FolderDisposition disposition) { |
| 1597 InternalAnalysisContext context = | 1599 InternalAnalysisContext context = |
| 1598 AnalysisEngine.instance.createAnalysisContext(); | 1600 AnalysisEngine.instance.createAnalysisContext(); |
| 1599 context.contentCache = analysisServer.overlayState; | 1601 context.contentCache = analysisServer.overlayState; |
| 1600 analysisServer.folderMap[folder] = context; | 1602 analysisServer.folderMap[folder] = context; |
| 1601 context.fileResolverProvider = analysisServer.fileResolverProvider; | 1603 context.fileResolverProvider = analysisServer.fileResolverProvider; |
| 1602 context.sourceFactory = | 1604 context.sourceFactory = |
| 1603 _createSourceFactory(context, options, disposition, folder); | 1605 _createSourceFactory(context, options, disposition, folder); |
| 1604 context.analysisOptions = options; | 1606 context.analysisOptions = options; |
| 1605 | 1607 |
| 1606 // TODO(scheglov) use linked bundles | 1608 if (analysisServer.options.enablePubSummaryManager) { |
| 1607 // analysisServer.pubSummaryManager.getLinkedBundles(context); | 1609 List<LinkedPubPackage> linkedBundles = |
| 1610 analysisServer.pubSummaryManager.getLinkedBundles(context); |
| 1611 if (linkedBundles.isNotEmpty) { |
| 1612 SummaryDataStore store = new SummaryDataStore([]); |
| 1613 for (LinkedPubPackage package in linkedBundles) { |
| 1614 store.addBundle(null, package.unlinked); |
| 1615 store.addBundle(null, package.linked); |
| 1616 } |
| 1617 context.resultProvider = |
| 1618 new InputPackagesResultProvider(context, store); |
| 1619 } |
| 1620 } |
| 1608 | 1621 |
| 1609 analysisServer._onContextsChangedController | 1622 analysisServer._onContextsChangedController |
| 1610 .add(new ContextsChangedEvent(added: [context])); | 1623 .add(new ContextsChangedEvent(added: [context])); |
| 1611 analysisServer.schedulePerformAnalysisOperation(context); | 1624 analysisServer.schedulePerformAnalysisOperation(context); |
| 1612 | 1625 |
| 1613 return context; | 1626 return context; |
| 1614 } | 1627 } |
| 1615 | 1628 |
| 1616 @override | 1629 @override |
| 1617 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { | 1630 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 /** | 1816 /** |
| 1804 * The [PerformanceTag] for time spent in server request handlers. | 1817 * The [PerformanceTag] for time spent in server request handlers. |
| 1805 */ | 1818 */ |
| 1806 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1819 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1807 | 1820 |
| 1808 /** | 1821 /** |
| 1809 * The [PerformanceTag] for time spent in split store microtasks. | 1822 * The [PerformanceTag] for time spent in split store microtasks. |
| 1810 */ | 1823 */ |
| 1811 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1824 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1812 } | 1825 } |
| OLD | NEW |