Commit 2f599194 authored by Jonah Williams's avatar Jonah Williams Committed by Flutter GitHub Bot

[flutter_tools] Reland fast start by default for Android (#49315)

parent 782f9cce
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
print('run: starting...'); print('run: starting...');
final Process run = await startProcess( final Process run = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run', '--verbose', '--disable-service-auth-codes', '-d', device.deviceId, 'lib/commands.dart'], <String>['run', '--verbose', '--disable-service-auth-codes', '--no-fast-start', '-d', device.deviceId, 'lib/commands.dart'],
); );
final StreamController<String> stdout = StreamController<String>.broadcast(); final StreamController<String> stdout = StreamController<String>.broadcast();
run.stdout run.stdout
......
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
Completer<void> firstNameFound = Completer<void>(); Completer<void> firstNameFound = Completer<void>();
Completer<void> secondNameFound = Completer<void>(); Completer<void> secondNameFound = Completer<void>();
final Process runProcess = await _run(device: device, command: final Process runProcess = await _run(device: device, command:
<String>['run', '--disable-service-auth-codes'], stdoutListener: (String line) { <String>['run', '--disable-service-auth-codes', '--no-fast-start'], stdoutListener: (String line) {
if (line.contains(_kFirstIsolateName)) { if (line.contains(_kFirstIsolateName)) {
firstNameFound.complete(); firstNameFound.complete();
} else if (line.contains(_kSecondIsolateName)) { } else if (line.contains(_kSecondIsolateName)) {
......
...@@ -48,6 +48,7 @@ void main() { ...@@ -48,6 +48,7 @@ void main() {
'run', 'run',
'--machine', '--machine',
'--verbose', '--verbose',
'--no-fast-start',
'-d', '-d',
device.deviceId, device.deviceId,
'lib/commands.dart', 'lib/commands.dart',
......
...@@ -25,7 +25,7 @@ void main() { ...@@ -25,7 +25,7 @@ void main() {
print('run: starting...'); print('run: starting...');
final Process run = await startProcess( final Process run = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run', '--verbose', '--disable-service-auth-codes', '-d', device.deviceId, 'lib/main.dart'], <String>['run', '--verbose', '--no-fast-start', '--disable-service-auth-codes', '-d', device.deviceId, 'lib/main.dart'],
); );
run.stdout run.stdout
.transform<String>(utf8.decoder) .transform<String>(utf8.decoder)
......
...@@ -719,6 +719,7 @@ class ReportedDurationTest { ...@@ -719,6 +719,7 @@ class ReportedDurationTest {
print('launching $project$test on device...'); print('launching $project$test on device...');
await flutter('run', options: <String>[ await flutter('run', options: <String>[
'--verbose', '--verbose',
'--no-fast-start',
'--${_reportedDurationTestToString(flavor)}', '--${_reportedDurationTestToString(flavor)}',
'--no-resident', '--no-resident',
'-d', device.deviceId, '-d', device.deviceId,
......
...@@ -189,8 +189,7 @@ class RunCommand extends RunCommandBase { ...@@ -189,8 +189,7 @@ class RunCommand extends RunCommandBase {
) )
..addFlag('fast-start', ..addFlag('fast-start',
negatable: true, negatable: true,
defaultsTo: false, defaultsTo: true,
hide: true,
help: 'Whether to quickly bootstrap applications with a minimal app. ' help: 'Whether to quickly bootstrap applications with a minimal app. '
'Currently this is only supported on Android devices. This option ' 'Currently this is only supported on Android devices. This option '
'cannot be paired with --use-application-binary.' 'cannot be paired with --use-application-binary.'
...@@ -319,10 +318,6 @@ class RunCommand extends RunCommandBase { ...@@ -319,10 +318,6 @@ class RunCommand extends RunCommandBase {
await super.validateCommand(); await super.validateCommand();
} }
if (boolArg('fast-start') && runningWithPrebuiltApplication) {
throwToolExit('--fast-start is not supported with --use-application-binary');
}
devices = await findAllTargetDevices(); devices = await findAllTargetDevices();
if (devices == null) { if (devices == null) {
throwToolExit(null); throwToolExit(null);
...@@ -365,7 +360,9 @@ class RunCommand extends RunCommandBase { ...@@ -365,7 +360,9 @@ class RunCommand extends RunCommandBase {
vmserviceOutFile: stringArg('vmservice-out-file'), vmserviceOutFile: stringArg('vmservice-out-file'),
// Allow forcing fast-start to off to prevent doing more work on devices that // Allow forcing fast-start to off to prevent doing more work on devices that
// don't support it. // don't support it.
fastStart: boolArg('fast-start') && devices.every((Device device) => device.supportsFastStart), fastStart: boolArg('fast-start')
&& !runningWithPrebuiltApplication
&& devices.every((Device device) => device.supportsFastStart),
); );
} }
} }
...@@ -428,12 +425,6 @@ class RunCommand extends RunCommandBase { ...@@ -428,12 +425,6 @@ class RunCommand extends RunCommandBase {
} }
for (final Device device in devices) { for (final Device device in devices) {
if (!device.supportsFastStart && boolArg('fast-start')) {
globals.printStatus(
'Using --fast-start option with device ${device.name}, but this device '
'does not support it. Overriding the setting to false.'
);
}
if (await device.isLocalEmulator) { if (await device.isLocalEmulator) {
if (await device.supportsHardwareRendering) { if (await device.supportsHardwareRendering) {
final bool enableSoftwareRendering = boolArg('enable-software-rendering') == true; final bool enableSoftwareRendering = boolArg('enable-software-rendering') == true;
......
...@@ -77,7 +77,7 @@ void main() { ...@@ -77,7 +77,7 @@ void main() {
]); ]);
fail('Expect exception'); fail('Expect exception');
} catch (e) { } catch (e) {
expect(e.toString(), contains('--fast-start is not supported with --use-application-binary')); expect(e.toString(), isNot(contains('--fast-start is not supported with --use-application-binary')));
} }
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
...@@ -115,10 +115,10 @@ void main() { ...@@ -115,10 +115,10 @@ void main() {
} }
final BufferLogger bufferLogger = globals.logger as BufferLogger; final BufferLogger bufferLogger = globals.logger as BufferLogger;
expect(bufferLogger.statusText, contains( expect(bufferLogger.statusText, isNot(contains(
'Using --fast-start option with device mockdevice, but this device ' 'Using --fast-start option with device mockdevice, but this device '
'does not support it. Overriding the setting to false.' 'does not support it. Overriding the setting to false.'
)); )));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(), FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment