forked from firka/flutter
Share build command flag configuration on desktop (#64983)
Almost all of the flag setup on Linux, macOS, and Windows should be identical; this pulls that common setup to a shared method. This adds support for several flags on macOS that have all the necessary plumbing already in place due to shared backend code, but were never enabled. Fixes https://github.com/flutter/flutter/issues/64944
This commit is contained in:
@@ -18,20 +18,7 @@ import 'build.dart';
|
||||
/// A command to build a linux desktop target through a build shell script.
|
||||
class BuildLinuxCommand extends BuildSubCommand {
|
||||
BuildLinuxCommand({ bool verboseHelp = false }) {
|
||||
addTreeShakeIconsFlag();
|
||||
usesTargetOption();
|
||||
addBuildModeFlags(verboseHelp: verboseHelp);
|
||||
usesPubOption();
|
||||
addSplitDebugInfoOption();
|
||||
addDartObfuscationOption();
|
||||
usesDartDefineOption();
|
||||
usesExtraFrontendOptions();
|
||||
addEnableExperimentation(hide: !verboseHelp);
|
||||
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
||||
addBuildPerformanceFile(hide: !verboseHelp);
|
||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||
usesAnalyzeSizeFlag();
|
||||
addCommonDesktopBuildOptions(verboseHelp: verboseHelp);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -20,19 +20,9 @@ import 'build.dart';
|
||||
/// A command to build a macOS desktop target through a build shell script.
|
||||
class BuildMacosCommand extends BuildSubCommand {
|
||||
BuildMacosCommand({ @required bool verboseHelp }) {
|
||||
addTreeShakeIconsFlag();
|
||||
addSplitDebugInfoOption();
|
||||
usesTargetOption();
|
||||
addBuildModeFlags();
|
||||
addDartObfuscationOption();
|
||||
usesExtraFrontendOptions();
|
||||
addCommonDesktopBuildOptions(verboseHelp: verboseHelp);
|
||||
usesBuildNumberOption();
|
||||
usesBuildNameOption();
|
||||
addEnableExperimentation(hide: !verboseHelp);
|
||||
addBuildPerformanceFile(hide: !verboseHelp);
|
||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||
usesAnalyzeSizeFlag();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -21,20 +21,7 @@ import 'build.dart';
|
||||
/// A command to build a windows desktop target through a build shell script.
|
||||
class BuildWindowsCommand extends BuildSubCommand {
|
||||
BuildWindowsCommand({ bool verboseHelp = false }) {
|
||||
addTreeShakeIconsFlag();
|
||||
usesTargetOption();
|
||||
addBuildModeFlags(verboseHelp: verboseHelp);
|
||||
usesPubOption();
|
||||
addSplitDebugInfoOption();
|
||||
addDartObfuscationOption();
|
||||
usesDartDefineOption();
|
||||
usesExtraFrontendOptions();
|
||||
addEnableExperimentation(hide: !verboseHelp);
|
||||
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
||||
addBuildPerformanceFile(hide: !verboseHelp);
|
||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||
usesAnalyzeSizeFlag();
|
||||
addCommonDesktopBuildOptions(verboseHelp: verboseHelp);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -554,6 +554,24 @@ abstract class FlutterCommand extends Command<void> {
|
||||
);
|
||||
}
|
||||
|
||||
/// Adds build options common to all of the desktop build commands.
|
||||
void addCommonDesktopBuildOptions({ bool verboseHelp = false }) {
|
||||
addBuildModeFlags(verboseHelp: verboseHelp);
|
||||
addBuildPerformanceFile(hide: !verboseHelp);
|
||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||
addDartObfuscationOption();
|
||||
addEnableExperimentation(hide: !verboseHelp);
|
||||
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||
addSplitDebugInfoOption();
|
||||
addTreeShakeIconsFlag();
|
||||
usesAnalyzeSizeFlag();
|
||||
usesDartDefineOption();
|
||||
usesExtraFrontendOptions();
|
||||
usesPubOption();
|
||||
usesTargetOption();
|
||||
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
||||
}
|
||||
|
||||
set defaultBuildMode(BuildMode value) {
|
||||
_defaultBuildMode = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user