Unverified Commit d0202131 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] support --extra-gen-snapshot-options everywhere...

[flutter_tools] support --extra-gen-snapshot-options everywhere --extra-front-end-options is specified (#69592)

support --extra-gen-snapshot-options everywhere --extra-front-end-options is specified
parent 406ca0bc
...@@ -10,7 +10,7 @@ import '../resident_runner.dart'; ...@@ -10,7 +10,7 @@ import '../resident_runner.dart';
import '../runner/flutter_command.dart'; import '../runner/flutter_command.dart';
import 'build.dart'; import 'build.dart';
/// Builds AOT snapshots into platform specific library containers. /// Builds AOT executables into platform specific library containers.
class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmentArtifacts { class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmentArtifacts {
BuildAotCommand({this.aotBuilder}) { BuildAotCommand({this.aotBuilder}) {
addTreeShakeIconsFlag(); addTreeShakeIconsFlag();
...@@ -18,7 +18,7 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen ...@@ -18,7 +18,7 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
addBuildModeFlags(); addBuildModeFlags();
usesPubOption(); usesPubOption();
usesDartDefineOption(); usesDartDefineOption();
usesExtraFrontendOptions(); usesExtraDartFlagOptions();
argParser argParser
..addOption('output-dir', defaultsTo: getAotBuildDirectory()) ..addOption('output-dir', defaultsTo: getAotBuildDirectory())
..addOption('target-platform', ..addOption('target-platform',
...@@ -32,10 +32,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen ...@@ -32,10 +32,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
allowed: DarwinArch.values.map<String>(getNameForDarwinArch), allowed: DarwinArch.values.map<String>(getNameForDarwinArch),
help: 'iOS architectures to build.', help: 'iOS architectures to build.',
) )
..addMultiOption(FlutterOptions.kExtraGenSnapshotOptions,
splitCommas: true,
hide: true,
)
..addFlag('bitcode', ..addFlag('bitcode',
defaultsTo: kBitcodeEnabledDefault, defaultsTo: kBitcodeEnabledDefault,
help: 'Build the AOT bundle with bitcode. Requires a compatible bitcode engine.', help: 'Build the AOT bundle with bitcode. Requires a compatible bitcode engine.',
......
...@@ -27,7 +27,7 @@ class BuildApkCommand extends BuildSubCommand { ...@@ -27,7 +27,7 @@ class BuildApkCommand extends BuildSubCommand {
addSplitDebugInfoOption(); addSplitDebugInfoOption();
addDartObfuscationOption(); addDartObfuscationOption();
usesDartDefineOption(); usesDartDefineOption();
usesExtraFrontendOptions(); usesExtraDartFlagOptions();
addBundleSkSLPathOption(hide: !verboseHelp); addBundleSkSLPathOption(hide: !verboseHelp);
addEnableExperimentation(hide: !verboseHelp); addEnableExperimentation(hide: !verboseHelp);
addBuildPerformanceFile(hide: !verboseHelp); addBuildPerformanceFile(hide: !verboseHelp);
......
...@@ -26,7 +26,7 @@ class BuildAppBundleCommand extends BuildSubCommand { ...@@ -26,7 +26,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
addSplitDebugInfoOption(); addSplitDebugInfoOption();
addDartObfuscationOption(); addDartObfuscationOption();
usesDartDefineOption(); usesDartDefineOption();
usesExtraFrontendOptions(); usesExtraDartFlagOptions();
addBundleSkSLPathOption(hide: !verboseHelp); addBundleSkSLPathOption(hide: !verboseHelp);
addBuildPerformanceFile(hide: !verboseHelp); addBuildPerformanceFile(hide: !verboseHelp);
usesTrackWidgetCreation(verboseHelp: verboseHelp); usesTrackWidgetCreation(verboseHelp: verboseHelp);
......
...@@ -9,7 +9,7 @@ import '../features.dart'; ...@@ -9,7 +9,7 @@ import '../features.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
import '../project.dart'; import '../project.dart';
import '../reporting/reporting.dart'; import '../reporting/reporting.dart';
import '../runner/flutter_command.dart' show FlutterOptions, FlutterCommandResult; import '../runner/flutter_command.dart' show FlutterCommandResult;
import 'build.dart'; import 'build.dart';
class BuildBundleCommand extends BuildSubCommand { class BuildBundleCommand extends BuildSubCommand {
...@@ -19,7 +19,7 @@ class BuildBundleCommand extends BuildSubCommand { ...@@ -19,7 +19,7 @@ class BuildBundleCommand extends BuildSubCommand {
usesFilesystemOptions(hide: !verboseHelp); usesFilesystemOptions(hide: !verboseHelp);
usesBuildNumberOption(); usesBuildNumberOption();
addBuildModeFlags(verboseHelp: verboseHelp); addBuildModeFlags(verboseHelp: verboseHelp);
usesExtraFrontendOptions(); usesExtraDartFlagOptions();
argParser argParser
..addFlag( ..addFlag(
'precompiled', 'precompiled',
...@@ -49,10 +49,6 @@ class BuildBundleCommand extends BuildSubCommand { ...@@ -49,10 +49,6 @@ class BuildBundleCommand extends BuildSubCommand {
], ],
) )
..addOption('asset-dir', defaultsTo: getAssetBuildDirectory()) ..addOption('asset-dir', defaultsTo: getAssetBuildDirectory())
..addMultiOption(FlutterOptions.kExtraGenSnapshotOptions,
splitCommas: true,
hide: true,
)
..addFlag('report-licensed-packages', ..addFlag('report-licensed-packages',
help: 'Whether to report the names of all the packages that are included ' help: 'Whether to report the names of all the packages that are included '
"in the application's LICENSE file.", "in the application's LICENSE file.",
......
...@@ -177,7 +177,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand { ...@@ -177,7 +177,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
usesBuildNameOption(); usesBuildNameOption();
addDartObfuscationOption(); addDartObfuscationOption();
usesDartDefineOption(); usesDartDefineOption();
usesExtraFrontendOptions(); usesExtraDartFlagOptions();
addEnableExperimentation(hide: !verboseHelp); addEnableExperimentation(hide: !verboseHelp);
addBuildPerformanceFile(hide: !verboseHelp); addBuildPerformanceFile(hide: !verboseHelp);
addBundleSkSLPathOption(hide: !verboseHelp); addBundleSkSLPathOption(hide: !verboseHelp);
......
...@@ -49,7 +49,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand { ...@@ -49,7 +49,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
usesDartDefineOption(); usesDartDefineOption();
addSplitDebugInfoOption(); addSplitDebugInfoOption();
addDartObfuscationOption(); addDartObfuscationOption();
usesExtraFrontendOptions(); usesExtraDartFlagOptions();
addNullSafetyModeOptions(hide: !verboseHelp); addNullSafetyModeOptions(hide: !verboseHelp);
addEnableExperimentation(hide: !verboseHelp); addEnableExperimentation(hide: !verboseHelp);
......
...@@ -205,7 +205,7 @@ class RunCommand extends RunCommandBase { ...@@ -205,7 +205,7 @@ class RunCommand extends RunCommandBase {
RunCommand({ bool verboseHelp = false }) : super(verboseHelp: verboseHelp) { RunCommand({ bool verboseHelp = false }) : super(verboseHelp: verboseHelp) {
requiresPubspecYaml(); requiresPubspecYaml();
usesFilesystemOptions(hide: !verboseHelp); usesFilesystemOptions(hide: !verboseHelp);
usesExtraFrontendOptions(); usesExtraDartFlagOptions();
addEnableExperimentation(hide: !verboseHelp); addEnableExperimentation(hide: !verboseHelp);
// By default, the app should to publish the VM service port over mDNS. // By default, the app should to publish the VM service port over mDNS.
......
...@@ -596,11 +596,17 @@ abstract class FlutterCommand extends Command<void> { ...@@ -596,11 +596,17 @@ abstract class FlutterCommand extends Command<void> {
); );
} }
void usesExtraFrontendOptions() { /// Enables support for the hidden options --extra-front-end-options and
/// --extra-gen-snapshot-options.
void usesExtraDartFlagOptions() {
argParser.addMultiOption(FlutterOptions.kExtraFrontEndOptions, argParser.addMultiOption(FlutterOptions.kExtraFrontEndOptions,
splitCommas: true, splitCommas: true,
hide: true, hide: true,
); );
argParser.addMultiOption(FlutterOptions.kExtraGenSnapshotOptions,
splitCommas: true,
hide: true,
);
} }
void usesFuchsiaOptions({ bool hide = false }) { void usesFuchsiaOptions({ bool hide = false }) {
...@@ -664,7 +670,7 @@ abstract class FlutterCommand extends Command<void> { ...@@ -664,7 +670,7 @@ abstract class FlutterCommand extends Command<void> {
addTreeShakeIconsFlag(); addTreeShakeIconsFlag();
usesAnalyzeSizeFlag(); usesAnalyzeSizeFlag();
usesDartDefineOption(); usesDartDefineOption();
usesExtraFrontendOptions(); usesExtraDartFlagOptions();
usesPubOption(); usesPubOption();
usesTargetOption(); usesTargetOption();
usesTrackWidgetCreation(verboseHelp: verboseHelp); usesTrackWidgetCreation(verboseHelp: verboseHelp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment