Add --frontend-server-starter-path option to flutter run and flutter test (#135038)

This commit is contained in:
Derek Xu
2023-09-21 14:32:35 -04:00
committed by GitHub
parent da1f801fd5
commit c627dbfbc6
18 changed files with 184 additions and 8 deletions

View File

@@ -112,6 +112,7 @@ class FlutterCommandResult {
/// Common flutter command line options.
abstract final class FlutterOptions {
static const String kFrontendServerStarterPath = 'frontend-server-starter-path';
static const String kExtraFrontEndOptions = 'extra-front-end-options';
static const String kExtraGenSnapshotOptions = 'extra-gen-snapshot-options';
static const String kEnableExperiment = 'enable-experiment';
@@ -849,6 +850,18 @@ abstract class FlutterCommand extends Command<void> {
);
}
void usesFrontendServerStarterPathOption({required bool verboseHelp}) {
argParser.addOption(
FlutterOptions.kFrontendServerStarterPath,
help: 'When this value is provided, the frontend server will be started '
'in JIT mode from the specified file, instead of from the AOT '
'snapshot shipped with the Dart SDK. The specified file can either '
'be a Dart source file, or an AppJIT snapshot. This option does '
'not affect web builds.',
hide: !verboseHelp,
);
}
/// Enables support for the hidden options --extra-front-end-options and
/// --extra-gen-snapshot-options.
void usesExtraDartFlagOptions({ required bool verboseHelp }) {
@@ -1239,6 +1252,10 @@ abstract class FlutterCommand extends Command<void> {
? stringArg('flavor')
: null,
trackWidgetCreation: trackWidgetCreation,
frontendServerStarterPath: argParser.options
.containsKey(FlutterOptions.kFrontendServerStarterPath)
? stringArg(FlutterOptions.kFrontendServerStarterPath)
: null,
extraFrontEndOptions: extraFrontEndOptions.isNotEmpty
? extraFrontEndOptions
: null,