mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:10:22 +00:00
Put the analytics UI behind a flag.
BUG= R=brianwilkerson@google.com Review-Url: https://codereview.chromium.org/3003783002 .
This commit is contained in:
parent
6d5a29004c
commit
13346cab3d
|
@ -320,10 +320,12 @@ class Driver implements ServerStarter {
|
|||
analysisServerOptions.crashReportSender =
|
||||
new CrashReportSender('Dart_analysis_server', analytics);
|
||||
|
||||
if (results.wasParsed(ANALYTICS_FLAG)) {
|
||||
analytics.enabled = results[ANALYTICS_FLAG];
|
||||
print(telemetry.createAnalyticsStatusMessage(analytics.enabled));
|
||||
return null;
|
||||
if (telemetry.SHOW_ANALYTICS_UI) {
|
||||
if (results.wasParsed(ANALYTICS_FLAG)) {
|
||||
analytics.enabled = results[ANALYTICS_FLAG];
|
||||
print(telemetry.createAnalyticsStatusMessage(analytics.enabled));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (results[DARTPAD_OPTION]) {
|
||||
|
@ -495,8 +497,10 @@ class Driver implements ServerStarter {
|
|||
negatable: false);
|
||||
parser.addOption(NEW_ANALYSIS_DRIVER_LOG,
|
||||
help: "set a destination for the new analysis driver's log");
|
||||
parser.addFlag(ANALYTICS_FLAG,
|
||||
help: 'enable or disable sending analytics information to Google');
|
||||
if (telemetry.SHOW_ANALYTICS_UI) {
|
||||
parser.addFlag(ANALYTICS_FLAG,
|
||||
help: 'enable or disable sending analytics information to Google');
|
||||
}
|
||||
parser.addFlag(SUPPRESS_ANALYTICS_FLAG,
|
||||
negatable: false, help: 'suppress analytics for this session');
|
||||
parser.addOption(PORT_OPTION,
|
||||
|
@ -541,14 +545,16 @@ class Driver implements ServerStarter {
|
|||
print('Supported flags are:');
|
||||
print(parser.usage);
|
||||
|
||||
// Print analytics status and information.
|
||||
if (fromHelp) {
|
||||
if (telemetry.SHOW_ANALYTICS_UI) {
|
||||
// Print analytics status and information.
|
||||
if (fromHelp) {
|
||||
print('');
|
||||
print(telemetry.analyticsNotice);
|
||||
}
|
||||
print('');
|
||||
print(telemetry.analyticsNotice);
|
||||
print(telemetry.createAnalyticsStatusMessage(analytics.enabled,
|
||||
command: ANALYTICS_FLAG));
|
||||
}
|
||||
print('');
|
||||
print(telemetry.createAnalyticsStatusMessage(analytics.enabled,
|
||||
command: ANALYTICS_FLAG));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -349,8 +349,6 @@ class CommandLineOptions {
|
|||
help: 'Treat non-type warnings as fatal.',
|
||||
defaultsTo: false,
|
||||
negatable: false)
|
||||
..addFlag('analytics',
|
||||
help: 'Enable or disable sending analytics information to Google.')
|
||||
..addFlag('help',
|
||||
abbr: 'h',
|
||||
help:
|
||||
|
@ -363,6 +361,11 @@ class CommandLineOptions {
|
|||
help: 'Verbose output.',
|
||||
negatable: false);
|
||||
|
||||
if (telemetry.SHOW_ANALYTICS_UI) {
|
||||
parser.addFlag('analytics',
|
||||
help: 'Enable or disable sending analytics information to Google.');
|
||||
}
|
||||
|
||||
// Build mode options.
|
||||
if (!hide) {
|
||||
parser.addSeparator('Build mode flags:');
|
||||
|
@ -534,12 +537,14 @@ class CommandLineOptions {
|
|||
}
|
||||
|
||||
// Enable / disable analytics.
|
||||
if (results.wasParsed('analytics')) {
|
||||
analytics.enabled = results['analytics'];
|
||||
outSink
|
||||
.writeln(telemetry.createAnalyticsStatusMessage(analytics.enabled));
|
||||
exitHandler(0);
|
||||
return null; // Only reachable in testing.
|
||||
if (telemetry.SHOW_ANALYTICS_UI) {
|
||||
if (results.wasParsed('analytics')) {
|
||||
analytics.enabled = results['analytics'];
|
||||
outSink.writeln(
|
||||
telemetry.createAnalyticsStatusMessage(analytics.enabled));
|
||||
exitHandler(0);
|
||||
return null; // Only reachable in testing.
|
||||
}
|
||||
}
|
||||
|
||||
// Batch mode and input files.
|
||||
|
@ -581,6 +586,10 @@ class CommandLineOptions {
|
|||
static _showUsage(ArgParser parser, telemetry.Analytics analytics,
|
||||
{bool fromHelp: false}) {
|
||||
void printAnalyticsInfo() {
|
||||
if (!telemetry.SHOW_ANALYTICS_UI) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fromHelp) {
|
||||
errorSink.writeln('');
|
||||
errorSink.writeln(telemetry.analyticsNotice);
|
||||
|
|
|
@ -16,6 +16,9 @@ export 'package:usage/usage.dart' show Analytics;
|
|||
// TODO(devoncarew): Hard-coded to off for now. Remove when we're ready to ship.
|
||||
final bool _HARD_CODE_OFF = true;
|
||||
|
||||
// TODO(devoncarew): Don't show the UI until we're ready to ship.
|
||||
final bool SHOW_ANALYTICS_UI = false;
|
||||
|
||||
final String _dartDirectoryName = '.dart';
|
||||
final String _settingsFileName = 'analytics.json';
|
||||
|
||||
|
|
Loading…
Reference in a new issue