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

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

Issue 2976473003: add analysis server --flutter-repo startup flag (Closed)
Patch Set: address comments Created 3 years, 5 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:io'; 6 import 'dart:io';
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/plugin/server_plugin.dart'; 10 import 'package:analysis_server/src/plugin/server_plugin.dart';
11 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi n.dart'; 11 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi n.dart';
12 import 'package:analysis_server/src/server/diagnostic_server.dart'; 12 import 'package:analysis_server/src/server/diagnostic_server.dart';
13 import 'package:analysis_server/src/server/http_server.dart'; 13 import 'package:analysis_server/src/server/http_server.dart';
14 import 'package:analysis_server/src/server/stdio_server.dart'; 14 import 'package:analysis_server/src/server/stdio_server.dart';
15 import 'package:analysis_server/src/socket_server.dart'; 15 import 'package:analysis_server/src/socket_server.dart';
16 import 'package:analysis_server/starter.dart'; 16 import 'package:analysis_server/starter.dart';
17 import 'package:analyzer/file_system/physical_file_system.dart'; 17 import 'package:analyzer/file_system/physical_file_system.dart';
18 import 'package:analyzer/instrumentation/file_instrumentation.dart'; 18 import 'package:analyzer/instrumentation/file_instrumentation.dart';
19 import 'package:analyzer/instrumentation/instrumentation.dart'; 19 import 'package:analyzer/instrumentation/instrumentation.dart';
20 import 'package:analyzer/plugin/resolver_provider.dart'; 20 import 'package:analyzer/plugin/resolver_provider.dart';
21 import 'package:analyzer/src/context/builder.dart';
21 import 'package:analyzer/src/dart/sdk/sdk.dart'; 22 import 'package:analyzer/src/dart/sdk/sdk.dart';
22 import 'package:analyzer/src/generated/engine.dart'; 23 import 'package:analyzer/src/generated/engine.dart';
23 import 'package:analyzer/src/generated/sdk.dart'; 24 import 'package:analyzer/src/generated/sdk.dart';
24 import 'package:args/args.dart'; 25 import 'package:args/args.dart';
25 import 'package:linter/src/rules.dart' as linter; 26 import 'package:linter/src/rules.dart' as linter;
26 import 'package:plugin/manager.dart'; 27 import 'package:plugin/manager.dart';
27 import 'package:plugin/plugin.dart'; 28 import 'package:plugin/plugin.dart';
28 import 'package:telemetry/crash_reporting.dart'; 29 import 'package:telemetry/crash_reporting.dart';
29 import 'package:telemetry/telemetry.dart' as telemetry; 30 import 'package:telemetry/telemetry.dart' as telemetry;
30 31
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 * The name of the option used to enable instrumentation. 190 * The name of the option used to enable instrumentation.
190 */ 191 */
191 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; 192 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation";
192 193
193 /** 194 /**
194 * The name of the option used to set the file read mode. 195 * The name of the option used to set the file read mode.
195 */ 196 */
196 static const String FILE_READ_MODE = "file-read-mode"; 197 static const String FILE_READ_MODE = "file-read-mode";
197 198
198 /** 199 /**
200 * The name of the flag used when analyzing the flutter repository.
201 * See comments in source for `flutter analyze --watch`.
202 */
203 static const FLUTTER_REPO = "flutter-repo";
204
205 /**
199 * The name of the option used to print usage information. 206 * The name of the option used to print usage information.
200 */ 207 */
201 static const String HELP_OPTION = "help"; 208 static const String HELP_OPTION = "help";
202 209
203 /** 210 /**
204 * The name of the flag used to configure reporting analytics. 211 * The name of the flag used to configure reporting analytics.
205 */ 212 */
206 static const String ANALYTICS_FLAG = "analytics"; 213 static const String ANALYTICS_FLAG = "analytics";
207 214
208 /** 215 /**
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 analysisServerOptions.useAnalysisHighlight2 = 310 analysisServerOptions.useAnalysisHighlight2 =
304 results[USE_ANALYSIS_HIGHLIGHT2]; 311 results[USE_ANALYSIS_HIGHLIGHT2];
305 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; 312 analysisServerOptions.fileReadMode = results[FILE_READ_MODE];
306 analysisServerOptions.newAnalysisDriverLog = 313 analysisServerOptions.newAnalysisDriverLog =
307 results[NEW_ANALYSIS_DRIVER_LOG]; 314 results[NEW_ANALYSIS_DRIVER_LOG];
308 analysisServerOptions.clientId = results[CLIENT_ID]; 315 analysisServerOptions.clientId = results[CLIENT_ID];
309 analysisServerOptions.clientVersion = results[CLIENT_VERSION]; 316 analysisServerOptions.clientVersion = results[CLIENT_VERSION];
310 analysisServerOptions.enableVerboseFlutterCompletions = 317 analysisServerOptions.enableVerboseFlutterCompletions =
311 results[VERBOSE_FLUTTER_COMPLETIONS]; 318 results[VERBOSE_FLUTTER_COMPLETIONS];
312 319
320 ContextBuilderOptions.flutterRepo = results[FLUTTER_REPO];
321
313 telemetry.Analytics analytics = telemetry.createAnalyticsInstance( 322 telemetry.Analytics analytics = telemetry.createAnalyticsInstance(
314 'UA-26406144-29', 'analysis-server', 323 'UA-26406144-29', 'analysis-server',
315 disableForSession: results[SUPPRESS_ANALYTICS_FLAG]); 324 disableForSession: results[SUPPRESS_ANALYTICS_FLAG]);
316 analysisServerOptions.analytics = analytics; 325 analysisServerOptions.analytics = analytics;
317 326
318 if (analysisServerOptions.clientId != null) { 327 if (analysisServerOptions.clientId != null) {
319 // Record the client name as the application installer ID. 328 // Record the client name as the application installer ID.
320 analytics.setSessionValue('aiid', analysisServerOptions.clientId); 329 analytics.setSessionValue('aiid', analysisServerOptions.clientId);
321 } 330 }
322 if (analysisServerOptions.clientVersion != null) { 331 if (analysisServerOptions.clientVersion != null) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 CommandLineParser _createArgParser() { 487 CommandLineParser _createArgParser() {
479 CommandLineParser parser = 488 CommandLineParser parser =
480 new CommandLineParser(alwaysIgnoreUnrecognized: true); 489 new CommandLineParser(alwaysIgnoreUnrecognized: true);
481 parser.addOption(CLIENT_ID, 490 parser.addOption(CLIENT_ID,
482 help: "an identifier used to identify the client"); 491 help: "an identifier used to identify the client");
483 parser.addOption(CLIENT_VERSION, help: "the version of the client"); 492 parser.addOption(CLIENT_VERSION, help: "the version of the client");
484 parser.addFlag(ENABLE_INSTRUMENTATION_OPTION, 493 parser.addFlag(ENABLE_INSTRUMENTATION_OPTION,
485 help: "enable sending instrumentation information to a server", 494 help: "enable sending instrumentation information to a server",
486 defaultsTo: false, 495 defaultsTo: false,
487 negatable: false); 496 negatable: false);
497 parser.addFlag(FLUTTER_REPO,
498 help: 'used by "flutter analyze" to enable specific lints'
499 ' when analyzing the flutter repository',
500 hide: false);
488 parser.addFlag(HELP_OPTION, 501 parser.addFlag(HELP_OPTION,
489 help: "print this help message without starting a server", 502 help: "print this help message without starting a server",
490 abbr: 'h', 503 abbr: 'h',
491 defaultsTo: false, 504 defaultsTo: false,
492 negatable: false); 505 negatable: false);
493 parser.addOption(INSTRUMENTATION_LOG_FILE, 506 parser.addOption(INSTRUMENTATION_LOG_FILE,
494 help: "write instrumentation data to the given file"); 507 help: "write instrumentation data to the given file");
495 parser.addFlag(INTERNAL_PRINT_TO_CONSOLE, 508 parser.addFlag(INTERNAL_PRINT_TO_CONSOLE,
496 help: "enable sending `print` output to the console", 509 help: "enable sending `print` output to the console",
497 defaultsTo: false, 510 defaultsTo: false,
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 626
614 _DiagnosticServerImpl(); 627 _DiagnosticServerImpl();
615 628
616 @override 629 @override
617 Future<int> getServerPort() => httpServer.serveHttp(); 630 Future<int> getServerPort() => httpServer.serveHttp();
618 631
619 Future startOnPort(int port) { 632 Future startOnPort(int port) {
620 return httpServer.serveHttp(port); 633 return httpServer.serveHttp(port);
621 } 634 }
622 } 635 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698