mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Support the --no-devtools flag in "flutter run --machine" (#113414)
This commit is contained in:
parent
e23a68347e
commit
f02cfd48df
@ -502,6 +502,7 @@ class AppDomain extends Domain {
|
|||||||
String? isolateFilter,
|
String? isolateFilter,
|
||||||
bool machine = true,
|
bool machine = true,
|
||||||
String? userIdentifier,
|
String? userIdentifier,
|
||||||
|
bool enableDevTools = true,
|
||||||
}) async {
|
}) async {
|
||||||
if (!await device.supportsRuntimeMode(options.buildInfo.mode)) {
|
if (!await device.supportsRuntimeMode(options.buildInfo.mode)) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
@ -574,7 +575,7 @@ class AppDomain extends Domain {
|
|||||||
return runner.run(
|
return runner.run(
|
||||||
connectionInfoCompleter: connectionInfoCompleter,
|
connectionInfoCompleter: connectionInfoCompleter,
|
||||||
appStartedCompleter: appStartedCompleter,
|
appStartedCompleter: appStartedCompleter,
|
||||||
enableDevTools: true,
|
enableDevTools: enableDevTools,
|
||||||
route: route,
|
route: route,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -606,6 +606,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
ipv6: ipv6 ?? false,
|
ipv6: ipv6 ?? false,
|
||||||
multidexEnabled: boolArgDeprecated('multidex'),
|
multidexEnabled: boolArgDeprecated('multidex'),
|
||||||
userIdentifier: userIdentifier,
|
userIdentifier: userIdentifier,
|
||||||
|
enableDevTools: boolArgDeprecated(FlutterCommand.kEnableDevTools),
|
||||||
);
|
);
|
||||||
} on Exception catch (error) {
|
} on Exception catch (error) {
|
||||||
throwToolExit(error.toString());
|
throwToolExit(error.toString());
|
||||||
|
@ -523,6 +523,34 @@ void main() {
|
|||||||
Stdio: () => FakeStdio(),
|
Stdio: () => FakeStdio(),
|
||||||
Logger: () => AppRunLogger(parent: BufferLogger.test()),
|
Logger: () => AppRunLogger(parent: BufferLogger.test()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('can disable devtools with --no-devtools', () async {
|
||||||
|
final DaemonCapturingRunCommand command = DaemonCapturingRunCommand();
|
||||||
|
final FakeDevice device = FakeDevice();
|
||||||
|
testDeviceManager.devices = <Device>[device];
|
||||||
|
|
||||||
|
await expectLater(
|
||||||
|
() => createTestCommandRunner(command).run(<String>[
|
||||||
|
'run',
|
||||||
|
'--no-pub',
|
||||||
|
'--no-devtools',
|
||||||
|
'--machine',
|
||||||
|
'-d',
|
||||||
|
device.id,
|
||||||
|
]),
|
||||||
|
throwsToolExit(),
|
||||||
|
);
|
||||||
|
expect(command.appDomain.enableDevTools, isFalse);
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => artifacts,
|
||||||
|
Cache: () => Cache.test(processManager: FakeProcessManager.any()),
|
||||||
|
DeviceManager: () => testDeviceManager,
|
||||||
|
FileSystem: () => fs,
|
||||||
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
|
Usage: () => usage,
|
||||||
|
Stdio: () => FakeStdio(),
|
||||||
|
Logger: () => AppRunLogger(parent: BufferLogger.test()),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1066,6 +1094,7 @@ class CapturingAppDomain extends AppDomain {
|
|||||||
|
|
||||||
bool? multidexEnabled;
|
bool? multidexEnabled;
|
||||||
String? userIdentifier;
|
String? userIdentifier;
|
||||||
|
bool? enableDevTools;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<AppInstance> startApp(
|
Future<AppInstance> startApp(
|
||||||
@ -1085,9 +1114,11 @@ class CapturingAppDomain extends AppDomain {
|
|||||||
String? isolateFilter,
|
String? isolateFilter,
|
||||||
bool machine = true,
|
bool machine = true,
|
||||||
String? userIdentifier,
|
String? userIdentifier,
|
||||||
|
bool enableDevTools = true,
|
||||||
}) async {
|
}) async {
|
||||||
this.multidexEnabled = multidexEnabled;
|
this.multidexEnabled = multidexEnabled;
|
||||||
this.userIdentifier = userIdentifier;
|
this.userIdentifier = userIdentifier;
|
||||||
|
this.enableDevTools = enableDevTools;
|
||||||
throwToolExit('');
|
throwToolExit('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user