2019-11-27 15:04:02 -08:00
|
|
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
2015-10-09 23:41:40 -07:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
2015-10-13 13:36:39 -07:00
|
|
|
import 'dart:async';
|
|
|
|
|
|
2017-11-09 21:45:31 -08:00
|
|
|
import 'runner.dart' as runner;
|
2019-02-14 23:17:16 -08:00
|
|
|
import 'src/base/context.dart';
|
|
|
|
|
// The build_runner code generation is provided here to make it easier to
|
|
|
|
|
// avoid introducing the dependency into google3. Not all build* packages
|
|
|
|
|
// are synced internally.
|
|
|
|
|
import 'src/build_runner/build_runner.dart';
|
2019-08-08 16:36:27 -07:00
|
|
|
import 'src/build_runner/resident_web_runner.dart';
|
2019-05-29 22:46:28 -07:00
|
|
|
import 'src/build_runner/web_compilation_delegate.dart';
|
|
|
|
|
|
2019-02-14 23:17:16 -08:00
|
|
|
import 'src/codegen.dart';
|
2015-11-11 10:29:05 -08:00
|
|
|
import 'src/commands/analyze.dart';
|
2019-07-11 16:53:17 -07:00
|
|
|
import 'src/commands/assemble.dart';
|
2018-06-25 15:33:42 +02:00
|
|
|
import 'src/commands/attach.dart';
|
2015-10-09 23:41:40 -07:00
|
|
|
import 'src/commands/build.dart';
|
2016-08-25 15:16:21 -04:00
|
|
|
import 'src/commands/channel.dart';
|
2017-10-19 11:23:42 -07:00
|
|
|
import 'src/commands/clean.dart';
|
2016-04-26 16:25:11 -07:00
|
|
|
import 'src/commands/config.dart';
|
2016-01-27 14:37:29 -08:00
|
|
|
import 'src/commands/create.dart';
|
2015-11-02 13:05:05 -08:00
|
|
|
import 'src/commands/daemon.dart';
|
2016-02-13 23:50:20 -08:00
|
|
|
import 'src/commands/devices.dart';
|
2016-02-16 18:23:43 -08:00
|
|
|
import 'src/commands/doctor.dart';
|
2016-02-19 16:31:34 -08:00
|
|
|
import 'src/commands/drive.dart';
|
2018-04-18 10:48:39 +01:00
|
|
|
import 'src/commands/emulators.dart';
|
2016-08-31 09:40:17 -04:00
|
|
|
import 'src/commands/format.dart';
|
2019-02-14 23:17:16 -08:00
|
|
|
import 'src/commands/generate.dart';
|
2017-11-13 10:55:22 -08:00
|
|
|
import 'src/commands/ide_config.dart';
|
2017-12-13 17:49:54 -08:00
|
|
|
import 'src/commands/inject_plugins.dart';
|
2015-10-09 23:41:40 -07:00
|
|
|
import 'src/commands/install.dart';
|
|
|
|
|
import 'src/commands/logs.dart';
|
2018-09-18 17:58:20 -07:00
|
|
|
import 'src/commands/make_host_app_editable.dart';
|
2016-08-25 22:37:48 -04:00
|
|
|
import 'src/commands/packages.dart';
|
2016-04-08 08:51:44 -07:00
|
|
|
import 'src/commands/precache.dart';
|
2016-02-13 23:50:20 -08:00
|
|
|
import 'src/commands/run.dart';
|
2016-03-25 16:04:22 -07:00
|
|
|
import 'src/commands/screenshot.dart';
|
2018-07-13 21:24:36 -07:00
|
|
|
import 'src/commands/shell_completion.dart';
|
2015-11-04 23:43:15 -08:00
|
|
|
import 'src/commands/test.dart';
|
2019-03-15 19:33:24 -07:00
|
|
|
import 'src/commands/train.dart';
|
2019-05-11 00:08:29 -07:00
|
|
|
import 'src/commands/unpack.dart';
|
2016-02-25 15:29:58 -08:00
|
|
|
import 'src/commands/update_packages.dart';
|
2015-11-12 10:13:40 -08:00
|
|
|
import 'src/commands/upgrade.dart';
|
2019-02-05 03:26:06 +08:00
|
|
|
import 'src/commands/version.dart';
|
2017-03-03 16:54:47 -08:00
|
|
|
import 'src/runner/flutter_command.dart';
|
2019-05-29 22:46:28 -07:00
|
|
|
import 'src/web/compile.dart';
|
2019-08-08 16:36:27 -07:00
|
|
|
import 'src/web/web_runner.dart';
|
2016-11-29 11:22:48 -08:00
|
|
|
|
2015-10-09 23:41:40 -07:00
|
|
|
/// Main entry point for commands.
|
|
|
|
|
///
|
2016-05-19 10:21:38 -07:00
|
|
|
/// This function is intended to be used from the `flutter` command line tool.
|
2018-10-05 07:54:56 +02:00
|
|
|
Future<void> main(List<String> args) async {
|
2017-03-03 17:50:46 -08:00
|
|
|
final bool verbose = args.contains('-v') || args.contains('--verbose');
|
2018-02-01 10:27:55 -08:00
|
|
|
|
|
|
|
|
final bool doctor = (args.isNotEmpty && args.first == 'doctor') ||
|
|
|
|
|
(args.length == 2 && verbose && args.last == 'doctor');
|
2017-03-03 17:50:46 -08:00
|
|
|
final bool help = args.contains('-h') || args.contains('--help') ||
|
2016-09-22 05:58:45 -04:00
|
|
|
(args.isNotEmpty && args.first == 'help') || (args.length == 1 && verbose);
|
2018-02-06 09:00:11 +01:00
|
|
|
final bool muteCommandLogging = help || doctor;
|
2017-03-03 17:50:46 -08:00
|
|
|
final bool verboseHelp = help && verbose;
|
2016-01-29 14:32:12 -08:00
|
|
|
|
2017-11-09 21:45:31 -08:00
|
|
|
await runner.run(args, <FlutterCommand>[
|
2018-09-12 08:29:29 +02:00
|
|
|
AnalyzeCommand(verboseHelp: verboseHelp),
|
2019-07-11 16:53:17 -07:00
|
|
|
AssembleCommand(),
|
2018-09-12 08:29:29 +02:00
|
|
|
AttachCommand(verboseHelp: verboseHelp),
|
|
|
|
|
BuildCommand(verboseHelp: verboseHelp),
|
|
|
|
|
ChannelCommand(verboseHelp: verboseHelp),
|
|
|
|
|
CleanCommand(),
|
|
|
|
|
ConfigCommand(verboseHelp: verboseHelp),
|
2018-10-10 11:01:40 -07:00
|
|
|
CreateCommand(),
|
2018-09-12 08:29:29 +02:00
|
|
|
DaemonCommand(hidden: !verboseHelp),
|
|
|
|
|
DevicesCommand(),
|
|
|
|
|
DoctorCommand(verbose: verbose),
|
|
|
|
|
DriveCommand(),
|
|
|
|
|
EmulatorsCommand(),
|
|
|
|
|
FormatCommand(),
|
2019-02-14 23:17:16 -08:00
|
|
|
GenerateCommand(),
|
2018-09-12 08:29:29 +02:00
|
|
|
IdeConfigCommand(hidden: !verboseHelp),
|
|
|
|
|
InjectPluginsCommand(hidden: !verboseHelp),
|
|
|
|
|
InstallCommand(),
|
|
|
|
|
LogsCommand(),
|
2018-09-18 17:58:20 -07:00
|
|
|
MakeHostAppEditableCommand(),
|
2018-09-12 08:29:29 +02:00
|
|
|
PackagesCommand(),
|
2019-09-17 08:19:33 -07:00
|
|
|
PrecacheCommand(verboseHelp: verboseHelp),
|
2018-09-12 08:29:29 +02:00
|
|
|
RunCommand(verboseHelp: verboseHelp),
|
|
|
|
|
ScreenshotCommand(),
|
|
|
|
|
ShellCompletionCommand(),
|
|
|
|
|
TestCommand(verboseHelp: verboseHelp),
|
2019-03-15 19:33:24 -07:00
|
|
|
TrainingCommand(),
|
2019-05-11 00:08:29 -07:00
|
|
|
UnpackCommand(),
|
2018-09-12 08:29:29 +02:00
|
|
|
UpdatePackagesCommand(hidden: !verboseHelp),
|
|
|
|
|
UpgradeCommand(),
|
2019-02-05 03:26:06 +08:00
|
|
|
VersionCommand(),
|
2018-02-01 10:27:55 -08:00
|
|
|
], verbose: verbose,
|
|
|
|
|
muteCommandLogging: muteCommandLogging,
|
2019-02-14 23:17:16 -08:00
|
|
|
verboseHelp: verboseHelp,
|
|
|
|
|
overrides: <Type, Generator>{
|
|
|
|
|
// The build runner instance is not supported in google3 because
|
|
|
|
|
// the build runner packages are not synced internally.
|
2019-03-21 13:12:10 -07:00
|
|
|
CodeGenerator: () => const BuildRunner(),
|
2019-05-29 22:46:28 -07:00
|
|
|
WebCompilationProxy: () => BuildRunnerWebCompilationProxy(),
|
2019-08-08 16:36:27 -07:00
|
|
|
// The web runner is not supported internally because it depends
|
|
|
|
|
// on dwds.
|
|
|
|
|
WebRunnerFactory: () => DwdsWebRunnerFactory(),
|
2019-02-14 23:17:16 -08:00
|
|
|
});
|
2017-03-03 16:54:47 -08:00
|
|
|
}
|