Add mirror overrides to doctor output (#56928)
This commit is contained in:
@@ -22,6 +22,8 @@ class UserMessages {
|
|||||||
'Framework revision $revision ($age), $date';
|
'Framework revision $revision ($age), $date';
|
||||||
String engineRevision(String revision) => 'Engine revision $revision';
|
String engineRevision(String revision) => 'Engine revision $revision';
|
||||||
String dartRevision(String revision) => 'Dart version $revision';
|
String dartRevision(String revision) => 'Dart version $revision';
|
||||||
|
String pubMirrorURL(String url) => 'Pub download mirror $url';
|
||||||
|
String flutterMirrorURL(String url) => 'Flutter download mirror $url';
|
||||||
String get flutterBinariesDoNotRun =>
|
String get flutterBinariesDoNotRun =>
|
||||||
'Downloaded executables cannot execute on host.\n'
|
'Downloaded executables cannot execute on host.\n'
|
||||||
'See https://github.com/flutter/flutter/issues/6207 for more information';
|
'See https://github.com/flutter/flutter/issues/6207 for more information';
|
||||||
|
|||||||
@@ -642,6 +642,12 @@ class FlutterValidator extends DoctorValidator {
|
|||||||
)));
|
)));
|
||||||
messages.add(ValidationMessage(userMessages.engineRevision(version.engineRevisionShort)));
|
messages.add(ValidationMessage(userMessages.engineRevision(version.engineRevisionShort)));
|
||||||
messages.add(ValidationMessage(userMessages.dartRevision(version.dartSdkVersion)));
|
messages.add(ValidationMessage(userMessages.dartRevision(version.dartSdkVersion)));
|
||||||
|
if (globals.platform.environment.containsKey('PUB_HOSTED_URL')) {
|
||||||
|
messages.add(ValidationMessage(userMessages.pubMirrorURL(globals.platform.environment['PUB_HOSTED_URL'])));
|
||||||
|
}
|
||||||
|
if (globals.platform.environment.containsKey('FLUTTER_STORAGE_BASE_URL')) {
|
||||||
|
messages.add(ValidationMessage(userMessages.flutterMirrorURL(globals.platform.environment['FLUTTER_STORAGE_BASE_URL'])));
|
||||||
|
}
|
||||||
} on VersionCheckError catch (e) {
|
} on VersionCheckError catch (e) {
|
||||||
messages.add(ValidationMessage.error(e.message));
|
messages.add(ValidationMessage.error(e.message));
|
||||||
valid = ValidationType.partial;
|
valid = ValidationType.partial;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import '../../src/testbed.dart';
|
|||||||
|
|
||||||
final Generator _kNoColorOutputPlatform = () => FakePlatform(
|
final Generator _kNoColorOutputPlatform = () => FakePlatform(
|
||||||
localeName: 'en_US.UTF-8',
|
localeName: 'en_US.UTF-8',
|
||||||
|
environment: <String, String>{},
|
||||||
stdoutSupportsAnsi: false,
|
stdoutSupportsAnsi: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -588,6 +589,24 @@ void main() {
|
|||||||
Platform: _kNoColorOutputPlatform,
|
Platform: _kNoColorOutputPlatform,
|
||||||
FlutterVersion: () => mockFlutterVersion,
|
FlutterVersion: () => mockFlutterVersion,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('shows mirrors', () async {
|
||||||
|
(globals.platform as FakePlatform).environment = <String, String>{
|
||||||
|
'PUB_HOSTED_URL': 'https://example.com/pub',
|
||||||
|
'FLUTTER_STORAGE_BASE_URL': 'https://example.com/flutter',
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(await FlutterValidatorDoctor(logger).diagnose(verbose: true), isTrue);
|
||||||
|
expect(logger.statusText, contains('Pub download mirror https://example.com/pub'));
|
||||||
|
expect(logger.statusText, contains('Flutter download mirror https://example.com/flutter'));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
|
FileSystem: () => memoryFileSystem,
|
||||||
|
OutputPreferences: () => OutputPreferences(wrapText: false),
|
||||||
|
ProcessManager: () => mockProcessManager,
|
||||||
|
Platform: _kNoColorOutputPlatform,
|
||||||
|
FlutterVersion: () => mockFlutterVersion,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('validate non-verbose output wrapping', () async {
|
testUsingContext('validate non-verbose output wrapping', () async {
|
||||||
|
|||||||
Reference in New Issue
Block a user