[flutter_tools] boolArg refactor (#102088)
This commit is contained in:
parent
90a8b0561d
commit
f86dfdd2b7
@ -105,7 +105,7 @@ class AnalyzeCommand extends FlutterCommand {
|
|||||||
@override
|
@override
|
||||||
bool get shouldRunPub {
|
bool get shouldRunPub {
|
||||||
// If they're not analyzing the current project.
|
// If they're not analyzing the current project.
|
||||||
if (!boolArg('current-package')) {
|
if (!boolArgDeprecated('current-package')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ class AnalyzeCommand extends FlutterCommand {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FlutterCommandResult> runCommand() async {
|
Future<FlutterCommandResult> runCommand() async {
|
||||||
if (boolArg('watch')) {
|
if (boolArgDeprecated('watch')) {
|
||||||
await AnalyzeContinuously(
|
await AnalyzeContinuously(
|
||||||
argResults!,
|
argResults!,
|
||||||
runner!.getRepoRoots(),
|
runner!.getRepoRoots(),
|
||||||
|
@ -234,7 +234,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
|
|||||||
Future<void> _attachToDevice(Device device) async {
|
Future<void> _attachToDevice(Device device) async {
|
||||||
final FlutterProject flutterProject = FlutterProject.current();
|
final FlutterProject flutterProject = FlutterProject.current();
|
||||||
|
|
||||||
final Daemon daemon = boolArg('machine')
|
final Daemon daemon = boolArgDeprecated('machine')
|
||||||
? Daemon(
|
? Daemon(
|
||||||
DaemonConnection(
|
DaemonConnection(
|
||||||
daemonStreams: DaemonStreams.fromStdio(globals.stdio, logger: globals.logger),
|
daemonStreams: DaemonStreams.fromStdio(globals.stdio, logger: globals.logger),
|
||||||
@ -336,7 +336,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
|
|||||||
connectionInfoCompleter: connectionInfoCompleter,
|
connectionInfoCompleter: connectionInfoCompleter,
|
||||||
appStartedCompleter: appStartedCompleter,
|
appStartedCompleter: appStartedCompleter,
|
||||||
allowExistingDdsInstance: true,
|
allowExistingDdsInstance: true,
|
||||||
enableDevTools: boolArg(FlutterCommand.kEnableDevTools),
|
enableDevTools: boolArgDeprecated(FlutterCommand.kEnableDevTools),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
device,
|
device,
|
||||||
@ -369,7 +369,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
|
|||||||
terminal: globals.terminal,
|
terminal: globals.terminal,
|
||||||
signals: globals.signals,
|
signals: globals.signals,
|
||||||
processInfo: globals.processInfo,
|
processInfo: globals.processInfo,
|
||||||
reportReady: boolArg('report-ready'),
|
reportReady: boolArgDeprecated('report-ready'),
|
||||||
pidFile: stringArgDeprecated('pid-file'),
|
pidFile: stringArgDeprecated('pid-file'),
|
||||||
)
|
)
|
||||||
..registerSignalHandlers()
|
..registerSignalHandlers()
|
||||||
@ -378,7 +378,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
|
|||||||
result = await runner.attach(
|
result = await runner.attach(
|
||||||
appStartedCompleter: onAppStart,
|
appStartedCompleter: onAppStart,
|
||||||
allowExistingDdsInstance: true,
|
allowExistingDdsInstance: true,
|
||||||
enableDevTools: boolArg(FlutterCommand.kEnableDevTools),
|
enableDevTools: boolArgDeprecated(FlutterCommand.kEnableDevTools),
|
||||||
);
|
);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
throwToolExit(null, exitCode: result);
|
throwToolExit(null, exitCode: result);
|
||||||
|
@ -121,7 +121,7 @@ class BuildAarCommand extends BuildSubCommand {
|
|||||||
|
|
||||||
final File targetFile = globals.fs.file(globals.fs.path.join('lib', 'main.dart'));
|
final File targetFile = globals.fs.file(globals.fs.path.join('lib', 'main.dart'));
|
||||||
for (final String buildMode in const <String>['debug', 'profile', 'release']) {
|
for (final String buildMode in const <String>['debug', 'profile', 'release']) {
|
||||||
if (boolArg(buildMode)) {
|
if (boolArgDeprecated(buildMode)) {
|
||||||
androidBuildInfo.add(
|
androidBuildInfo.add(
|
||||||
AndroidBuildInfo(
|
AndroidBuildInfo(
|
||||||
await getBuildInfo(
|
await getBuildInfo(
|
||||||
|
@ -53,7 +53,7 @@ class BuildApkCommand extends BuildSubCommand {
|
|||||||
final String name = 'apk';
|
final String name = 'apk';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
DeprecationBehavior get deprecationBehavior => boolArg('ignore-deprecation') ? DeprecationBehavior.ignore : DeprecationBehavior.exit;
|
DeprecationBehavior get deprecationBehavior => boolArgDeprecated('ignore-deprecation') ? DeprecationBehavior.ignore : DeprecationBehavior.exit;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
|
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
|
||||||
@ -73,11 +73,11 @@ class BuildApkCommand extends BuildSubCommand {
|
|||||||
Future<CustomDimensions> get usageValues async {
|
Future<CustomDimensions> get usageValues async {
|
||||||
String buildMode;
|
String buildMode;
|
||||||
|
|
||||||
if (boolArg('release')) {
|
if (boolArgDeprecated('release')) {
|
||||||
buildMode = 'release';
|
buildMode = 'release';
|
||||||
} else if (boolArg('debug')) {
|
} else if (boolArgDeprecated('debug')) {
|
||||||
buildMode = 'debug';
|
buildMode = 'debug';
|
||||||
} else if (boolArg('profile')) {
|
} else if (boolArgDeprecated('profile')) {
|
||||||
buildMode = 'profile';
|
buildMode = 'profile';
|
||||||
} else {
|
} else {
|
||||||
// The build defaults to release.
|
// The build defaults to release.
|
||||||
@ -87,7 +87,7 @@ class BuildApkCommand extends BuildSubCommand {
|
|||||||
return CustomDimensions(
|
return CustomDimensions(
|
||||||
commandBuildApkTargetPlatform: stringsArg('target-platform').join(','),
|
commandBuildApkTargetPlatform: stringsArg('target-platform').join(','),
|
||||||
commandBuildApkBuildMode: buildMode,
|
commandBuildApkBuildMode: buildMode,
|
||||||
commandBuildApkSplitPerAbi: boolArg('split-per-abi'),
|
commandBuildApkSplitPerAbi: boolArgDeprecated('split-per-abi'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,9 +99,9 @@ class BuildApkCommand extends BuildSubCommand {
|
|||||||
final BuildInfo buildInfo = await getBuildInfo();
|
final BuildInfo buildInfo = await getBuildInfo();
|
||||||
final AndroidBuildInfo androidBuildInfo = AndroidBuildInfo(
|
final AndroidBuildInfo androidBuildInfo = AndroidBuildInfo(
|
||||||
buildInfo,
|
buildInfo,
|
||||||
splitPerAbi: boolArg('split-per-abi'),
|
splitPerAbi: boolArgDeprecated('split-per-abi'),
|
||||||
targetArchs: stringsArg('target-platform').map<AndroidArch>(getAndroidArchForName),
|
targetArchs: stringsArg('target-platform').map<AndroidArch>(getAndroidArchForName),
|
||||||
multidexEnabled: boolArg('multidex'),
|
multidexEnabled: boolArgDeprecated('multidex'),
|
||||||
);
|
);
|
||||||
validateBuild(androidBuildInfo);
|
validateBuild(androidBuildInfo);
|
||||||
displayNullSafetyMode(androidBuildInfo.buildInfo);
|
displayNullSafetyMode(androidBuildInfo.buildInfo);
|
||||||
|
@ -69,7 +69,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
|
|||||||
final String name = 'appbundle';
|
final String name = 'appbundle';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
DeprecationBehavior get deprecationBehavior => boolArg('ignore-deprecation') ? DeprecationBehavior.ignore : DeprecationBehavior.exit;
|
DeprecationBehavior get deprecationBehavior => boolArgDeprecated('ignore-deprecation') ? DeprecationBehavior.ignore : DeprecationBehavior.exit;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
|
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
|
||||||
@ -87,11 +87,11 @@ class BuildAppBundleCommand extends BuildSubCommand {
|
|||||||
Future<CustomDimensions> get usageValues async {
|
Future<CustomDimensions> get usageValues async {
|
||||||
String buildMode;
|
String buildMode;
|
||||||
|
|
||||||
if (boolArg('release')) {
|
if (boolArgDeprecated('release')) {
|
||||||
buildMode = 'release';
|
buildMode = 'release';
|
||||||
} else if (boolArg('debug')) {
|
} else if (boolArgDeprecated('debug')) {
|
||||||
buildMode = 'debug';
|
buildMode = 'debug';
|
||||||
} else if (boolArg('profile')) {
|
} else if (boolArgDeprecated('profile')) {
|
||||||
buildMode = 'profile';
|
buildMode = 'profile';
|
||||||
} else {
|
} else {
|
||||||
// The build defaults to release.
|
// The build defaults to release.
|
||||||
@ -112,12 +112,12 @@ class BuildAppBundleCommand extends BuildSubCommand {
|
|||||||
|
|
||||||
final AndroidBuildInfo androidBuildInfo = AndroidBuildInfo(await getBuildInfo(),
|
final AndroidBuildInfo androidBuildInfo = AndroidBuildInfo(await getBuildInfo(),
|
||||||
targetArchs: stringsArg('target-platform').map<AndroidArch>(getAndroidArchForName),
|
targetArchs: stringsArg('target-platform').map<AndroidArch>(getAndroidArchForName),
|
||||||
multidexEnabled: boolArg('multidex'),
|
multidexEnabled: boolArgDeprecated('multidex'),
|
||||||
);
|
);
|
||||||
// Do all setup verification that doesn't involve loading units. Checks that
|
// Do all setup verification that doesn't involve loading units. Checks that
|
||||||
// require generated loading units are done after gen_snapshot in assemble.
|
// require generated loading units are done after gen_snapshot in assemble.
|
||||||
final List<DeferredComponent>? deferredComponents = FlutterProject.current().manifest.deferredComponents;
|
final List<DeferredComponent>? deferredComponents = FlutterProject.current().manifest.deferredComponents;
|
||||||
if (deferredComponents != null && boolArg('deferred-components') && boolArg('validate-deferred-components') && !boolArg('debug')) {
|
if (deferredComponents != null && boolArgDeprecated('deferred-components') && boolArgDeprecated('validate-deferred-components') && !boolArgDeprecated('debug')) {
|
||||||
final DeferredComponentsPrebuildValidator validator = DeferredComponentsPrebuildValidator(
|
final DeferredComponentsPrebuildValidator validator = DeferredComponentsPrebuildValidator(
|
||||||
FlutterProject.current().directory,
|
FlutterProject.current().directory,
|
||||||
globals.logger,
|
globals.logger,
|
||||||
@ -153,8 +153,8 @@ class BuildAppBundleCommand extends BuildSubCommand {
|
|||||||
project: FlutterProject.current(),
|
project: FlutterProject.current(),
|
||||||
target: targetFile,
|
target: targetFile,
|
||||||
androidBuildInfo: androidBuildInfo,
|
androidBuildInfo: androidBuildInfo,
|
||||||
validateDeferredComponents: boolArg('validate-deferred-components'),
|
validateDeferredComponents: boolArgDeprecated('validate-deferred-components'),
|
||||||
deferredComponentsEnabled: boolArg('deferred-components') && !boolArg('debug'),
|
deferredComponentsEnabled: boolArgDeprecated('deferred-components') && !boolArgDeprecated('debug'),
|
||||||
);
|
);
|
||||||
return FlutterCommandResult.success();
|
return FlutterCommandResult.success();
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ class BuildBundleCommand extends BuildSubCommand {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> validateCommand() async {
|
Future<void> validateCommand() async {
|
||||||
if (boolArg('tree-shake-icons')) {
|
if (boolArgDeprecated('tree-shake-icons')) {
|
||||||
throwToolExit('The "--tree-shake-icons" flag is deprecated for "build bundle" and will be removed in a future version of Flutter.');
|
throwToolExit('The "--tree-shake-icons" flag is deprecated for "build bundle" and will be removed in a future version of Flutter.');
|
||||||
}
|
}
|
||||||
return super.validateCommand();
|
return super.validateCommand();
|
||||||
|
@ -44,10 +44,10 @@ class BuildIOSCommand extends _BuildIOSSubCommand {
|
|||||||
final XcodeBuildAction xcodeBuildAction = XcodeBuildAction.build;
|
final XcodeBuildAction xcodeBuildAction = XcodeBuildAction.build;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
EnvironmentType get environmentType => boolArg('simulator') ? EnvironmentType.simulator : EnvironmentType.physical;
|
EnvironmentType get environmentType => boolArgDeprecated('simulator') ? EnvironmentType.simulator : EnvironmentType.physical;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get configOnly => boolArg('config-only');
|
bool get configOnly => boolArgDeprecated('config-only');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Directory _outputAppDirectory(String xcodeResultOutput) => globals.fs.directory(xcodeResultOutput).parent;
|
Directory _outputAppDirectory(String xcodeResultOutput) => globals.fs.directory(xcodeResultOutput).parent;
|
||||||
@ -305,7 +305,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
|
|||||||
EnvironmentType get environmentType;
|
EnvironmentType get environmentType;
|
||||||
bool get configOnly;
|
bool get configOnly;
|
||||||
|
|
||||||
bool get shouldCodesign => boolArg('codesign');
|
bool get shouldCodesign => boolArgDeprecated('codesign');
|
||||||
|
|
||||||
late final Future<BuildInfo> cachedBuildInfo = getBuildInfo();
|
late final Future<BuildInfo> cachedBuildInfo = getBuildInfo();
|
||||||
|
|
||||||
|
@ -126,13 +126,13 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
|
|||||||
Future<List<BuildInfo>> getBuildInfos() async {
|
Future<List<BuildInfo>> getBuildInfos() async {
|
||||||
final List<BuildInfo> buildInfos = <BuildInfo>[];
|
final List<BuildInfo> buildInfos = <BuildInfo>[];
|
||||||
|
|
||||||
if (boolArg('debug')) {
|
if (boolArgDeprecated('debug')) {
|
||||||
buildInfos.add(await getBuildInfo(forcedBuildMode: BuildMode.debug));
|
buildInfos.add(await getBuildInfo(forcedBuildMode: BuildMode.debug));
|
||||||
}
|
}
|
||||||
if (boolArg('profile')) {
|
if (boolArgDeprecated('profile')) {
|
||||||
buildInfos.add(await getBuildInfo(forcedBuildMode: BuildMode.profile));
|
buildInfos.add(await getBuildInfo(forcedBuildMode: BuildMode.profile));
|
||||||
}
|
}
|
||||||
if (boolArg('release')) {
|
if (boolArgDeprecated('release')) {
|
||||||
buildInfos.add(await getBuildInfo(forcedBuildMode: BuildMode.release));
|
buildInfos.add(await getBuildInfo(forcedBuildMode: BuildMode.release));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
|
|||||||
throwToolExit('Building frameworks for iOS is only supported on the Mac.');
|
throwToolExit('Building frameworks for iOS is only supported on the Mac.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boolArg('universal')) {
|
if (boolArgDeprecated('universal')) {
|
||||||
throwToolExit('--universal has been deprecated, only XCFrameworks are supported.');
|
throwToolExit('--universal has been deprecated, only XCFrameworks are supported.');
|
||||||
}
|
}
|
||||||
if ((await getBuildInfos()).isEmpty) {
|
if ((await getBuildInfos()).isEmpty) {
|
||||||
@ -183,8 +183,8 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
|
|||||||
modeDirectory.deleteSync(recursive: true);
|
modeDirectory.deleteSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boolArg('cocoapods')) {
|
if (boolArgDeprecated('cocoapods')) {
|
||||||
produceFlutterPodspec(buildInfo.mode, modeDirectory, force: boolArg('force'));
|
produceFlutterPodspec(buildInfo.mode, modeDirectory, force: boolArgDeprecated('force'));
|
||||||
} else {
|
} else {
|
||||||
// Copy Flutter.xcframework.
|
// Copy Flutter.xcframework.
|
||||||
await _produceFlutterFramework(buildInfo, modeDirectory);
|
await _produceFlutterFramework(buildInfo, modeDirectory);
|
||||||
@ -503,7 +503,7 @@ end
|
|||||||
|
|
||||||
Future<void> _produceXCFramework(Iterable<Directory> frameworks,
|
Future<void> _produceXCFramework(Iterable<Directory> frameworks,
|
||||||
String frameworkBinaryName, Directory outputDirectory) async {
|
String frameworkBinaryName, Directory outputDirectory) async {
|
||||||
if (!boolArg('xcframework')) {
|
if (!boolArgDeprecated('xcframework')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final List<String> xcframeworkCommand = <String>[
|
final List<String> xcframeworkCommand = <String>[
|
||||||
|
@ -118,10 +118,10 @@ class BuildWebCommand extends BuildSubCommand {
|
|||||||
flutterProject,
|
flutterProject,
|
||||||
target,
|
target,
|
||||||
buildInfo,
|
buildInfo,
|
||||||
boolArg('csp'),
|
boolArgDeprecated('csp'),
|
||||||
stringArgDeprecated('pwa-strategy')!,
|
stringArgDeprecated('pwa-strategy')!,
|
||||||
boolArg('source-maps'),
|
boolArgDeprecated('source-maps'),
|
||||||
boolArg('native-null-assertions'),
|
boolArgDeprecated('native-null-assertions'),
|
||||||
baseHref,
|
baseHref,
|
||||||
stringArgDeprecated('dart2js-optimization'),
|
stringArgDeprecated('dart2js-optimization'),
|
||||||
);
|
);
|
||||||
|
@ -39,7 +39,7 @@ class ChannelCommand extends FlutterCommand {
|
|||||||
switch (rest.length) {
|
switch (rest.length) {
|
||||||
case 0:
|
case 0:
|
||||||
await _listChannels(
|
await _listChannels(
|
||||||
showAll: boolArg('all'),
|
showAll: boolArgDeprecated('all'),
|
||||||
verbose: globalResults?['verbose'] == true,
|
verbose: globalResults?['verbose'] == true,
|
||||||
);
|
);
|
||||||
return FlutterCommandResult.success();
|
return FlutterCommandResult.success();
|
||||||
|
@ -101,12 +101,12 @@ class ConfigCommand extends FlutterCommand {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FlutterCommandResult> runCommand() async {
|
Future<FlutterCommandResult> runCommand() async {
|
||||||
if (boolArg('machine')) {
|
if (boolArgDeprecated('machine')) {
|
||||||
await handleMachine();
|
await handleMachine();
|
||||||
return FlutterCommandResult.success();
|
return FlutterCommandResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boolArg('clear-features')) {
|
if (boolArgDeprecated('clear-features')) {
|
||||||
for (final Feature feature in allFeatures) {
|
for (final Feature feature in allFeatures) {
|
||||||
final String? configSetting = feature.configSetting;
|
final String? configSetting = feature.configSetting;
|
||||||
if (configSetting != null) {
|
if (configSetting != null) {
|
||||||
@ -117,7 +117,7 @@ class ConfigCommand extends FlutterCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argResults?.wasParsed('analytics') ?? false) {
|
if (argResults?.wasParsed('analytics') ?? false) {
|
||||||
final bool value = boolArg('analytics');
|
final bool value = boolArgDeprecated('analytics');
|
||||||
// The tool sends the analytics event *before* toggling the flag
|
// The tool sends the analytics event *before* toggling the flag
|
||||||
// intentionally to be sure that opt-out events are sent correctly.
|
// intentionally to be sure that opt-out events are sent correctly.
|
||||||
AnalyticsConfigEvent(enabled: value).send();
|
AnalyticsConfigEvent(enabled: value).send();
|
||||||
@ -157,7 +157,7 @@ class ConfigCommand extends FlutterCommand {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (argResults?.wasParsed(configSetting) ?? false) {
|
if (argResults?.wasParsed(configSetting) ?? false) {
|
||||||
final bool keyValue = boolArg(configSetting);
|
final bool keyValue = boolArgDeprecated(configSetting);
|
||||||
globals.config.setValue(configSetting, keyValue);
|
globals.config.setValue(configSetting, keyValue);
|
||||||
globals.printStatus('Setting "$configSetting" value to "$keyValue".');
|
globals.printStatus('Setting "$configSetting" value to "$keyValue".');
|
||||||
}
|
}
|
||||||
|
@ -245,10 +245,10 @@ class CreateCommand extends CreateBase {
|
|||||||
|
|
||||||
final String organization = await getOrganization();
|
final String organization = await getOrganization();
|
||||||
|
|
||||||
final bool overwrite = boolArg('overwrite');
|
final bool overwrite = boolArgDeprecated('overwrite');
|
||||||
validateProjectDir(overwrite: overwrite);
|
validateProjectDir(overwrite: overwrite);
|
||||||
|
|
||||||
if (boolArg('with-driver-test')) {
|
if (boolArgDeprecated('with-driver-test')) {
|
||||||
globals.printWarning(
|
globals.printWarning(
|
||||||
'The "--with-driver-test" argument has been deprecated and will no longer add a flutter '
|
'The "--with-driver-test" argument has been deprecated and will no longer add a flutter '
|
||||||
'driver template. Instead, learn how to use package:integration_test by '
|
'driver template. Instead, learn how to use package:integration_test by '
|
||||||
@ -291,7 +291,7 @@ class CreateCommand extends CreateBase {
|
|||||||
windows: featureFlags.isWindowsEnabled && platforms.contains('windows'),
|
windows: featureFlags.isWindowsEnabled && platforms.contains('windows'),
|
||||||
// Enable null safety everywhere.
|
// Enable null safety everywhere.
|
||||||
dartSdkVersionBounds: "'>=$dartSdk <3.0.0'",
|
dartSdkVersionBounds: "'>=$dartSdk <3.0.0'",
|
||||||
implementationTests: boolArg('implementation-tests'),
|
implementationTests: boolArgDeprecated('implementation-tests'),
|
||||||
agpVersion: gradle.templateAndroidGradlePluginVersion,
|
agpVersion: gradle.templateAndroidGradlePluginVersion,
|
||||||
kotlinVersion: gradle.templateKotlinGradlePluginVersion,
|
kotlinVersion: gradle.templateKotlinGradlePluginVersion,
|
||||||
gradleVersion: gradle.templateDefaultGradleVersion,
|
gradleVersion: gradle.templateDefaultGradleVersion,
|
||||||
@ -448,11 +448,11 @@ Your $application code is in $relativeAppMain.
|
|||||||
overwrite: overwrite,
|
overwrite: overwrite,
|
||||||
printStatusWhenWriting: printStatusWhenWriting,
|
printStatusWhenWriting: printStatusWhenWriting,
|
||||||
);
|
);
|
||||||
if (boolArg('pub')) {
|
if (boolArgDeprecated('pub')) {
|
||||||
await pub.get(
|
await pub.get(
|
||||||
context: PubContext.create,
|
context: PubContext.create,
|
||||||
directory: directory.path,
|
directory: directory.path,
|
||||||
offline: boolArg('offline'),
|
offline: boolArgDeprecated('offline'),
|
||||||
generateSyntheticPackage: false,
|
generateSyntheticPackage: false,
|
||||||
);
|
);
|
||||||
final FlutterProject project = FlutterProject.fromDirectory(directory);
|
final FlutterProject project = FlutterProject.fromDirectory(directory);
|
||||||
@ -482,11 +482,11 @@ Your $application code is in $relativeAppMain.
|
|||||||
overwrite: overwrite,
|
overwrite: overwrite,
|
||||||
printStatusWhenWriting: printStatusWhenWriting,
|
printStatusWhenWriting: printStatusWhenWriting,
|
||||||
);
|
);
|
||||||
if (boolArg('pub')) {
|
if (boolArgDeprecated('pub')) {
|
||||||
await pub.get(
|
await pub.get(
|
||||||
context: PubContext.createPackage,
|
context: PubContext.createPackage,
|
||||||
directory: directory.path,
|
directory: directory.path,
|
||||||
offline: boolArg('offline'),
|
offline: boolArgDeprecated('offline'),
|
||||||
generateSyntheticPackage: false,
|
generateSyntheticPackage: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -529,11 +529,11 @@ Your $application code is in $relativeAppMain.
|
|||||||
printStatusWhenWriting: printStatusWhenWriting,
|
printStatusWhenWriting: printStatusWhenWriting,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (boolArg('pub')) {
|
if (boolArgDeprecated('pub')) {
|
||||||
await pub.get(
|
await pub.get(
|
||||||
context: PubContext.createPlugin,
|
context: PubContext.createPlugin,
|
||||||
directory: directory.path,
|
directory: directory.path,
|
||||||
offline: boolArg('offline'),
|
offline: boolArgDeprecated('offline'),
|
||||||
generateSyntheticPackage: false,
|
generateSyntheticPackage: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -608,11 +608,11 @@ Your $application code is in $relativeAppMain.
|
|||||||
printStatusWhenWriting: printStatusWhenWriting,
|
printStatusWhenWriting: printStatusWhenWriting,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (boolArg('pub')) {
|
if (boolArgDeprecated('pub')) {
|
||||||
await pub.get(
|
await pub.get(
|
||||||
context: PubContext.createPlugin,
|
context: PubContext.createPlugin,
|
||||||
directory: directory.path,
|
directory: directory.path,
|
||||||
offline: boolArg('offline'),
|
offline: boolArgDeprecated('offline'),
|
||||||
generateSyntheticPackage: false,
|
generateSyntheticPackage: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ abstract class CreateBase extends FlutterCommand {
|
|||||||
String get projectName {
|
String get projectName {
|
||||||
final String projectName =
|
final String projectName =
|
||||||
stringArgDeprecated('project-name') ?? globals.fs.path.basename(projectDirPath);
|
stringArgDeprecated('project-name') ?? globals.fs.path.basename(projectDirPath);
|
||||||
if (!boolArg('skip-name-checks')) {
|
if (!boolArgDeprecated('skip-name-checks')) {
|
||||||
final String error = _validateProjectName(projectName);
|
final String error = _validateProjectName(projectName);
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
throwToolExit(error);
|
throwToolExit(error);
|
||||||
@ -515,7 +515,7 @@ abstract class CreateBase extends FlutterCommand {
|
|||||||
final bool windowsPlatform = templateContext['windows'] as bool ?? false;
|
final bool windowsPlatform = templateContext['windows'] as bool ?? false;
|
||||||
final bool webPlatform = templateContext['web'] as bool ?? false;
|
final bool webPlatform = templateContext['web'] as bool ?? false;
|
||||||
|
|
||||||
if (boolArg('pub')) {
|
if (boolArgDeprecated('pub')) {
|
||||||
final Environment environment = Environment(
|
final Environment environment = Environment(
|
||||||
artifacts: globals.artifacts,
|
artifacts: globals.artifacts,
|
||||||
logger: globals.logger,
|
logger: globals.logger,
|
||||||
@ -540,7 +540,7 @@ abstract class CreateBase extends FlutterCommand {
|
|||||||
await pub.get(
|
await pub.get(
|
||||||
context: PubContext.create,
|
context: PubContext.create,
|
||||||
directory: directory.path,
|
directory: directory.path,
|
||||||
offline: boolArg('offline'),
|
offline: boolArgDeprecated('offline'),
|
||||||
// For templates that use the l10n localization tooling, make sure
|
// For templates that use the l10n localization tooling, make sure
|
||||||
// importing the generated package works right after `flutter create`.
|
// importing the generated package works right after `flutter create`.
|
||||||
generateSyntheticPackage: true,
|
generateSyntheticPackage: true,
|
||||||
|
@ -483,7 +483,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
|
|||||||
/// Only check if `--check` is explicitly specified. (Don't check by default)
|
/// Only check if `--check` is explicitly specified. (Don't check by default)
|
||||||
Future<FlutterCommandResult> runNonInteractively() async {
|
Future<FlutterCommandResult> runNonInteractively() async {
|
||||||
final String jsonStr = stringArgDeprecated(_kJson);
|
final String jsonStr = stringArgDeprecated(_kJson);
|
||||||
final bool shouldCheck = boolArg(_kCheck) ?? false;
|
final bool shouldCheck = boolArgDeprecated(_kCheck) ?? false;
|
||||||
|
|
||||||
dynamic json;
|
dynamic json;
|
||||||
try {
|
try {
|
||||||
@ -591,7 +591,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
|
|||||||
/// Run interactively (with user prompts), the target device should be
|
/// Run interactively (with user prompts), the target device should be
|
||||||
/// connected to via ssh.
|
/// connected to via ssh.
|
||||||
Future<FlutterCommandResult> runInteractivelySsh() async {
|
Future<FlutterCommandResult> runInteractivelySsh() async {
|
||||||
final bool shouldCheck = boolArg(_kCheck) ?? true;
|
final bool shouldCheck = boolArgDeprecated(_kCheck) ?? true;
|
||||||
|
|
||||||
// Listen to the keystrokes stream as late as possible, since it's a
|
// Listen to the keystrokes stream as late as possible, since it's a
|
||||||
// single-subscription stream apparently.
|
// single-subscription stream apparently.
|
||||||
@ -806,7 +806,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
|
|||||||
if (stringArgDeprecated(_kJson) != null) {
|
if (stringArgDeprecated(_kJson) != null) {
|
||||||
return runNonInteractively();
|
return runNonInteractively();
|
||||||
}
|
}
|
||||||
if (boolArg(_kSsh) == true) {
|
if (boolArgDeprecated(_kSsh) == true) {
|
||||||
return runInteractivelySsh();
|
return runInteractivelySsh();
|
||||||
}
|
}
|
||||||
throw FallThroughError();
|
throw FallThroughError();
|
||||||
|
@ -58,7 +58,7 @@ class DebugAdapterCommand extends FlutterCommand {
|
|||||||
platform: globals.platform,
|
platform: globals.platform,
|
||||||
ipv6: ipv6 ?? false,
|
ipv6: ipv6 ?? false,
|
||||||
enableDds: enableDds,
|
enableDds: enableDds,
|
||||||
test: boolArg('test'),
|
test: boolArgDeprecated('test'),
|
||||||
);
|
);
|
||||||
|
|
||||||
await server.channel.closed;
|
await server.channel.closed;
|
||||||
|
@ -64,7 +64,7 @@ class DevicesCommand extends FlutterCommand {
|
|||||||
|
|
||||||
final List<Device> devices = await globals.deviceManager?.refreshAllConnectedDevices(timeout: deviceDiscoveryTimeout) ?? <Device>[];
|
final List<Device> devices = await globals.deviceManager?.refreshAllConnectedDevices(timeout: deviceDiscoveryTimeout) ?? <Device>[];
|
||||||
|
|
||||||
if (boolArg('machine')) {
|
if (boolArgDeprecated('machine')) {
|
||||||
await printDevicesAsJson(devices);
|
await printDevicesAsJson(devices);
|
||||||
} else {
|
} else {
|
||||||
if (devices.isEmpty) {
|
if (devices.isEmpty) {
|
||||||
|
@ -48,7 +48,7 @@ class DoctorCommand extends FlutterCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final bool success = await globals.doctor?.diagnose(
|
final bool success = await globals.doctor?.diagnose(
|
||||||
androidLicenses: boolArg('android-licenses'),
|
androidLicenses: boolArgDeprecated('android-licenses'),
|
||||||
verbose: verbose,
|
verbose: verbose,
|
||||||
androidLicenseValidator: androidLicenseValidator,
|
androidLicenseValidator: androidLicenseValidator,
|
||||||
) ?? false;
|
) ?? false;
|
||||||
|
@ -129,7 +129,7 @@ class DowngradeCommand extends FlutterCommand {
|
|||||||
final Stdio stdio = _stdio!;
|
final Stdio stdio = _stdio!;
|
||||||
final Terminal terminal = _terminal!;
|
final Terminal terminal = _terminal!;
|
||||||
final Logger logger = _logger!;
|
final Logger logger = _logger!;
|
||||||
if (stdio.hasTerminal && boolArg('prompt')) {
|
if (stdio.hasTerminal && boolArgDeprecated('prompt')) {
|
||||||
terminal.usesTerminalUi = true;
|
terminal.usesTerminalUi = true;
|
||||||
final String result = await terminal.promptForCharInput(
|
final String result = await terminal.promptForCharInput(
|
||||||
const <String>['y', 'n'],
|
const <String>['y', 'n'],
|
||||||
|
@ -156,7 +156,7 @@ class DriveCommand extends RunCommandBase {
|
|||||||
// specified not to.
|
// specified not to.
|
||||||
@override
|
@override
|
||||||
bool get shouldRunPub {
|
bool get shouldRunPub {
|
||||||
if (argResults.wasParsed('pub') && !boolArg('pub')) {
|
if (argResults.wasParsed('pub') && !boolArgDeprecated('pub')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -255,7 +255,7 @@ class DriveCommand extends RunCommandBase {
|
|||||||
'trace-startup': traceStartup,
|
'trace-startup': traceStartup,
|
||||||
if (web)
|
if (web)
|
||||||
'--no-launch-chrome': true,
|
'--no-launch-chrome': true,
|
||||||
if (boolArg('multidex'))
|
if (boolArgDeprecated('multidex'))
|
||||||
'multidex': true,
|
'multidex': true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -278,13 +278,13 @@ class DriveCommand extends RunCommandBase {
|
|||||||
<String, String>{},
|
<String, String>{},
|
||||||
packageConfig,
|
packageConfig,
|
||||||
chromeBinary: stringArgDeprecated('chrome-binary'),
|
chromeBinary: stringArgDeprecated('chrome-binary'),
|
||||||
headless: boolArg('headless'),
|
headless: boolArgDeprecated('headless'),
|
||||||
browserDimension: stringArgDeprecated('browser-dimension').split(','),
|
browserDimension: stringArgDeprecated('browser-dimension').split(','),
|
||||||
browserName: stringArgDeprecated('browser-name'),
|
browserName: stringArgDeprecated('browser-name'),
|
||||||
driverPort: stringArgDeprecated('driver-port') != null
|
driverPort: stringArgDeprecated('driver-port') != null
|
||||||
? int.tryParse(stringArgDeprecated('driver-port'))
|
? int.tryParse(stringArgDeprecated('driver-port'))
|
||||||
: null,
|
: null,
|
||||||
androidEmulator: boolArg('android-emulator'),
|
androidEmulator: boolArgDeprecated('android-emulator'),
|
||||||
profileMemory: stringArgDeprecated('profile-memory'),
|
profileMemory: stringArgDeprecated('profile-memory'),
|
||||||
);
|
);
|
||||||
if (testResult != 0 && screenshot != null) {
|
if (testResult != 0 && screenshot != null) {
|
||||||
@ -293,7 +293,7 @@ class DriveCommand extends RunCommandBase {
|
|||||||
screenshotTaken = true;
|
screenshotTaken = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boolArg('keep-app-running') ?? (argResults['use-existing-app'] != null)) {
|
if (boolArgDeprecated('keep-app-running') ?? (argResults['use-existing-app'] != null)) {
|
||||||
_logger.printStatus('Leaving the application running.');
|
_logger.printStatus('Leaving the application running.');
|
||||||
} else {
|
} else {
|
||||||
final File skslFile = stringArgDeprecated('write-sksl-on-exit') != null
|
final File skslFile = stringArgDeprecated('write-sksl-on-exit') != null
|
||||||
|
@ -225,12 +225,12 @@ class GenerateLocalizationsCommand extends FlutterCommand {
|
|||||||
final List<String> preferredSupportedLocales = stringsArg('preferred-supported-locales');
|
final List<String> preferredSupportedLocales = stringsArg('preferred-supported-locales');
|
||||||
final String? headerString = stringArgDeprecated('header');
|
final String? headerString = stringArgDeprecated('header');
|
||||||
final String? headerFile = stringArgDeprecated('header-file');
|
final String? headerFile = stringArgDeprecated('header-file');
|
||||||
final bool useDeferredLoading = boolArg('use-deferred-loading');
|
final bool useDeferredLoading = boolArgDeprecated('use-deferred-loading');
|
||||||
final String? inputsAndOutputsListPath = stringArgDeprecated('gen-inputs-and-outputs-list');
|
final String? inputsAndOutputsListPath = stringArgDeprecated('gen-inputs-and-outputs-list');
|
||||||
final bool useSyntheticPackage = boolArg('synthetic-package');
|
final bool useSyntheticPackage = boolArgDeprecated('synthetic-package');
|
||||||
final String? projectPathString = stringArgDeprecated('project-dir');
|
final String? projectPathString = stringArgDeprecated('project-dir');
|
||||||
final bool areResourceAttributesRequired = boolArg('required-resource-attributes');
|
final bool areResourceAttributesRequired = boolArgDeprecated('required-resource-attributes');
|
||||||
final bool usesNullableGetter = boolArg('nullable-getter');
|
final bool usesNullableGetter = boolArgDeprecated('nullable-getter');
|
||||||
|
|
||||||
precacheLanguageAndRegionTags();
|
precacheLanguageAndRegionTags();
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class IdeConfigCommand extends FlutterCommand {
|
|||||||
manifest.add('$relativePath${Template.copyTemplateExtension}');
|
manifest.add('$relativePath${Template.copyTemplateExtension}');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (boolArg('overwrite')) {
|
if (boolArgDeprecated('overwrite')) {
|
||||||
finalDestinationFile.deleteSync();
|
finalDestinationFile.deleteSync();
|
||||||
globals.printStatus(' $relativeDestination (overwritten)');
|
globals.printStatus(' $relativeDestination (overwritten)');
|
||||||
} else {
|
} else {
|
||||||
@ -174,7 +174,7 @@ class IdeConfigCommand extends FlutterCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we're not overwriting, then we're not going to remove missing items either.
|
// If we're not overwriting, then we're not going to remove missing items either.
|
||||||
if (!boolArg('overwrite')) {
|
if (!boolArgDeprecated('overwrite')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ class IdeConfigCommand extends FlutterCommand {
|
|||||||
throwToolExit('Currently, the only supported IDE is IntelliJ\n$usage', exitCode: 2);
|
throwToolExit('Currently, the only supported IDE is IntelliJ\n$usage', exitCode: 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boolArg('update-templates')) {
|
if (boolArgDeprecated('update-templates')) {
|
||||||
_handleTemplateUpdate();
|
_handleTemplateUpdate();
|
||||||
return FlutterCommandResult.success();
|
return FlutterCommandResult.success();
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ class IdeConfigCommand extends FlutterCommand {
|
|||||||
globals.printStatus('Updating IDE configuration for Flutter tree at $dirPath...');
|
globals.printStatus('Updating IDE configuration for Flutter tree at $dirPath...');
|
||||||
int generatedCount = 0;
|
int generatedCount = 0;
|
||||||
generatedCount += _renderTemplate(_ideName, dirPath, <String, Object>{
|
generatedCount += _renderTemplate(_ideName, dirPath, <String, Object>{
|
||||||
'withRootModule': boolArg('with-root-module'),
|
'withRootModule': boolArgDeprecated('with-root-module'),
|
||||||
'android': true,
|
'android': true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ class IdeConfigCommand extends FlutterCommand {
|
|||||||
return template.render(
|
return template.render(
|
||||||
globals.fs.directory(dirPath),
|
globals.fs.directory(dirPath),
|
||||||
context,
|
context,
|
||||||
overwriteExisting: boolArg('overwrite'),
|
overwriteExisting: boolArgDeprecated('overwrite'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class InstallCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts
|
|||||||
|
|
||||||
Device? device;
|
Device? device;
|
||||||
|
|
||||||
bool get uninstallOnly => boolArg('uninstall-only');
|
bool get uninstallOnly => boolArgDeprecated('uninstall-only');
|
||||||
String? get userIdentifier => stringArgDeprecated(FlutterOptions.kDeviceUser);
|
String? get userIdentifier => stringArgDeprecated(FlutterOptions.kDeviceUser);
|
||||||
|
|
||||||
String? get _applicationBinaryPath => stringArgDeprecated(FlutterOptions.kUseApplicationBinary);
|
String? get _applicationBinaryPath => stringArgDeprecated(FlutterOptions.kUseApplicationBinary);
|
||||||
|
@ -46,7 +46,7 @@ class LogsCommand extends FlutterCommand {
|
|||||||
@override
|
@override
|
||||||
Future<FlutterCommandResult> runCommand() async {
|
Future<FlutterCommandResult> runCommand() async {
|
||||||
final Device cachedDevice = device!;
|
final Device cachedDevice = device!;
|
||||||
if (boolArg('clear')) {
|
if (boolArgDeprecated('clear')) {
|
||||||
cachedDevice.clearLogs();
|
cachedDevice.clearLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class PackagesGetCommand extends FlutterCommand {
|
|||||||
directory: directory,
|
directory: directory,
|
||||||
upgrade: upgrade,
|
upgrade: upgrade,
|
||||||
shouldSkipThirdPartyGenerator: false,
|
shouldSkipThirdPartyGenerator: false,
|
||||||
offline: boolArg('offline'),
|
offline: boolArgDeprecated('offline'),
|
||||||
generateSyntheticPackage: flutterProject.manifest.generateSyntheticPackage,
|
generateSyntheticPackage: flutterProject.manifest.generateSyntheticPackage,
|
||||||
);
|
);
|
||||||
pubGetTimer.stop();
|
pubGetTimer.stop();
|
||||||
|
@ -106,7 +106,7 @@ class PrecacheCommand extends FlutterCommand {
|
|||||||
Set<String> _explicitArtifactSelections() {
|
Set<String> _explicitArtifactSelections() {
|
||||||
final Map<String, String> umbrellaForArtifact = _umbrellaForArtifactMap();
|
final Map<String, String> umbrellaForArtifact = _umbrellaForArtifactMap();
|
||||||
final Set<String> selections = <String>{};
|
final Set<String> selections = <String>{};
|
||||||
bool explicitlySelected(String name) => boolArg(name) && argResults.wasParsed(name);
|
bool explicitlySelected(String name) => boolArgDeprecated(name) && argResults.wasParsed(name);
|
||||||
for (final DevelopmentArtifact artifact in DevelopmentArtifact.values) {
|
for (final DevelopmentArtifact artifact in DevelopmentArtifact.values) {
|
||||||
final String umbrellaName = umbrellaForArtifact[artifact.name];
|
final String umbrellaName = umbrellaForArtifact[artifact.name];
|
||||||
if (explicitlySelected(artifact.name) ||
|
if (explicitlySelected(artifact.name) ||
|
||||||
@ -139,15 +139,15 @@ class PrecacheCommand extends FlutterCommand {
|
|||||||
if (_platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true') {
|
if (_platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true') {
|
||||||
await _cache.lock();
|
await _cache.lock();
|
||||||
}
|
}
|
||||||
if (boolArg('force')) {
|
if (boolArgDeprecated('force')) {
|
||||||
_cache.clearStampFiles();
|
_cache.clearStampFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
final bool includeAllPlatforms = boolArg('all-platforms');
|
final bool includeAllPlatforms = boolArgDeprecated('all-platforms');
|
||||||
if (includeAllPlatforms) {
|
if (includeAllPlatforms) {
|
||||||
_cache.includeAllPlatforms = true;
|
_cache.includeAllPlatforms = true;
|
||||||
}
|
}
|
||||||
if (boolArg('use-unsigned-mac-binaries')) {
|
if (boolArgDeprecated('use-unsigned-mac-binaries')) {
|
||||||
_cache.useUnsignedMacBinaries = true;
|
_cache.useUnsignedMacBinaries = true;
|
||||||
}
|
}
|
||||||
final Set<String> explicitlyEnabled = _explicitArtifactSelections();
|
final Set<String> explicitlyEnabled = _explicitArtifactSelections();
|
||||||
@ -164,7 +164,7 @@ class PrecacheCommand extends FlutterCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String argumentName = umbrellaForArtifact[artifact.name] ?? artifact.name;
|
final String argumentName = umbrellaForArtifact[artifact.name] ?? artifact.name;
|
||||||
if (includeAllPlatforms || boolArg(argumentName) || downloadDefaultArtifacts) {
|
if (includeAllPlatforms || boolArgDeprecated(argumentName) || downloadDefaultArtifacts) {
|
||||||
requiredArtifacts.add(artifact);
|
requiredArtifacts.add(artifact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,16 +162,16 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
|||||||
addEnableImpellerFlag(verboseHelp: verboseHelp);
|
addEnableImpellerFlag(verboseHelp: verboseHelp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get traceStartup => boolArg('trace-startup');
|
bool get traceStartup => boolArgDeprecated('trace-startup');
|
||||||
bool get cacheSkSL => boolArg('cache-sksl');
|
bool get cacheSkSL => boolArgDeprecated('cache-sksl');
|
||||||
bool get dumpSkpOnShaderCompilation => boolArg('dump-skp-on-shader-compilation');
|
bool get dumpSkpOnShaderCompilation => boolArgDeprecated('dump-skp-on-shader-compilation');
|
||||||
bool get purgePersistentCache => boolArg('purge-persistent-cache');
|
bool get purgePersistentCache => boolArgDeprecated('purge-persistent-cache');
|
||||||
bool get disableServiceAuthCodes => boolArg('disable-service-auth-codes');
|
bool get disableServiceAuthCodes => boolArgDeprecated('disable-service-auth-codes');
|
||||||
bool get cacheStartupProfile => boolArg('cache-startup-profile');
|
bool get cacheStartupProfile => boolArgDeprecated('cache-startup-profile');
|
||||||
bool get runningWithPrebuiltApplication => argResults[FlutterOptions.kUseApplicationBinary] != null;
|
bool get runningWithPrebuiltApplication => argResults[FlutterOptions.kUseApplicationBinary] != null;
|
||||||
bool get trackWidgetCreation => boolArg('track-widget-creation');
|
bool get trackWidgetCreation => boolArgDeprecated('track-widget-creation');
|
||||||
bool get enableImpeller => boolArg('enable-impeller');
|
bool get enableImpeller => boolArgDeprecated('enable-impeller');
|
||||||
bool get uninstallFirst => boolArg('uninstall-first');
|
bool get uninstallFirst => boolArgDeprecated('uninstall-first');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get reportNullSafety => true;
|
bool get reportNullSafety => true;
|
||||||
@ -198,8 +198,8 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
|||||||
webUseSseForDebugProxy: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-protocol') == 'sse',
|
webUseSseForDebugProxy: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-protocol') == 'sse',
|
||||||
webUseSseForDebugBackend: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-backend-protocol') == 'sse',
|
webUseSseForDebugBackend: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-backend-protocol') == 'sse',
|
||||||
webUseSseForInjectedClient: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-injected-client-protocol') == 'sse',
|
webUseSseForInjectedClient: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-injected-client-protocol') == 'sse',
|
||||||
webEnableExposeUrl: featureFlags.isWebEnabled && boolArg('web-allow-expose-url'),
|
webEnableExposeUrl: featureFlags.isWebEnabled && boolArgDeprecated('web-allow-expose-url'),
|
||||||
webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'),
|
webRunHeadless: featureFlags.isWebEnabled && boolArgDeprecated('web-run-headless'),
|
||||||
webBrowserDebugPort: browserDebugPort,
|
webBrowserDebugPort: browserDebugPort,
|
||||||
enableImpeller: enableImpeller,
|
enableImpeller: enableImpeller,
|
||||||
uninstallFirst: uninstallFirst,
|
uninstallFirst: uninstallFirst,
|
||||||
@ -207,20 +207,20 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
|||||||
} else {
|
} else {
|
||||||
return DebuggingOptions.enabled(
|
return DebuggingOptions.enabled(
|
||||||
buildInfo,
|
buildInfo,
|
||||||
startPaused: boolArg('start-paused'),
|
startPaused: boolArgDeprecated('start-paused'),
|
||||||
disableServiceAuthCodes: boolArg('disable-service-auth-codes'),
|
disableServiceAuthCodes: boolArgDeprecated('disable-service-auth-codes'),
|
||||||
cacheStartupProfile: cacheStartupProfile,
|
cacheStartupProfile: cacheStartupProfile,
|
||||||
enableDds: enableDds,
|
enableDds: enableDds,
|
||||||
dartEntrypointArgs: stringsArg('dart-entrypoint-args'),
|
dartEntrypointArgs: stringsArg('dart-entrypoint-args'),
|
||||||
dartFlags: stringArgDeprecated('dart-flags') ?? '',
|
dartFlags: stringArgDeprecated('dart-flags') ?? '',
|
||||||
useTestFonts: argParser.options.containsKey('use-test-fonts') && boolArg('use-test-fonts'),
|
useTestFonts: argParser.options.containsKey('use-test-fonts') && boolArgDeprecated('use-test-fonts'),
|
||||||
enableSoftwareRendering: argParser.options.containsKey('enable-software-rendering') && boolArg('enable-software-rendering'),
|
enableSoftwareRendering: argParser.options.containsKey('enable-software-rendering') && boolArgDeprecated('enable-software-rendering'),
|
||||||
skiaDeterministicRendering: argParser.options.containsKey('skia-deterministic-rendering') && boolArg('skia-deterministic-rendering'),
|
skiaDeterministicRendering: argParser.options.containsKey('skia-deterministic-rendering') && boolArgDeprecated('skia-deterministic-rendering'),
|
||||||
traceSkia: boolArg('trace-skia'),
|
traceSkia: boolArgDeprecated('trace-skia'),
|
||||||
traceAllowlist: traceAllowlist,
|
traceAllowlist: traceAllowlist,
|
||||||
traceSkiaAllowlist: stringArgDeprecated('trace-skia-allowlist'),
|
traceSkiaAllowlist: stringArgDeprecated('trace-skia-allowlist'),
|
||||||
traceSystrace: boolArg('trace-systrace'),
|
traceSystrace: boolArgDeprecated('trace-systrace'),
|
||||||
endlessTraceBuffer: boolArg('endless-trace-buffer'),
|
endlessTraceBuffer: boolArgDeprecated('endless-trace-buffer'),
|
||||||
dumpSkpOnShaderCompilation: dumpSkpOnShaderCompilation,
|
dumpSkpOnShaderCompilation: dumpSkpOnShaderCompilation,
|
||||||
cacheSkSL: cacheSkSL,
|
cacheSkSL: cacheSkSL,
|
||||||
purgePersistentCache: purgePersistentCache,
|
purgePersistentCache: purgePersistentCache,
|
||||||
@ -229,23 +229,23 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
|||||||
disablePortPublication: disablePortPublication,
|
disablePortPublication: disablePortPublication,
|
||||||
ddsPort: ddsPort,
|
ddsPort: ddsPort,
|
||||||
devToolsServerAddress: devToolsServerAddress,
|
devToolsServerAddress: devToolsServerAddress,
|
||||||
verboseSystemLogs: boolArg('verbose-system-logs'),
|
verboseSystemLogs: boolArgDeprecated('verbose-system-logs'),
|
||||||
hostname: featureFlags.isWebEnabled ? stringArgDeprecated('web-hostname') : '',
|
hostname: featureFlags.isWebEnabled ? stringArgDeprecated('web-hostname') : '',
|
||||||
port: featureFlags.isWebEnabled ? stringArgDeprecated('web-port') : '',
|
port: featureFlags.isWebEnabled ? stringArgDeprecated('web-port') : '',
|
||||||
webUseSseForDebugProxy: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-protocol') == 'sse',
|
webUseSseForDebugProxy: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-protocol') == 'sse',
|
||||||
webUseSseForDebugBackend: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-backend-protocol') == 'sse',
|
webUseSseForDebugBackend: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-backend-protocol') == 'sse',
|
||||||
webUseSseForInjectedClient: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-injected-client-protocol') == 'sse',
|
webUseSseForInjectedClient: featureFlags.isWebEnabled && stringArgDeprecated('web-server-debug-injected-client-protocol') == 'sse',
|
||||||
webEnableExposeUrl: featureFlags.isWebEnabled && boolArg('web-allow-expose-url'),
|
webEnableExposeUrl: featureFlags.isWebEnabled && boolArgDeprecated('web-allow-expose-url'),
|
||||||
webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'),
|
webRunHeadless: featureFlags.isWebEnabled && boolArgDeprecated('web-run-headless'),
|
||||||
webBrowserDebugPort: browserDebugPort,
|
webBrowserDebugPort: browserDebugPort,
|
||||||
webEnableExpressionEvaluation: featureFlags.isWebEnabled && boolArg('web-enable-expression-evaluation'),
|
webEnableExpressionEvaluation: featureFlags.isWebEnabled && boolArgDeprecated('web-enable-expression-evaluation'),
|
||||||
webLaunchUrl: featureFlags.isWebEnabled ? stringArgDeprecated('web-launch-url') : null,
|
webLaunchUrl: featureFlags.isWebEnabled ? stringArgDeprecated('web-launch-url') : null,
|
||||||
vmserviceOutFile: stringArgDeprecated('vmservice-out-file'),
|
vmserviceOutFile: stringArgDeprecated('vmservice-out-file'),
|
||||||
fastStart: argParser.options.containsKey('fast-start')
|
fastStart: argParser.options.containsKey('fast-start')
|
||||||
&& boolArg('fast-start')
|
&& boolArgDeprecated('fast-start')
|
||||||
&& !runningWithPrebuiltApplication,
|
&& !runningWithPrebuiltApplication,
|
||||||
nullAssertions: boolArg('null-assertions'),
|
nullAssertions: boolArgDeprecated('null-assertions'),
|
||||||
nativeNullAssertions: boolArg('native-null-assertions'),
|
nativeNullAssertions: boolArgDeprecated('native-null-assertions'),
|
||||||
enableImpeller: enableImpeller,
|
enableImpeller: enableImpeller,
|
||||||
uninstallFirst: uninstallFirst,
|
uninstallFirst: uninstallFirst,
|
||||||
);
|
);
|
||||||
@ -359,7 +359,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
final String name = 'run';
|
final String name = 'run';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
DeprecationBehavior get deprecationBehavior => boolArg('ignore-deprecation') ? DeprecationBehavior.ignore : _deviceDeprecationBehavior;
|
DeprecationBehavior get deprecationBehavior => boolArgDeprecated('ignore-deprecation') ? DeprecationBehavior.ignore : _deviceDeprecationBehavior;
|
||||||
DeprecationBehavior _deviceDeprecationBehavior = DeprecationBehavior.none;
|
DeprecationBehavior _deviceDeprecationBehavior = DeprecationBehavior.none;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -466,13 +466,13 @@ class RunCommand extends RunCommandBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool shouldUseHotMode(BuildInfo buildInfo) {
|
bool shouldUseHotMode(BuildInfo buildInfo) {
|
||||||
final bool hotArg = boolArg('hot') ?? false;
|
final bool hotArg = boolArgDeprecated('hot') ?? false;
|
||||||
final bool shouldUseHotMode = hotArg && !traceStartup;
|
final bool shouldUseHotMode = hotArg && !traceStartup;
|
||||||
return buildInfo.isDebug && shouldUseHotMode;
|
return buildInfo.isDebug && shouldUseHotMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get stayResident => boolArg('resident');
|
bool get stayResident => boolArgDeprecated('resident');
|
||||||
bool get awaitFirstFrameWhenTracing => boolArg('await-first-frame-when-tracing');
|
bool get awaitFirstFrameWhenTracing => boolArgDeprecated('await-first-frame-when-tracing');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> validateCommand() async {
|
Future<void> validateCommand() async {
|
||||||
@ -519,7 +519,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
flutterDevices,
|
flutterDevices,
|
||||||
target: targetFile,
|
target: targetFile,
|
||||||
debuggingOptions: await createDebuggingOptions(webMode),
|
debuggingOptions: await createDebuggingOptions(webMode),
|
||||||
benchmarkMode: boolArg('benchmark'),
|
benchmarkMode: boolArgDeprecated('benchmark'),
|
||||||
applicationBinary: applicationBinaryPath == null
|
applicationBinary: applicationBinaryPath == null
|
||||||
? null
|
? null
|
||||||
: globals.fs.file(applicationBinaryPath),
|
: globals.fs.file(applicationBinaryPath),
|
||||||
@ -527,7 +527,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
dillOutputPath: stringArgDeprecated('output-dill'),
|
dillOutputPath: stringArgDeprecated('output-dill'),
|
||||||
stayResident: stayResident,
|
stayResident: stayResident,
|
||||||
ipv6: ipv6,
|
ipv6: ipv6,
|
||||||
multidexEnabled: boolArg('multidex'),
|
multidexEnabled: boolArgDeprecated('multidex'),
|
||||||
);
|
);
|
||||||
} else if (webMode) {
|
} else if (webMode) {
|
||||||
return webRunnerFactory.createWebRunner(
|
return webRunnerFactory.createWebRunner(
|
||||||
@ -555,7 +555,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
: globals.fs.file(applicationBinaryPath),
|
: globals.fs.file(applicationBinaryPath),
|
||||||
ipv6: ipv6,
|
ipv6: ipv6,
|
||||||
stayResident: stayResident,
|
stayResident: stayResident,
|
||||||
multidexEnabled: boolArg('multidex'),
|
multidexEnabled: boolArgDeprecated('multidex'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +582,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
final bool hotMode = shouldUseHotMode(buildInfo);
|
final bool hotMode = shouldUseHotMode(buildInfo);
|
||||||
final String applicationBinaryPath = stringArgDeprecated(FlutterOptions.kUseApplicationBinary);
|
final String applicationBinaryPath = stringArgDeprecated(FlutterOptions.kUseApplicationBinary);
|
||||||
|
|
||||||
if (boolArg('machine')) {
|
if (boolArgDeprecated('machine')) {
|
||||||
if (devices.length > 1) {
|
if (devices.length > 1) {
|
||||||
throwToolExit('"--machine" does not support "-d all".');
|
throwToolExit('"--machine" does not support "-d all".');
|
||||||
}
|
}
|
||||||
@ -600,7 +600,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
packagesFilePath: globalResults['packages'] as String,
|
packagesFilePath: globalResults['packages'] as String,
|
||||||
dillOutputPath: stringArgDeprecated('output-dill'),
|
dillOutputPath: stringArgDeprecated('output-dill'),
|
||||||
ipv6: ipv6,
|
ipv6: ipv6,
|
||||||
multidexEnabled: boolArg('multidex'),
|
multidexEnabled: boolArgDeprecated('multidex'),
|
||||||
);
|
);
|
||||||
} on Exception catch (error) {
|
} on Exception catch (error) {
|
||||||
throwToolExit(error.toString());
|
throwToolExit(error.toString());
|
||||||
@ -632,7 +632,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (await device.isLocalEmulator && await device.supportsHardwareRendering) {
|
if (await device.isLocalEmulator && await device.supportsHardwareRendering) {
|
||||||
if (boolArg('enable-software-rendering')) {
|
if (boolArgDeprecated('enable-software-rendering')) {
|
||||||
globals.printStatus(
|
globals.printStatus(
|
||||||
'Using software rendering with device ${device.name}. You may get better performance '
|
'Using software rendering with device ${device.name}. You may get better performance '
|
||||||
'with hardware mode by configuring hardware rendering for your device.'
|
'with hardware mode by configuring hardware rendering for your device.'
|
||||||
@ -690,7 +690,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
terminal: globals.terminal,
|
terminal: globals.terminal,
|
||||||
signals: globals.signals,
|
signals: globals.signals,
|
||||||
processInfo: globals.processInfo,
|
processInfo: globals.processInfo,
|
||||||
reportReady: boolArg('report-ready'),
|
reportReady: boolArgDeprecated('report-ready'),
|
||||||
pidFile: stringArgDeprecated('pid-file'),
|
pidFile: stringArgDeprecated('pid-file'),
|
||||||
)
|
)
|
||||||
..registerSignalHandlers()
|
..registerSignalHandlers()
|
||||||
@ -701,7 +701,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
try {
|
try {
|
||||||
final int result = await runner.run(
|
final int result = await runner.run(
|
||||||
appStartedCompleter: appStartedTimeRecorder,
|
appStartedCompleter: appStartedTimeRecorder,
|
||||||
enableDevTools: stayResident && boolArg(FlutterCommand.kEnableDevTools),
|
enableDevTools: stayResident && boolArgDeprecated(FlutterCommand.kEnableDevTools),
|
||||||
route: route,
|
route: route,
|
||||||
);
|
);
|
||||||
handler?.stop();
|
handler?.stop();
|
||||||
|
@ -54,7 +54,7 @@ class ShellCompletionCommand extends FlutterCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final File outputFile = globals.fs.file(rest.first);
|
final File outputFile = globals.fs.file(rest.first);
|
||||||
if (outputFile.existsSync() && !boolArg('overwrite')) {
|
if (outputFile.existsSync() && !boolArgDeprecated('overwrite')) {
|
||||||
throwToolExit(
|
throwToolExit(
|
||||||
'Output file ${outputFile.path} already exists, will not overwrite. '
|
'Output file ${outputFile.path} already exists, will not overwrite. '
|
||||||
'Use --overwrite to force overwriting existing output file.',
|
'Use --overwrite to force overwriting existing output file.',
|
||||||
|
@ -302,7 +302,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
|||||||
'directory (or one of its subdirectories).');
|
'directory (or one of its subdirectories).');
|
||||||
}
|
}
|
||||||
final FlutterProject flutterProject = FlutterProject.current();
|
final FlutterProject flutterProject = FlutterProject.current();
|
||||||
final bool buildTestAssets = boolArg('test-assets');
|
final bool buildTestAssets = boolArgDeprecated('test-assets');
|
||||||
final List<String> names = stringsArg('name');
|
final List<String> names = stringsArg('name');
|
||||||
final List<String> plainNames = stringsArg('plain-name');
|
final List<String> plainNames = stringsArg('plain-name');
|
||||||
final String tags = stringArgDeprecated('tags');
|
final String tags = stringArgDeprecated('tags');
|
||||||
@ -324,7 +324,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
|||||||
await _buildTestAsset();
|
await _buildTestAsset();
|
||||||
}
|
}
|
||||||
|
|
||||||
final bool startPaused = boolArg('start-paused');
|
final bool startPaused = boolArgDeprecated('start-paused');
|
||||||
if (startPaused && _testFiles.length != 1) {
|
if (startPaused && _testFiles.length != 1) {
|
||||||
throwToolExit(
|
throwToolExit(
|
||||||
'When using --start-paused, you must specify a single test file to run.',
|
'When using --start-paused, you must specify a single test file to run.',
|
||||||
@ -371,9 +371,9 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
|||||||
'If you set --shard-index you need to also set --total-shards.');
|
'If you set --shard-index you need to also set --total-shards.');
|
||||||
}
|
}
|
||||||
|
|
||||||
final bool machine = boolArg('machine');
|
final bool machine = boolArgDeprecated('machine');
|
||||||
CoverageCollector collector;
|
CoverageCollector collector;
|
||||||
if (boolArg('coverage') || boolArg('merge-coverage')) {
|
if (boolArgDeprecated('coverage') || boolArgDeprecated('merge-coverage')) {
|
||||||
final String projectName = flutterProject.manifest.appName;
|
final String projectName = flutterProject.manifest.appName;
|
||||||
collector = CoverageCollector(
|
collector = CoverageCollector(
|
||||||
verbose: !machine,
|
verbose: !machine,
|
||||||
@ -392,11 +392,11 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
|||||||
final DebuggingOptions debuggingOptions = DebuggingOptions.enabled(
|
final DebuggingOptions debuggingOptions = DebuggingOptions.enabled(
|
||||||
buildInfo,
|
buildInfo,
|
||||||
startPaused: startPaused,
|
startPaused: startPaused,
|
||||||
disableServiceAuthCodes: boolArg('disable-service-auth-codes'),
|
disableServiceAuthCodes: boolArgDeprecated('disable-service-auth-codes'),
|
||||||
// On iOS >=14, keeping this enabled will leave a prompt on the screen.
|
// On iOS >=14, keeping this enabled will leave a prompt on the screen.
|
||||||
disablePortPublication: true,
|
disablePortPublication: true,
|
||||||
enableDds: enableDds,
|
enableDds: enableDds,
|
||||||
nullAssertions: boolArg(FlutterOptions.kNullAssertions),
|
nullAssertions: boolArgDeprecated(FlutterOptions.kNullAssertions),
|
||||||
);
|
);
|
||||||
|
|
||||||
Device integrationTestDevice;
|
Device integrationTestDevice;
|
||||||
@ -439,10 +439,10 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
|||||||
tags: tags,
|
tags: tags,
|
||||||
excludeTags: excludeTags,
|
excludeTags: excludeTags,
|
||||||
watcher: watcher,
|
watcher: watcher,
|
||||||
enableObservatory: collector != null || startPaused || boolArg('enable-vmservice'),
|
enableObservatory: collector != null || startPaused || boolArgDeprecated('enable-vmservice'),
|
||||||
ipv6: boolArg('ipv6'),
|
ipv6: boolArgDeprecated('ipv6'),
|
||||||
machine: machine,
|
machine: machine,
|
||||||
updateGoldens: boolArg('update-goldens'),
|
updateGoldens: boolArgDeprecated('update-goldens'),
|
||||||
concurrency: jobs,
|
concurrency: jobs,
|
||||||
buildTestAssets: buildTestAssets,
|
buildTestAssets: buildTestAssets,
|
||||||
flutterProject: flutterProject,
|
flutterProject: flutterProject,
|
||||||
@ -450,7 +450,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
|||||||
randomSeed: stringArgDeprecated('test-randomize-ordering-seed'),
|
randomSeed: stringArgDeprecated('test-randomize-ordering-seed'),
|
||||||
reporter: stringArgDeprecated('reporter'),
|
reporter: stringArgDeprecated('reporter'),
|
||||||
timeout: stringArgDeprecated('timeout'),
|
timeout: stringArgDeprecated('timeout'),
|
||||||
runSkipped: boolArg('run-skipped'),
|
runSkipped: boolArgDeprecated('run-skipped'),
|
||||||
shardIndex: shardIndex,
|
shardIndex: shardIndex,
|
||||||
totalShards: totalShards,
|
totalShards: totalShards,
|
||||||
integrationTestDevice: integrationTestDevice,
|
integrationTestDevice: integrationTestDevice,
|
||||||
@ -460,7 +460,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
|||||||
if (collector != null) {
|
if (collector != null) {
|
||||||
final bool collectionResult = collector.collectCoverageData(
|
final bool collectionResult = collector.collectCoverageData(
|
||||||
stringArgDeprecated('coverage-path'),
|
stringArgDeprecated('coverage-path'),
|
||||||
mergeCoverageData: boolArg('merge-coverage'),
|
mergeCoverageData: boolArgDeprecated('merge-coverage'),
|
||||||
);
|
);
|
||||||
if (!collectionResult) {
|
if (!collectionResult) {
|
||||||
throwToolExit(null);
|
throwToolExit(null);
|
||||||
|
@ -145,15 +145,15 @@ class UpdatePackagesCommand extends FlutterCommand {
|
|||||||
Future<FlutterCommandResult> runCommand() async {
|
Future<FlutterCommandResult> runCommand() async {
|
||||||
final List<Directory> packages = runner!.getRepoPackages();
|
final List<Directory> packages = runner!.getRepoPackages();
|
||||||
|
|
||||||
final bool forceUpgrade = boolArg('force-upgrade');
|
final bool forceUpgrade = boolArgDeprecated('force-upgrade');
|
||||||
final bool isPrintPaths = boolArg('paths');
|
final bool isPrintPaths = boolArgDeprecated('paths');
|
||||||
final bool isPrintTransitiveClosure = boolArg('transitive-closure');
|
final bool isPrintTransitiveClosure = boolArgDeprecated('transitive-closure');
|
||||||
final bool isVerifyOnly = boolArg('verify-only');
|
final bool isVerifyOnly = boolArgDeprecated('verify-only');
|
||||||
final bool isConsumerOnly = boolArg('consumer-only');
|
final bool isConsumerOnly = boolArgDeprecated('consumer-only');
|
||||||
final bool offline = boolArg('offline');
|
final bool offline = boolArgDeprecated('offline');
|
||||||
final bool doUpgrade = forceUpgrade || isPrintPaths || isPrintTransitiveClosure;
|
final bool doUpgrade = forceUpgrade || isPrintPaths || isPrintTransitiveClosure;
|
||||||
|
|
||||||
if (boolArg('crash')) {
|
if (boolArgDeprecated('crash')) {
|
||||||
throw StateError('test crash please ignore.');
|
throw StateError('test crash please ignore.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ class UpdatePackagesCommand extends FlutterCommand {
|
|||||||
context: PubContext.updatePackages,
|
context: PubContext.updatePackages,
|
||||||
directory: tempDir.path,
|
directory: tempDir.path,
|
||||||
upgrade: doUpgrade,
|
upgrade: doUpgrade,
|
||||||
offline: boolArg('offline'),
|
offline: boolArgDeprecated('offline'),
|
||||||
flutterRootOverride: temporaryFlutterSdk?.path,
|
flutterRootOverride: temporaryFlutterSdk?.path,
|
||||||
);
|
);
|
||||||
// Cleanup the temporary SDK
|
// Cleanup the temporary SDK
|
||||||
@ -454,14 +454,14 @@ class UpdatePackagesCommand extends FlutterCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boolArg('transitive-closure')) {
|
if (boolArgDeprecated('transitive-closure')) {
|
||||||
tree._dependencyTree.forEach((String from, Set<String> to) {
|
tree._dependencyTree.forEach((String from, Set<String> to) {
|
||||||
globals.printStatus('$from -> $to');
|
globals.printStatus('$from -> $to');
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boolArg('paths')) {
|
if (boolArgDeprecated('paths')) {
|
||||||
showDependencyPaths(from: stringArgDeprecated('from')!, to: stringArgDeprecated('to')!, tree: tree);
|
showDependencyPaths(from: stringArgDeprecated('from')!, to: stringArgDeprecated('to')!, tree: tree);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -72,14 +72,14 @@ class UpgradeCommand extends FlutterCommand {
|
|||||||
Future<FlutterCommandResult> runCommand() {
|
Future<FlutterCommandResult> runCommand() {
|
||||||
_commandRunner.workingDirectory = stringArgDeprecated('working-directory') ?? Cache.flutterRoot!;
|
_commandRunner.workingDirectory = stringArgDeprecated('working-directory') ?? Cache.flutterRoot!;
|
||||||
return _commandRunner.runCommand(
|
return _commandRunner.runCommand(
|
||||||
force: boolArg('force'),
|
force: boolArgDeprecated('force'),
|
||||||
continueFlow: boolArg('continue'),
|
continueFlow: boolArgDeprecated('continue'),
|
||||||
testFlow: stringArgDeprecated('working-directory') != null,
|
testFlow: stringArgDeprecated('working-directory') != null,
|
||||||
gitTagVersion: GitTagVersion.determine(globals.processUtils, globals.platform),
|
gitTagVersion: GitTagVersion.determine(globals.processUtils, globals.platform),
|
||||||
flutterVersion: stringArgDeprecated('working-directory') == null
|
flutterVersion: stringArgDeprecated('working-directory') == null
|
||||||
? globals.flutterVersion
|
? globals.flutterVersion
|
||||||
: FlutterVersion(workingDirectory: _commandRunner.workingDirectory),
|
: FlutterVersion(workingDirectory: _commandRunner.workingDirectory),
|
||||||
verifyOnly: boolArg('verify-only'),
|
verifyOnly: boolArgDeprecated('verify-only'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
|
|
||||||
DeprecationBehavior get deprecationBehavior => DeprecationBehavior.none;
|
DeprecationBehavior get deprecationBehavior => DeprecationBehavior.none;
|
||||||
|
|
||||||
bool get shouldRunPub => _usesPubOption && boolArg('pub');
|
bool get shouldRunPub => _usesPubOption && boolArgDeprecated('pub');
|
||||||
|
|
||||||
bool get shouldUpdateCache => true;
|
bool get shouldUpdateCache => true;
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
throwToolExit(
|
throwToolExit(
|
||||||
'The "--[no-]dds" and "--[no-]disable-dds" arguments are mutually exclusive. Only specify "--[no-]dds".');
|
'The "--[no-]dds" and "--[no-]disable-dds" arguments are mutually exclusive. Only specify "--[no-]dds".');
|
||||||
}
|
}
|
||||||
ddsEnabled = !boolArg('disable-dds');
|
ddsEnabled = !boolArgDeprecated('disable-dds');
|
||||||
// TODO(ianh): enable the following code once google3 is migrated away from --disable-dds (and add test to flutter_command_test.dart)
|
// TODO(ianh): enable the following code once google3 is migrated away from --disable-dds (and add test to flutter_command_test.dart)
|
||||||
if (false) { // ignore: dead_code
|
if (false) { // ignore: dead_code
|
||||||
if (ddsEnabled) {
|
if (ddsEnabled) {
|
||||||
@ -441,7 +441,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ddsEnabled = boolArg('dds');
|
ddsEnabled = boolArgDeprecated('dds');
|
||||||
}
|
}
|
||||||
return ddsEnabled;
|
return ddsEnabled;
|
||||||
}();
|
}();
|
||||||
@ -533,7 +533,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get disablePortPublication => !boolArg('publish-port');
|
bool get disablePortPublication => !boolArgDeprecated('publish-port');
|
||||||
|
|
||||||
void usesIpv6Flag({required bool verboseHelp}) {
|
void usesIpv6Flag({required bool verboseHelp}) {
|
||||||
argParser.addFlag(ipv6Flag,
|
argParser.addFlag(ipv6Flag,
|
||||||
@ -546,7 +546,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
_usesIpv6Flag = true;
|
_usesIpv6Flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool? get ipv6 => _usesIpv6Flag ? boolArg('ipv6') : null;
|
bool? get ipv6 => _usesIpv6Flag ? boolArgDeprecated('ipv6') : null;
|
||||||
|
|
||||||
void usesBuildNumberOption() {
|
void usesBuildNumberOption() {
|
||||||
argParser.addOption('build-number',
|
argParser.addOption('build-number',
|
||||||
@ -893,13 +893,13 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
BuildMode getBuildMode() {
|
BuildMode getBuildMode() {
|
||||||
// No debug when _excludeDebug is true.
|
// No debug when _excludeDebug is true.
|
||||||
// If debug is not excluded, then take the command line flag.
|
// If debug is not excluded, then take the command line flag.
|
||||||
final bool debugResult = !_excludeDebug && boolArg('debug');
|
final bool debugResult = !_excludeDebug && boolArgDeprecated('debug');
|
||||||
final bool jitReleaseResult = !_excludeRelease && boolArg('jit-release');
|
final bool jitReleaseResult = !_excludeRelease && boolArgDeprecated('jit-release');
|
||||||
final bool releaseResult = !_excludeRelease && boolArg('release');
|
final bool releaseResult = !_excludeRelease && boolArgDeprecated('release');
|
||||||
final List<bool> modeFlags = <bool>[
|
final List<bool> modeFlags = <bool>[
|
||||||
debugResult,
|
debugResult,
|
||||||
jitReleaseResult,
|
jitReleaseResult,
|
||||||
boolArg('profile'),
|
boolArgDeprecated('profile'),
|
||||||
releaseResult,
|
releaseResult,
|
||||||
];
|
];
|
||||||
if (modeFlags.where((bool flag) => flag).length > 1) {
|
if (modeFlags.where((bool flag) => flag).length > 1) {
|
||||||
@ -909,7 +909,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
if (debugResult) {
|
if (debugResult) {
|
||||||
return BuildMode.debug;
|
return BuildMode.debug;
|
||||||
}
|
}
|
||||||
if (boolArg('profile')) {
|
if (boolArgDeprecated('profile')) {
|
||||||
return BuildMode.profile;
|
return BuildMode.profile;
|
||||||
}
|
}
|
||||||
if (releaseResult) {
|
if (releaseResult) {
|
||||||
@ -977,7 +977,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
/// each other.
|
/// each other.
|
||||||
Future<BuildInfo> getBuildInfo({ BuildMode? forcedBuildMode, File? forcedTargetFile }) async {
|
Future<BuildInfo> getBuildInfo({ BuildMode? forcedBuildMode, File? forcedTargetFile }) async {
|
||||||
final bool trackWidgetCreation = argParser.options.containsKey('track-widget-creation') &&
|
final bool trackWidgetCreation = argParser.options.containsKey('track-widget-creation') &&
|
||||||
boolArg('track-widget-creation');
|
boolArgDeprecated('track-widget-creation');
|
||||||
|
|
||||||
final String? buildNumber = argParser.options.containsKey('build-number')
|
final String? buildNumber = argParser.options.containsKey('build-number')
|
||||||
? stringArgDeprecated('build-number')
|
? stringArgDeprecated('build-number')
|
||||||
@ -1010,7 +1010,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String? codeSizeDirectory;
|
String? codeSizeDirectory;
|
||||||
if (argParser.options.containsKey(FlutterOptions.kAnalyzeSize) && boolArg(FlutterOptions.kAnalyzeSize)) {
|
if (argParser.options.containsKey(FlutterOptions.kAnalyzeSize) && boolArgDeprecated(FlutterOptions.kAnalyzeSize)) {
|
||||||
Directory directory = globals.fsUtils.getUniqueDirectory(
|
Directory directory = globals.fsUtils.getUniqueDirectory(
|
||||||
globals.fs.directory(getBuildDirectory()),
|
globals.fs.directory(getBuildDirectory()),
|
||||||
'flutter_size',
|
'flutter_size',
|
||||||
@ -1046,7 +1046,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
// This mode is only used for commands which do not build a single target like
|
// This mode is only used for commands which do not build a single target like
|
||||||
// 'flutter test'.
|
// 'flutter test'.
|
||||||
nullSafetyMode = NullSafetyMode.autodetect;
|
nullSafetyMode = NullSafetyMode.autodetect;
|
||||||
} else if (boolArg(FlutterOptions.kNullSafety)) {
|
} else if (boolArgDeprecated(FlutterOptions.kNullSafety)) {
|
||||||
nullSafetyMode = NullSafetyMode.sound;
|
nullSafetyMode = NullSafetyMode.sound;
|
||||||
extraFrontEndOptions.add('--sound-null-safety');
|
extraFrontEndOptions.add('--sound-null-safety');
|
||||||
} else {
|
} else {
|
||||||
@ -1056,14 +1056,14 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final bool dartObfuscation = argParser.options.containsKey(FlutterOptions.kDartObfuscationOption)
|
final bool dartObfuscation = argParser.options.containsKey(FlutterOptions.kDartObfuscationOption)
|
||||||
&& boolArg(FlutterOptions.kDartObfuscationOption);
|
&& boolArgDeprecated(FlutterOptions.kDartObfuscationOption);
|
||||||
|
|
||||||
final String? splitDebugInfoPath = argParser.options.containsKey(FlutterOptions.kSplitDebugInfoOption)
|
final String? splitDebugInfoPath = argParser.options.containsKey(FlutterOptions.kSplitDebugInfoOption)
|
||||||
? stringArgDeprecated(FlutterOptions.kSplitDebugInfoOption)
|
? stringArgDeprecated(FlutterOptions.kSplitDebugInfoOption)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
final bool androidGradleDaemon = !argParser.options.containsKey(FlutterOptions.kAndroidGradleDaemon)
|
final bool androidGradleDaemon = !argParser.options.containsKey(FlutterOptions.kAndroidGradleDaemon)
|
||||||
|| boolArg(FlutterOptions.kAndroidGradleDaemon);
|
|| boolArgDeprecated(FlutterOptions.kAndroidGradleDaemon);
|
||||||
|
|
||||||
final List<String> androidProjectArgs = argParser.options.containsKey(FlutterOptions.kAndroidProjectArgs)
|
final List<String> androidProjectArgs = argParser.options.containsKey(FlutterOptions.kAndroidProjectArgs)
|
||||||
? stringsArg(FlutterOptions.kAndroidProjectArgs)
|
? stringsArg(FlutterOptions.kAndroidProjectArgs)
|
||||||
@ -1085,7 +1085,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
|
|
||||||
final bool treeShakeIcons = argParser.options.containsKey('tree-shake-icons')
|
final bool treeShakeIcons = argParser.options.containsKey('tree-shake-icons')
|
||||||
&& buildMode.isPrecompiled == true
|
&& buildMode.isPrecompiled == true
|
||||||
&& boolArg('tree-shake-icons');
|
&& boolArgDeprecated('tree-shake-icons');
|
||||||
|
|
||||||
final String? bundleSkSLPath = argParser.options.containsKey(FlutterOptions.kBundleSkSLPathOption)
|
final String? bundleSkSLPath = argParser.options.containsKey(FlutterOptions.kBundleSkSLPathOption)
|
||||||
? stringArgDeprecated(FlutterOptions.kBundleSkSLPathOption)
|
? stringArgDeprecated(FlutterOptions.kBundleSkSLPathOption)
|
||||||
@ -1141,7 +1141,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
? stringArgDeprecated(FlutterOptions.kInitializeFromDill)
|
? stringArgDeprecated(FlutterOptions.kInitializeFromDill)
|
||||||
: null,
|
: null,
|
||||||
assumeInitializeFromDillUpToDate: argParser.options.containsKey(FlutterOptions.kAssumeInitializeFromDillUpToDate)
|
assumeInitializeFromDillUpToDate: argParser.options.containsKey(FlutterOptions.kAssumeInitializeFromDillUpToDate)
|
||||||
&& boolArg(FlutterOptions.kAssumeInitializeFromDillUpToDate),
|
&& boolArgDeprecated(FlutterOptions.kAssumeInitializeFromDillUpToDate),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1180,7 +1180,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
overrides: <Type, Generator>{FlutterCommand: () => this},
|
overrides: <Type, Generator>{FlutterCommand: () => this},
|
||||||
body: () async {
|
body: () async {
|
||||||
if (_usesFatalWarnings) {
|
if (_usesFatalWarnings) {
|
||||||
globals.logger.fatalWarnings = boolArg(FlutterOptions.kFatalWarnings);
|
globals.logger.fatalWarnings = boolArgDeprecated(FlutterOptions.kFatalWarnings);
|
||||||
}
|
}
|
||||||
// Prints the welcome message if needed.
|
// Prints the welcome message if needed.
|
||||||
globals.flutterUsage.printWelcome();
|
globals.flutterUsage.printWelcome();
|
||||||
@ -1303,7 +1303,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
// ios-deploy on macOS) are required to determine `requiredArtifacts`.
|
// ios-deploy on macOS) are required to determine `requiredArtifacts`.
|
||||||
final bool offline;
|
final bool offline;
|
||||||
if (argParser.options.containsKey('offline')) {
|
if (argParser.options.containsKey('offline')) {
|
||||||
offline = boolArg('offline');
|
offline = boolArgDeprecated('offline');
|
||||||
} else {
|
} else {
|
||||||
offline = false;
|
offline = false;
|
||||||
}
|
}
|
||||||
@ -1519,7 +1519,16 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
ApplicationPackageFactory? applicationPackages;
|
ApplicationPackageFactory? applicationPackages;
|
||||||
|
|
||||||
/// Gets the parsed command-line option named [name] as a `bool`.
|
/// Gets the parsed command-line option named [name] as a `bool`.
|
||||||
bool boolArg(String name) => argResults?[name] as bool? ?? false;
|
/// This has been deprecated, use [boolArgDeprecated] instead.
|
||||||
|
bool boolArgDeprecated(String name) => argResults?[name] as bool? ?? false;
|
||||||
|
|
||||||
|
/// Gets the parsed command-line option named [name] as a `bool?`.
|
||||||
|
bool? boolArg(String name) {
|
||||||
|
if (argResults == null || !argParser.options.containsKey(name)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return argResults?[name] as bool?;
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets the parsed command-line option named [name] as a `String`.
|
/// Gets the parsed command-line option named [name] as a `String`.
|
||||||
String? stringArgDeprecated(String name) => argResults?[name] as String?;
|
String? stringArgDeprecated(String name) => argResults?[name] as String?;
|
||||||
|
@ -13,6 +13,7 @@ import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
|
|||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/context.dart';
|
import '../src/context.dart';
|
||||||
import '../src/testbed.dart';
|
import '../src/testbed.dart';
|
||||||
|
import 'runner/utils.dart';
|
||||||
|
|
||||||
class CommandDummy extends FlutterCommand{
|
class CommandDummy extends FlutterCommand{
|
||||||
@override
|
@override
|
||||||
@ -37,6 +38,29 @@ void main() {
|
|||||||
verifyCommandRunner(runner);
|
verifyCommandRunner(runner);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
testUsingContext('bool? safe argResults', () async {
|
||||||
|
final DummyFlutterCommand command = DummyFlutterCommand(
|
||||||
|
commandFunction: () async {
|
||||||
|
return const FlutterCommandResult(ExitStatus.success);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
final FlutterCommandRunner runner = FlutterCommandRunner(verboseHelp: true);
|
||||||
|
command.argParser.addFlag('key');
|
||||||
|
command.argParser.addFlag('key-false');
|
||||||
|
|
||||||
|
runner.addCommand(command);
|
||||||
|
await runner.run(<String>['dummy', '--key']);
|
||||||
|
|
||||||
|
expect(command.boolArg('key'), true);
|
||||||
|
expect(command.boolArg('empty'), null);
|
||||||
|
|
||||||
|
expect(command.boolArgDeprecated('key'), true);
|
||||||
|
expect(() => command.boolArgDeprecated('empty'), throwsA(const TypeMatcher<ArgumentError>()));
|
||||||
|
|
||||||
|
expect(command.boolArg('key-false'), false);
|
||||||
|
expect(command.boolArgDeprecated('key-false'), false);
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('String? safe argResults', () async {
|
testUsingContext('String? safe argResults', () async {
|
||||||
final CommandDummy command = CommandDummy();
|
final CommandDummy command = CommandDummy();
|
||||||
final FlutterCommandRunner runner = FlutterCommandRunner(verboseHelp: true);
|
final FlutterCommandRunner runner = FlutterCommandRunner(verboseHelp: true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user