Unverified Commit 9af6bae6 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] pass through enable impeller flag to macOS. (#128720)

Allow passing through the --enable-impeller flag to macOS.
parent a70f9359
...@@ -209,6 +209,8 @@ abstract class DesktopDevice extends Device { ...@@ -209,6 +209,8 @@ abstract class DesktopDevice extends Device {
/// steps to be run. /// steps to be run.
void onAttached(ApplicationPackage package, BuildInfo buildInfo, Process process) {} void onAttached(ApplicationPackage package, BuildInfo buildInfo, Process process) {}
bool get supportsImpeller => false;
/// Computes a set of environment variables used to pass debugging information /// Computes a set of environment variables used to pass debugging information
/// to the engine without interfering with application level command line /// to the engine without interfering with application level command line
/// arguments. /// arguments.
...@@ -266,6 +268,15 @@ abstract class DesktopDevice extends Device { ...@@ -266,6 +268,15 @@ abstract class DesktopDevice extends Device {
if (debuggingOptions.purgePersistentCache) { if (debuggingOptions.purgePersistentCache) {
addFlag('purge-persistent-cache=true'); addFlag('purge-persistent-cache=true');
} }
if (supportsImpeller) {
switch (debuggingOptions.enableImpeller) {
case ImpellerStatus.enabled:
addFlag('enable-impeller=true');
case ImpellerStatus.disabled:
case ImpellerStatus.platformDefault:
addFlag('enable-impeller=false');
}
}
// Options only supported when there is a VM Service connection between the // Options only supported when there is a VM Service connection between the
// tool and the device, usually in debug or profile mode. // tool and the device, usually in debug or profile mode.
if (debuggingOptions.debuggingEnabled) { if (debuggingOptions.debuggingEnabled) {
......
...@@ -47,6 +47,9 @@ class MacOSDevice extends DesktopDevice { ...@@ -47,6 +47,9 @@ class MacOSDevice extends DesktopDevice {
@override @override
String get name => 'macOS'; String get name => 'macOS';
@override
bool get supportsImpeller => true;
@override @override
Future<TargetPlatform> get targetPlatform async => TargetPlatform.darwin; Future<TargetPlatform> get targetPlatform async => TargetPlatform.darwin;
...@@ -54,9 +57,8 @@ class MacOSDevice extends DesktopDevice { ...@@ -54,9 +57,8 @@ class MacOSDevice extends DesktopDevice {
Future<String> get targetPlatformDisplayName async { Future<String> get targetPlatformDisplayName async {
if (_operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64) { if (_operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64) {
return 'darwin-arm64'; return 'darwin-arm64';
} else {
return 'darwin-x64';
} }
return 'darwin-x64';
} }
@override @override
......
...@@ -300,6 +300,66 @@ void main() { ...@@ -300,6 +300,66 @@ void main() {
), ),
); );
}); });
testWithoutContext('Desktop devices that support impeller pass through the enable-impeller flag', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>['debug'],
exitCode: -1,
environment: <String, String>{
'FLUTTER_ENGINE_SWITCH_1': 'enable-dart-profiling=true',
'FLUTTER_ENGINE_SWITCH_2': 'enable-impeller=true',
'FLUTTER_ENGINE_SWITCH_3': 'enable-checked-mode=true',
'FLUTTER_ENGINE_SWITCH_4': 'verify-entry-points=true',
'FLUTTER_ENGINE_SWITCHES': '4'
}
),
]);
final FakeDesktopDevice device = setUpDesktopDevice(
processManager: processManager,
supportsImpeller: true,
);
final FakeApplicationPackage package = FakeApplicationPackage();
await device.startApp(
package,
prebuiltApplication: true,
debuggingOptions: DebuggingOptions.enabled(
BuildInfo.debug,
enableImpeller: ImpellerStatus.enabled,
dartEntrypointArgs: <String>[],
),
);
});
testWithoutContext('Desktop devices that do not support impeller ignore the enable-impeller flag', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>['debug'],
exitCode: -1,
environment: <String, String>{
'FLUTTER_ENGINE_SWITCH_1': 'enable-dart-profiling=true',
'FLUTTER_ENGINE_SWITCH_2': 'enable-checked-mode=true',
'FLUTTER_ENGINE_SWITCH_3': 'verify-entry-points=true',
'FLUTTER_ENGINE_SWITCHES': '3'
}
),
]);
final FakeDesktopDevice device = setUpDesktopDevice(
processManager: processManager,
);
final FakeApplicationPackage package = FakeApplicationPackage();
await device.startApp(
package,
prebuiltApplication: true,
debuggingOptions: DebuggingOptions.enabled(
BuildInfo.debug,
enableImpeller: ImpellerStatus.enabled,
dartEntrypointArgs: <String>[],
),
);
});
} }
FakeDesktopDevice setUpDesktopDevice({ FakeDesktopDevice setUpDesktopDevice({
...@@ -308,6 +368,7 @@ FakeDesktopDevice setUpDesktopDevice({ ...@@ -308,6 +368,7 @@ FakeDesktopDevice setUpDesktopDevice({
ProcessManager? processManager, ProcessManager? processManager,
OperatingSystemUtils? operatingSystemUtils, OperatingSystemUtils? operatingSystemUtils,
bool nullExecutablePathForDevice = false, bool nullExecutablePathForDevice = false,
bool supportsImpeller = false,
}) { }) {
return FakeDesktopDevice( return FakeDesktopDevice(
fileSystem: fileSystem ?? MemoryFileSystem.test(), fileSystem: fileSystem ?? MemoryFileSystem.test(),
...@@ -315,6 +376,7 @@ FakeDesktopDevice setUpDesktopDevice({ ...@@ -315,6 +376,7 @@ FakeDesktopDevice setUpDesktopDevice({
processManager: processManager ?? FakeProcessManager.any(), processManager: processManager ?? FakeProcessManager.any(),
operatingSystemUtils: operatingSystemUtils ?? FakeOperatingSystemUtils(), operatingSystemUtils: operatingSystemUtils ?? FakeOperatingSystemUtils(),
nullExecutablePathForDevice: nullExecutablePathForDevice, nullExecutablePathForDevice: nullExecutablePathForDevice,
supportsImpeller: supportsImpeller,
); );
} }
...@@ -326,6 +388,7 @@ class FakeDesktopDevice extends DesktopDevice { ...@@ -326,6 +388,7 @@ class FakeDesktopDevice extends DesktopDevice {
required FileSystem fileSystem, required FileSystem fileSystem,
required OperatingSystemUtils operatingSystemUtils, required OperatingSystemUtils operatingSystemUtils,
this.nullExecutablePathForDevice = false, this.nullExecutablePathForDevice = false,
this.supportsImpeller = false,
}) : super( }) : super(
'dummy', 'dummy',
platformType: PlatformType.linux, platformType: PlatformType.linux,
...@@ -344,6 +407,9 @@ class FakeDesktopDevice extends DesktopDevice { ...@@ -344,6 +407,9 @@ class FakeDesktopDevice extends DesktopDevice {
final bool nullExecutablePathForDevice; final bool nullExecutablePathForDevice;
@override
final bool supportsImpeller;
@override @override
String get name => 'dummy'; String get name => 'dummy';
......
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