Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Side by Side Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 2220703002: Initial implementation of pub summary manager. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rework to better fit actual use. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 import 'package:analyzer/instrumentation/instrumentation.dart'; 30 import 'package:analyzer/instrumentation/instrumentation.dart';
31 import 'package:analyzer/plugin/resolver_provider.dart'; 31 import 'package:analyzer/plugin/resolver_provider.dart';
32 import 'package:analyzer/source/pub_package_map_provider.dart'; 32 import 'package:analyzer/source/pub_package_map_provider.dart';
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/sdk_io.dart';
40 import 'package:analyzer/src/generated/source.dart'; 41 import 'package:analyzer/src/generated/source.dart';
41 import 'package:analyzer/src/generated/source_io.dart'; 42 import 'package:analyzer/src/generated/source_io.dart';
42 import 'package:analyzer/src/generated/utilities_general.dart'; 43 import 'package:analyzer/src/generated/utilities_general.dart';
44 import 'package:analyzer/src/summary/pub_summary.dart';
43 import 'package:analyzer/src/task/dart.dart'; 45 import 'package:analyzer/src/task/dart.dart';
44 import 'package:analyzer/src/util/glob.dart'; 46 import 'package:analyzer/src/util/glob.dart';
45 import 'package:analyzer/task/dart.dart'; 47 import 'package:analyzer/task/dart.dart';
46 import 'package:plugin/plugin.dart'; 48 import 'package:plugin/plugin.dart';
47 import 'package:yaml/yaml.dart'; 49 import 'package:yaml/yaml.dart';
48 50
49 typedef void OptionUpdater(AnalysisOptionsImpl options); 51 typedef void OptionUpdater(AnalysisOptionsImpl options);
50 52
51 /** 53 /**
52 * Enum representing reasons why analysis might be done for a given file. 54 * Enum representing reasons why analysis might be done for a given file.
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 StreamController<ContextsChangedEvent> _onContextsChangedController = 294 StreamController<ContextsChangedEvent> _onContextsChangedController =
293 new StreamController<ContextsChangedEvent>.broadcast(); 295 new StreamController<ContextsChangedEvent>.broadcast();
294 296
295 /** 297 /**
296 * The file resolver provider used to override the way file URI's are 298 * The file resolver provider used to override the way file URI's are
297 * resolved in some contexts. 299 * resolved in some contexts.
298 */ 300 */
299 ResolverProvider fileResolverProvider; 301 ResolverProvider fileResolverProvider;
300 302
301 /** 303 /**
304 * The manager of pub package summaries.
305 */
306 PubSummaryManager pubSummaryManager;
307
308 /**
302 * Initialize a newly created server to receive requests from and send 309 * Initialize a newly created server to receive requests from and send
303 * responses to the given [channel]. 310 * responses to the given [channel].
304 * 311 *
305 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are 312 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are
306 * propagated up the call stack. The default is true to allow analysis 313 * propagated up the call stack. The default is true to allow analysis
307 * exceptions to show up in unit tests, but it should be set to false when 314 * exceptions to show up in unit tests, but it should be set to false when
308 * running a full analysis server. 315 * running a full analysis server.
309 */ 316 */
310 AnalysisServer( 317 AnalysisServer(
311 this.channel, 318 this.channel,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 _onPriorityChangeController = 363 _onPriorityChangeController =
357 new StreamController<PriorityChangeEvent>.broadcast(); 364 new StreamController<PriorityChangeEvent>.broadcast();
358 running = true; 365 running = true;
359 onAnalysisStarted.first.then((_) { 366 onAnalysisStarted.first.then((_) {
360 onAnalysisComplete.then((_) { 367 onAnalysisComplete.then((_) {
361 performanceAfterStartup = new ServerPerformance(); 368 performanceAfterStartup = new ServerPerformance();
362 _performance = performanceAfterStartup; 369 _performance = performanceAfterStartup;
363 }); 370 });
364 }); 371 });
365 _setupIndexInvalidation(); 372 _setupIndexInvalidation();
373 pubSummaryManager = new PubSummaryManager(
374 resourceProvider, DirectoryBasedDartSdk.defaultSdk);
Brian Wilkerson 2016/08/08 14:32:55 Does the SDK selected here matter (there can be mo
scheglov 2016/08/09 03:41:07 Actually we almost don't need any DartSdk. The onl
366 Notification notification = 375 Notification notification =
367 new ServerConnectedParams(VERSION, io.pid).toNotification(); 376 new ServerConnectedParams(VERSION, io.pid).toNotification();
368 channel.sendNotification(notification); 377 channel.sendNotification(notification);
369 channel.listen(handleRequest, onDone: done, onError: error); 378 channel.listen(handleRequest, onDone: done, onError: error);
370 handlers = serverPlugin.createDomains(this); 379 handlers = serverPlugin.createDomains(this);
371 } 380 }
372 381
373 /** 382 /**
374 * Return the [AnalysisContext]s that are being used to analyze the analysis 383 * Return the [AnalysisContext]s that are being used to analyze the analysis
375 * roots. 384 * roots.
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 AnalysisContext addContext( 1596 AnalysisContext addContext(
1588 Folder folder, AnalysisOptions options, FolderDisposition disposition) { 1597 Folder folder, AnalysisOptions options, FolderDisposition disposition) {
1589 InternalAnalysisContext context = 1598 InternalAnalysisContext context =
1590 AnalysisEngine.instance.createAnalysisContext(); 1599 AnalysisEngine.instance.createAnalysisContext();
1591 context.contentCache = analysisServer.overlayState; 1600 context.contentCache = analysisServer.overlayState;
1592 analysisServer.folderMap[folder] = context; 1601 analysisServer.folderMap[folder] = context;
1593 context.fileResolverProvider = analysisServer.fileResolverProvider; 1602 context.fileResolverProvider = analysisServer.fileResolverProvider;
1594 context.sourceFactory = 1603 context.sourceFactory =
1595 _createSourceFactory(context, options, disposition, folder); 1604 _createSourceFactory(context, options, disposition, folder);
1596 context.analysisOptions = options; 1605 context.analysisOptions = options;
1606
1607 // TODO(scheglov) use linked bundles
1608 analysisServer.pubSummaryManager.getLinkedBundles(context);
1609
1597 analysisServer._onContextsChangedController 1610 analysisServer._onContextsChangedController
1598 .add(new ContextsChangedEvent(added: [context])); 1611 .add(new ContextsChangedEvent(added: [context]));
1599 analysisServer.schedulePerformAnalysisOperation(context); 1612 analysisServer.schedulePerformAnalysisOperation(context);
1600 1613
1601 return context; 1614 return context;
1602 } 1615 }
1603 1616
1604 @override 1617 @override
1605 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { 1618 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) {
1606 AnalysisContext context = analysisServer.folderMap[contextFolder]; 1619 AnalysisContext context = analysisServer.folderMap[contextFolder];
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 /** 1804 /**
1792 * The [PerformanceTag] for time spent in server request handlers. 1805 * The [PerformanceTag] for time spent in server request handlers.
1793 */ 1806 */
1794 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); 1807 static PerformanceTag serverRequests = new PerformanceTag('serverRequests');
1795 1808
1796 /** 1809 /**
1797 * The [PerformanceTag] for time spent in split store microtasks. 1810 * The [PerformanceTag] for time spent in split store microtasks.
1798 */ 1811 */
1799 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1812 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1800 } 1813 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/pub_summary.dart » ('j') | pkg/analyzer/lib/src/summary/pub_summary.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698