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

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

Issue 3003783002: Put the analytics UI behind a flag. (Closed)
Patch Set: Created 3 years, 3 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_cli/lib/src/options.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/server/diagnostic_server.dart'; 10 import 'package:analysis_server/src/server/diagnostic_server.dart';
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 analytics.setSessionValue('aiid', analysisServerOptions.clientId); 313 analytics.setSessionValue('aiid', analysisServerOptions.clientId);
314 } 314 }
315 if (analysisServerOptions.clientVersion != null) { 315 if (analysisServerOptions.clientVersion != null) {
316 analytics.setSessionValue('cd1', analysisServerOptions.clientVersion); 316 analytics.setSessionValue('cd1', analysisServerOptions.clientVersion);
317 } 317 }
318 318
319 // TODO(devoncarew): Replace with the real crash product ID. 319 // TODO(devoncarew): Replace with the real crash product ID.
320 analysisServerOptions.crashReportSender = 320 analysisServerOptions.crashReportSender =
321 new CrashReportSender('Dart_analysis_server', analytics); 321 new CrashReportSender('Dart_analysis_server', analytics);
322 322
323 if (results.wasParsed(ANALYTICS_FLAG)) { 323 if (telemetry.SHOW_ANALYTICS_UI) {
324 analytics.enabled = results[ANALYTICS_FLAG]; 324 if (results.wasParsed(ANALYTICS_FLAG)) {
325 print(telemetry.createAnalyticsStatusMessage(analytics.enabled)); 325 analytics.enabled = results[ANALYTICS_FLAG];
326 return null; 326 print(telemetry.createAnalyticsStatusMessage(analytics.enabled));
327 return null;
328 }
327 } 329 }
328 330
329 if (results[DARTPAD_OPTION]) { 331 if (results[DARTPAD_OPTION]) {
330 UriContributor.suggestFilePaths = false; 332 UriContributor.suggestFilePaths = false;
331 } 333 }
332 334
333 if (results[HELP_OPTION]) { 335 if (results[HELP_OPTION]) {
334 _printUsage(parser.parser, analytics, fromHelp: true); 336 _printUsage(parser.parser, analytics, fromHelp: true);
335 return null; 337 return null;
336 } 338 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 defaultsTo: false, 490 defaultsTo: false,
489 negatable: false); 491 negatable: false);
490 parser.addOption(INSTRUMENTATION_LOG_FILE, 492 parser.addOption(INSTRUMENTATION_LOG_FILE,
491 help: "write instrumentation data to the given file"); 493 help: "write instrumentation data to the given file");
492 parser.addFlag(INTERNAL_PRINT_TO_CONSOLE, 494 parser.addFlag(INTERNAL_PRINT_TO_CONSOLE,
493 help: "enable sending `print` output to the console", 495 help: "enable sending `print` output to the console",
494 defaultsTo: false, 496 defaultsTo: false,
495 negatable: false); 497 negatable: false);
496 parser.addOption(NEW_ANALYSIS_DRIVER_LOG, 498 parser.addOption(NEW_ANALYSIS_DRIVER_LOG,
497 help: "set a destination for the new analysis driver's log"); 499 help: "set a destination for the new analysis driver's log");
498 parser.addFlag(ANALYTICS_FLAG, 500 if (telemetry.SHOW_ANALYTICS_UI) {
499 help: 'enable or disable sending analytics information to Google'); 501 parser.addFlag(ANALYTICS_FLAG,
502 help: 'enable or disable sending analytics information to Google');
503 }
500 parser.addFlag(SUPPRESS_ANALYTICS_FLAG, 504 parser.addFlag(SUPPRESS_ANALYTICS_FLAG,
501 negatable: false, help: 'suppress analytics for this session'); 505 negatable: false, help: 'suppress analytics for this session');
502 parser.addOption(PORT_OPTION, 506 parser.addOption(PORT_OPTION,
503 help: "the http diagnostic port on which the server provides" 507 help: "the http diagnostic port on which the server provides"
504 " status and performance information"); 508 " status and performance information");
505 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); 509 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk");
506 parser.addFlag(USE_ANALYSIS_HIGHLIGHT2, 510 parser.addFlag(USE_ANALYSIS_HIGHLIGHT2,
507 help: "enable version 2 of semantic highlight", 511 help: "enable version 2 of semantic highlight",
508 defaultsTo: false, 512 defaultsTo: false,
509 negatable: false); 513 negatable: false);
(...skipping 24 matching lines...) Expand all
534 /** 538 /**
535 * Print information about how to use the server. 539 * Print information about how to use the server.
536 */ 540 */
537 void _printUsage(ArgParser parser, telemetry.Analytics analytics, 541 void _printUsage(ArgParser parser, telemetry.Analytics analytics,
538 {bool fromHelp: false}) { 542 {bool fromHelp: false}) {
539 print('Usage: $BINARY_NAME [flags]'); 543 print('Usage: $BINARY_NAME [flags]');
540 print(''); 544 print('');
541 print('Supported flags are:'); 545 print('Supported flags are:');
542 print(parser.usage); 546 print(parser.usage);
543 547
544 // Print analytics status and information. 548 if (telemetry.SHOW_ANALYTICS_UI) {
545 if (fromHelp) { 549 // Print analytics status and information.
550 if (fromHelp) {
551 print('');
552 print(telemetry.analyticsNotice);
553 }
546 print(''); 554 print('');
547 print(telemetry.analyticsNotice); 555 print(telemetry.createAnalyticsStatusMessage(analytics.enabled,
556 command: ANALYTICS_FLAG));
548 } 557 }
549 print('');
550 print(telemetry.createAnalyticsStatusMessage(analytics.enabled,
551 command: ANALYTICS_FLAG));
552 } 558 }
553 559
554 /** 560 /**
555 * Read the UUID from disk, generating and storing a new one if necessary. 561 * Read the UUID from disk, generating and storing a new one if necessary.
556 */ 562 */
557 String _readUuid(InstrumentationService service) { 563 String _readUuid(InstrumentationService service) {
558 File uuidFile = new File(PhysicalResourceProvider.INSTANCE 564 File uuidFile = new File(PhysicalResourceProvider.INSTANCE
559 .getStateLocation('.instrumentation') 565 .getStateLocation('.instrumentation')
560 .getChild('uuid.txt') 566 .getChild('uuid.txt')
561 .path); 567 .path);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 614
609 _DiagnosticServerImpl(); 615 _DiagnosticServerImpl();
610 616
611 @override 617 @override
612 Future<int> getServerPort() => httpServer.serveHttp(); 618 Future<int> getServerPort() => httpServer.serveHttp();
613 619
614 Future startOnPort(int port) { 620 Future startOnPort(int port) {
615 return httpServer.serveHttp(port); 621 return httpServer.serveHttp(port);
616 } 622 }
617 } 623 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer_cli/lib/src/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698