[flutter_tool] support --use-application-binary in flutter drive (#68060)
--use-application-binary allows running with an already built APK. This can be useful for speeding up CI test cases, or in our case eventually supporting some sort of build server. Demonstrate that this works by updating the old gallery test to use it. Fixes #56604 Co-authored-by: Jenn Magder <magder@google.com>
This commit is contained in:
@@ -466,8 +466,14 @@ Future<LaunchResult> _startApp(
|
||||
globals.printTrace('Stopping previously running application, if any.');
|
||||
await appStopper(command);
|
||||
|
||||
final ApplicationPackage package = await command.applicationPackages
|
||||
.getPackageForPlatform(await command.device.targetPlatform, buildInfo: command.getBuildInfo());
|
||||
final File applicationBinary = command.stringArg('use-application-binary') == null
|
||||
? null
|
||||
: globals.fs.file(command.stringArg('use-application-binary'));
|
||||
final ApplicationPackage package = await command.applicationPackages.getPackageForPlatform(
|
||||
await command.device.targetPlatform,
|
||||
buildInfo: command.getBuildInfo(),
|
||||
applicationBinary: applicationBinary,
|
||||
);
|
||||
|
||||
final Map<String, dynamic> platformArgs = <String, dynamic>{};
|
||||
if (command.traceStartup) {
|
||||
@@ -508,6 +514,7 @@ Future<LaunchResult> _startApp(
|
||||
),
|
||||
platformArgs: platformArgs,
|
||||
userIdentifier: userIdentifier,
|
||||
prebuiltApplication: applicationBinary != null,
|
||||
);
|
||||
|
||||
if (!result.started) {
|
||||
|
||||
@@ -70,7 +70,14 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
||||
negatable: false,
|
||||
hide: !verboseHelp,
|
||||
help: 'No longer require an authentication code to connect to the VM '
|
||||
'service (not recommended).');
|
||||
'service (not recommended).'
|
||||
)
|
||||
..addOption('use-application-binary',
|
||||
help: 'Specify a pre-built application binary to use when running. For android applications, '
|
||||
'this must be the path to an APK. For iOS applications, the path to an IPA. Other device types '
|
||||
'do not yet support prebuilt application binaries',
|
||||
valueHelp: 'path/to/app.apk',
|
||||
);
|
||||
usesWebOptions(hide: !verboseHelp);
|
||||
usesTargetOption();
|
||||
usesPortOptions();
|
||||
@@ -178,10 +185,6 @@ class RunCommand extends RunCommandBase {
|
||||
'This flag is not available on the stable channel and is only '
|
||||
'applied in debug and profile modes. This option should only '
|
||||
'be used for experiments and should not be used by typical users.')
|
||||
..addOption('use-application-binary',
|
||||
hide: !verboseHelp,
|
||||
help: 'Specify a pre-built application binary to use when running.',
|
||||
)
|
||||
..addOption('project-root',
|
||||
hide: !verboseHelp,
|
||||
help: 'Specify the project root directory.',
|
||||
|
||||
Reference in New Issue
Block a user