mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

This auto-formats all *.dart files in the repository outside of the `engine` subdirectory and enforces that these files stay formatted with a presubmit check. **Reviewers:** Please carefully review all the commits except for the one titled "formatted". The "formatted" commit was auto-generated by running `dev/tools/format.sh -a -f`. The other commits were hand-crafted to prepare the repo for the formatting change. I recommend reviewing the commits one-by-one via the "Commits" tab and avoiding Github's "Files changed" tab as it will likely slow down your browser because of the size of this PR. --------- Co-authored-by: Kate Lovett <katelovett@google.com> Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
68 lines
2.1 KiB
Dart
68 lines
2.1 KiB
Dart
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import '../android/android_workflow.dart';
|
|
import '../base/common.dart';
|
|
import '../globals.dart' as globals;
|
|
import '../runner/flutter_command.dart';
|
|
|
|
class DoctorCommand extends FlutterCommand {
|
|
DoctorCommand({this.verbose = false}) {
|
|
argParser.addFlag(
|
|
'android-licenses',
|
|
negatable: false,
|
|
help: "Run the Android SDK manager tool to accept the SDK's licenses.",
|
|
);
|
|
argParser.addOption(
|
|
'check-for-remote-artifacts',
|
|
hide: !verbose,
|
|
help:
|
|
'Used to determine if Flutter engine artifacts for all platforms '
|
|
'are available for download.',
|
|
valueHelp: 'engine revision git hash',
|
|
);
|
|
}
|
|
|
|
final bool verbose;
|
|
|
|
@override
|
|
final String name = 'doctor';
|
|
|
|
@override
|
|
final String description = 'Show information about the installed tooling.';
|
|
|
|
@override
|
|
final String category = FlutterCommandCategory.sdk;
|
|
|
|
@override
|
|
Future<FlutterCommandResult> runCommand() async {
|
|
if (argResults?.wasParsed('check-for-remote-artifacts') ?? false) {
|
|
final String engineRevision = stringArg('check-for-remote-artifacts')!;
|
|
if (engineRevision.startsWith(RegExp(r'[a-f0-9]{1,40}'))) {
|
|
final bool success = await globals.doctor?.checkRemoteArtifacts(engineRevision) ?? false;
|
|
if (success) {
|
|
throwToolExit(
|
|
'Artifacts for engine $engineRevision are missing or are '
|
|
'not yet available.',
|
|
exitCode: 1,
|
|
);
|
|
}
|
|
} else {
|
|
throwToolExit(
|
|
'Remote artifact revision $engineRevision is not a valid '
|
|
'git hash.',
|
|
);
|
|
}
|
|
}
|
|
final bool success =
|
|
await globals.doctor?.diagnose(
|
|
androidLicenses: boolArg('android-licenses'),
|
|
verbose: verbose,
|
|
androidLicenseValidator: androidLicenseValidator,
|
|
) ??
|
|
false;
|
|
return FlutterCommandResult(success ? ExitStatus.success : ExitStatus.warning);
|
|
}
|
|
}
|