refactor dartdev deps
Change-Id: I6bf49395abd39bea20acd8bc1c39c8db4fdabaaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403621
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
diff --git a/pkg/dartdev/lib/src/unified_analytics.dart b/pkg/dartdev/lib/src/unified_analytics.dart
index fa115bb..3f17ead 100644
--- a/pkg/dartdev/lib/src/unified_analytics.dart
+++ b/pkg/dartdev/lib/src/unified_analytics.dart
@@ -5,15 +5,14 @@
import 'dart:io';
import 'package:path/path.dart' as path;
-import 'package:telemetry/telemetry.dart' as telemetry show isRunningOnBot;
import 'package:unified_analytics/unified_analytics.dart';
import 'sdk.dart';
const String _dartDirectoryName = '.dart';
-const String analyticsDisabledNoticeMessage =
- 'Analytics reporting disabled. In order to enable it, run: dart --enable-analytics';
+const String analyticsDisabledNoticeMessage = 'Analytics reporting disabled. '
+ 'In order to enable it, run: dart --enable-analytics';
/// Create the `Analytics` instance to be used to report analytics.
Analytics createUnifiedAnalytics({bool disableAnalytics = false}) {
@@ -56,7 +55,7 @@
/// The method used by dartdev to determine if this machine is a bot such as a
/// CI machine.
-bool isBot() => telemetry.isRunningOnBot();
+bool isBot() => _isRunningOnBot();
// Matches file:/, non-ws, /, non-ws, .dart
final RegExp _pathRegex = RegExp(r'file:/\S+/(\S+\.dart)');
@@ -91,3 +90,70 @@
return str;
}
+
+/// Detect whether we're running on a bot / a continuous testing environment.
+///
+/// We should periodically keep this code up to date with:
+/// https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/base/bot_detector.dart#L30
+/// and
+/// https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/reporting/usage.dart#L200.
+bool _isRunningOnBot() {
+ final Map<String, String> env = Platform.environment;
+
+ if (
+ // Explicitly stated to not be a bot.
+ env['BOT'] == 'false'
+ // Set by the IDEs to the IDE name, so a strong signal that this is
+ // not a bot.
+ ||
+ env.containsKey('FLUTTER_HOST')
+ // When set, GA logs to a local file (normally for tests) so we don't
+ // need to filter.
+ ||
+ env.containsKey('FLUTTER_ANALYTICS_LOG_FILE')) {
+ return false;
+ }
+
+ // TODO(jwren): Azure detection -- each call for this detection requires an
+ // http connection, the flutter cli tool captures the result on the first run,
+ // we should consider the same caching here.
+
+ return env.containsKey('BOT')
+ // https://docs.travis-ci.com/user/environment-variables/
+ // Example .travis.yml file:
+ // https://github.com/flutter/devtools/blob/master/.travis.yml
+ ||
+ env['TRAVIS'] == 'true' ||
+ env['CONTINUOUS_INTEGRATION'] == 'true' ||
+ env.containsKey('CI') // Travis and AppVeyor
+
+ // https://www.appveyor.com/docs/environment-variables/
+ ||
+ env.containsKey('APPVEYOR')
+
+ // https://cirrus-ci.org/guide/writing-tasks/#environment-variables
+ ||
+ env.containsKey('CIRRUS_CI')
+
+ // https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
+ ||
+ (env.containsKey('AWS_REGION') && env.containsKey('CODEBUILD_INITIATOR'))
+
+ // https://wiki.jenkins.io/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-belowJenkinsSetEnvironmentVariables
+ ||
+ env.containsKey('JENKINS_URL')
+
+ // https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
+ ||
+ env.containsKey('GITHUB_ACTIONS')
+
+ // Properties on Flutter's Chrome Infra bots.
+ ||
+ env['CHROME_HEADLESS'] == '1' ||
+ env.containsKey('BUILDBOT_BUILDERNAME') ||
+ env.containsKey('SWARMING_TASK_ID')
+
+ // Property when running on borg.
+ ||
+ env.containsKey('BORG_ALLOC_DIR');
+}
diff --git a/pkg/dartdev/pubspec.yaml b/pkg/dartdev/pubspec.yaml
index d9ffef4..77e251d 100644
--- a/pkg/dartdev/pubspec.yaml
+++ b/pkg/dartdev/pubspec.yaml
@@ -31,7 +31,6 @@
native_assets_cli: any
path: any
pub: any
- telemetry: any
unified_analytics: any
vm: any
vm_service: any
diff --git a/pkg/telemetry/lib/crash_reporting.dart b/pkg/telemetry/lib/crash_reporting.dart
index 63be674..1322f55 100644
--- a/pkg/telemetry/lib/crash_reporting.dart
+++ b/pkg/telemetry/lib/crash_reporting.dart
@@ -9,8 +9,8 @@
import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
import 'package:stack_trace/stack_trace.dart';
-import 'package:telemetry/src/pii_regexp.dart';
+import 'src/pii_regexp.dart';
import 'src/utils.dart';
/// Tells crash backend that this is a Dart error (as opposed to, say, Java).
@@ -58,8 +58,8 @@
http.Client? httpClient,
String endpointPath = _crashEndpointPathStaging,
}) : _httpClient = httpClient ?? http.Client(),
- _baseUri = Uri(
- scheme: 'https', host: _crashServerHost, path: endpointPath);
+ _baseUri =
+ Uri(scheme: 'https', host: _crashServerHost, path: endpointPath);
/// Create a new [CrashReportSender] connected to the staging endpoint.
CrashReportSender.staging(
@@ -195,7 +195,7 @@
CrashReportAttachment.string({
required String field,
required String value,
- }) : _field = field,
+ }) : _field = field,
_value = value;
}
diff --git a/pkg/telemetry/lib/telemetry.dart b/pkg/telemetry/lib/telemetry.dart
deleted file mode 100644
index 099d64c..0000000
--- a/pkg/telemetry/lib/telemetry.dart
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:io';
-
-/// Detect whether we're running on a bot or in a continuous testing
-/// environment.
-///
-/// We should periodically keep this code up to date with:
-/// https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/base/bot_detector.dart#L30
-/// and
-/// https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/reporting/usage.dart#L200.
-bool isRunningOnBot() {
- final Map<String, String> env = Platform.environment;
-
- if (
- // Explicitly stated to not be a bot.
- env['BOT'] == 'false'
- // Set by the IDEs to the IDE name, so a strong signal that this is not a bot.
- ||
- env.containsKey('FLUTTER_HOST')
- // When set, GA logs to a local file (normally for tests) so we don't need to filter.
- ||
- env.containsKey('FLUTTER_ANALYTICS_LOG_FILE')) {
- return false;
- }
-
- return env.containsKey('BOT')
- // https://docs.travis-ci.com/user/environment-variables/
- // Example .travis.yml file: https://github.com/flutter/devtools/blob/master/.travis.yml
- ||
- env['TRAVIS'] == 'true' ||
- env['CONTINUOUS_INTEGRATION'] == 'true' ||
- env.containsKey('CI') // Travis and AppVeyor
-
- // https://www.appveyor.com/docs/environment-variables/
- ||
- env.containsKey('APPVEYOR')
-
- // https://cirrus-ci.org/guide/writing-tasks/#environment-variables
- ||
- env.containsKey('CIRRUS_CI')
-
- // https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
- ||
- (env.containsKey('AWS_REGION') && env.containsKey('CODEBUILD_INITIATOR'))
-
- // https://wiki.jenkins.io/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-belowJenkinsSetEnvironmentVariables
- ||
- env.containsKey('JENKINS_URL')
-
- // https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
- ||
- env.containsKey('GITHUB_ACTIONS')
-
- // Properties on Flutter's Chrome Infra bots.
- ||
- env['CHROME_HEADLESS'] == '1' ||
- env.containsKey('BUILDBOT_BUILDERNAME') ||
- env.containsKey('SWARMING_TASK_ID')
-
- // Property when running on borg.
- ||
- env.containsKey('BORG_ALLOC_DIR');
-
- // TODO(jwren): Azure detection -- each call for this detection requires an
- // http connection, the flutter cli tool captures the result on the first
- // run, we should consider the same caching here.
-}
diff --git a/pkg/telemetry/pubspec.yaml b/pkg/telemetry/pubspec.yaml
index 757d044..8947f05 100644
--- a/pkg/telemetry/pubspec.yaml
+++ b/pkg/telemetry/pubspec.yaml
@@ -14,4 +14,5 @@
# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
+ lints: any
test: any