[flutter_tools] add --uninstall-first flag and pipe it through to ios-deploy (#102948)
This commit is contained in:
committed by
GitHub
parent
4bed76757d
commit
09686a04c9
@@ -140,6 +140,11 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
||||
'this option multiple times each with one argument to pass '
|
||||
'multiple arguments to the Dart entrypoint. Currently this is '
|
||||
'only supported on desktop platforms.',
|
||||
)
|
||||
..addFlag('uninstall-first',
|
||||
hide: !verboseHelp,
|
||||
help: 'Uninstall previous versions of the app on the device '
|
||||
'before reinstalling. Currently only supported on iOS.',
|
||||
);
|
||||
usesWebOptions(verboseHelp: verboseHelp);
|
||||
usesTargetOption();
|
||||
@@ -166,6 +171,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
||||
bool get runningWithPrebuiltApplication => argResults[FlutterOptions.kUseApplicationBinary] != null;
|
||||
bool get trackWidgetCreation => boolArg('track-widget-creation');
|
||||
bool get enableImpeller => boolArg('enable-impeller');
|
||||
bool get uninstallFirst => boolArg('uninstall-first');
|
||||
|
||||
@override
|
||||
bool get reportNullSafety => true;
|
||||
@@ -196,6 +202,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
||||
webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'),
|
||||
webBrowserDebugPort: browserDebugPort,
|
||||
enableImpeller: enableImpeller,
|
||||
uninstallFirst: uninstallFirst,
|
||||
);
|
||||
} else {
|
||||
return DebuggingOptions.enabled(
|
||||
@@ -240,6 +247,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
||||
nullAssertions: boolArg('null-assertions'),
|
||||
nativeNullAssertions: boolArg('native-null-assertions'),
|
||||
enableImpeller: enableImpeller,
|
||||
uninstallFirst: uninstallFirst,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -792,6 +792,7 @@ class DebuggingOptions {
|
||||
this.nullAssertions = false,
|
||||
this.nativeNullAssertions = false,
|
||||
this.enableImpeller = false,
|
||||
this.uninstallFirst = false,
|
||||
}) : debuggingEnabled = true;
|
||||
|
||||
DebuggingOptions.disabled(this.buildInfo, {
|
||||
@@ -808,6 +809,7 @@ class DebuggingOptions {
|
||||
this.cacheSkSL = false,
|
||||
this.traceAllowlist,
|
||||
this.enableImpeller = false,
|
||||
this.uninstallFirst = false,
|
||||
}) : debuggingEnabled = false,
|
||||
useTestFonts = false,
|
||||
startPaused = false,
|
||||
@@ -876,6 +878,7 @@ class DebuggingOptions {
|
||||
required this.nullAssertions,
|
||||
required this.nativeNullAssertions,
|
||||
required this.enableImpeller,
|
||||
required this.uninstallFirst,
|
||||
});
|
||||
|
||||
final bool debuggingEnabled;
|
||||
@@ -912,6 +915,11 @@ class DebuggingOptions {
|
||||
final bool webUseSseForInjectedClient;
|
||||
final bool enableImpeller;
|
||||
|
||||
/// Whether the tool should try to uninstall a previously installed version of the app.
|
||||
///
|
||||
/// This is not implemented for every platform.
|
||||
final bool uninstallFirst;
|
||||
|
||||
/// Whether to run the browser in headless mode.
|
||||
///
|
||||
/// Some CI environments do not provide a display and fail to launch the
|
||||
@@ -1026,6 +1034,7 @@ class DebuggingOptions {
|
||||
nullAssertions: (json['nullAssertions'] as bool?)!,
|
||||
nativeNullAssertions: (json['nativeNullAssertions'] as bool?)!,
|
||||
enableImpeller: (json['enableImpeller'] as bool?) ?? false,
|
||||
uninstallFirst: (json['uninstallFirst'] as bool?) ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -394,6 +394,7 @@ class IOSDevice extends Device {
|
||||
appDeltaDirectory: package.appDeltaDirectory,
|
||||
launchArguments: launchArguments,
|
||||
interfaceType: interfaceType,
|
||||
uninstallFirst: debuggingOptions.uninstallFirst,
|
||||
);
|
||||
if (deviceLogReader is IOSDeviceLogReader) {
|
||||
deviceLogReader.debuggerStream = iosDeployDebugger;
|
||||
@@ -415,6 +416,7 @@ class IOSDevice extends Device {
|
||||
appDeltaDirectory: package.appDeltaDirectory,
|
||||
launchArguments: launchArguments,
|
||||
interfaceType: interfaceType,
|
||||
uninstallFirst: debuggingOptions.uninstallFirst,
|
||||
);
|
||||
} else {
|
||||
installationResult = await iosDeployDebugger!.launchAndAttach() ? 0 : 1;
|
||||
|
||||
@@ -127,6 +127,7 @@ class IOSDeploy {
|
||||
required List<String> launchArguments,
|
||||
required IOSDeviceConnectionInterface interfaceType,
|
||||
Directory? appDeltaDirectory,
|
||||
required bool uninstallFirst,
|
||||
}) {
|
||||
appDeltaDirectory?.createSync(recursive: true);
|
||||
// Interactive debug session to support sending the lldb detach command.
|
||||
@@ -144,6 +145,8 @@ class IOSDeploy {
|
||||
'--app_deltas',
|
||||
appDeltaDirectory.path,
|
||||
],
|
||||
if (uninstallFirst)
|
||||
'--uninstall',
|
||||
'--debug',
|
||||
if (interfaceType != IOSDeviceConnectionInterface.network)
|
||||
'--no-wifi',
|
||||
@@ -168,6 +171,7 @@ class IOSDeploy {
|
||||
required String bundlePath,
|
||||
required List<String> launchArguments,
|
||||
required IOSDeviceConnectionInterface interfaceType,
|
||||
required bool uninstallFirst,
|
||||
Directory? appDeltaDirectory,
|
||||
}) async {
|
||||
appDeltaDirectory?.createSync(recursive: true);
|
||||
@@ -183,6 +187,8 @@ class IOSDeploy {
|
||||
],
|
||||
if (interfaceType != IOSDeviceConnectionInterface.network)
|
||||
'--no-wifi',
|
||||
if (uninstallFirst)
|
||||
'--uninstall',
|
||||
'--justlaunch',
|
||||
if (launchArguments.isNotEmpty) ...<String>[
|
||||
'--args',
|
||||
|
||||
Reference in New Issue
Block a user