[flutter_tools] pass through enable impeller flag to macOS. (#128720)
Allow passing through the --enable-impeller flag to macOS.
This commit is contained in:
@@ -209,6 +209,8 @@ abstract class DesktopDevice extends Device {
|
||||
/// steps to be run.
|
||||
void onAttached(ApplicationPackage package, BuildInfo buildInfo, Process process) {}
|
||||
|
||||
bool get supportsImpeller => false;
|
||||
|
||||
/// Computes a set of environment variables used to pass debugging information
|
||||
/// to the engine without interfering with application level command line
|
||||
/// arguments.
|
||||
@@ -266,6 +268,15 @@ abstract class DesktopDevice extends Device {
|
||||
if (debuggingOptions.purgePersistentCache) {
|
||||
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
|
||||
// tool and the device, usually in debug or profile mode.
|
||||
if (debuggingOptions.debuggingEnabled) {
|
||||
|
||||
@@ -47,6 +47,9 @@ class MacOSDevice extends DesktopDevice {
|
||||
@override
|
||||
String get name => 'macOS';
|
||||
|
||||
@override
|
||||
bool get supportsImpeller => true;
|
||||
|
||||
@override
|
||||
Future<TargetPlatform> get targetPlatform async => TargetPlatform.darwin;
|
||||
|
||||
@@ -54,9 +57,8 @@ class MacOSDevice extends DesktopDevice {
|
||||
Future<String> get targetPlatformDisplayName async {
|
||||
if (_operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64) {
|
||||
return 'darwin-arm64';
|
||||
} else {
|
||||
return 'darwin-x64';
|
||||
}
|
||||
return 'darwin-x64';
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -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({
|
||||
@@ -308,6 +368,7 @@ FakeDesktopDevice setUpDesktopDevice({
|
||||
ProcessManager? processManager,
|
||||
OperatingSystemUtils? operatingSystemUtils,
|
||||
bool nullExecutablePathForDevice = false,
|
||||
bool supportsImpeller = false,
|
||||
}) {
|
||||
return FakeDesktopDevice(
|
||||
fileSystem: fileSystem ?? MemoryFileSystem.test(),
|
||||
@@ -315,6 +376,7 @@ FakeDesktopDevice setUpDesktopDevice({
|
||||
processManager: processManager ?? FakeProcessManager.any(),
|
||||
operatingSystemUtils: operatingSystemUtils ?? FakeOperatingSystemUtils(),
|
||||
nullExecutablePathForDevice: nullExecutablePathForDevice,
|
||||
supportsImpeller: supportsImpeller,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -326,6 +388,7 @@ class FakeDesktopDevice extends DesktopDevice {
|
||||
required FileSystem fileSystem,
|
||||
required OperatingSystemUtils operatingSystemUtils,
|
||||
this.nullExecutablePathForDevice = false,
|
||||
this.supportsImpeller = false,
|
||||
}) : super(
|
||||
'dummy',
|
||||
platformType: PlatformType.linux,
|
||||
@@ -344,6 +407,9 @@ class FakeDesktopDevice extends DesktopDevice {
|
||||
|
||||
final bool nullExecutablePathForDevice;
|
||||
|
||||
@override
|
||||
final bool supportsImpeller;
|
||||
|
||||
@override
|
||||
String get name => 'dummy';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user