Unverified Commit 1888fa35 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Allow flutter run to run release/profile x64 (#45511)

parent e6935efd
...@@ -491,10 +491,9 @@ class AndroidDevice extends Device { ...@@ -491,10 +491,9 @@ class AndroidDevice extends Device {
} }
final TargetPlatform devicePlatform = await targetPlatform; final TargetPlatform devicePlatform = await targetPlatform;
if (!(devicePlatform == TargetPlatform.android_arm || if (devicePlatform == TargetPlatform.android_x86 &&
devicePlatform == TargetPlatform.android_arm64) && !debuggingOptions.buildInfo.isDebug) {
!debuggingOptions.buildInfo.isDebug) { printError('Profile and release builds are only supported on ARM/x64 targets.');
printError('Profile and release builds are only supported on ARM targets.');
return LaunchResult.failed(); return LaunchResult.failed();
} }
......
...@@ -94,12 +94,19 @@ void main() { ...@@ -94,12 +94,19 @@ void main() {
}); });
group('startApp', () { group('startApp', () {
final MockAndroidApk mockApk = MockAndroidApk(); MockAndroidApk mockApk;
final MockProcessManager mockProcessManager = MockProcessManager(); MockProcessManager mockProcessManager;
final MockAndroidSdk mockAndroidSdk = MockAndroidSdk(); MockAndroidSdk mockAndroidSdk;
final MockProcessUtils mockProcessUtils = MockProcessUtils(); MockProcessUtils mockProcessUtils;
setUp(() {
mockApk = MockAndroidApk();
mockProcessManager = MockProcessManager();
mockAndroidSdk = MockAndroidSdk();
mockProcessUtils = MockProcessUtils();
});
testUsingContext(' succeeds with --cache-sksl', () async { testUsingContext('succeeds with --cache-sksl', () async {
const String deviceId = '1234'; const String deviceId = '1234';
final AndroidDevice device = AndroidDevice(deviceId, modelID: 'TestModel'); final AndroidDevice device = AndroidDevice(deviceId, modelID: 'TestModel');
...@@ -140,6 +147,41 @@ void main() { ...@@ -140,6 +147,41 @@ void main() {
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
ProcessUtils: () => mockProcessUtils, ProcessUtils: () => mockProcessUtils,
}); });
testUsingContext('can run a release build on x64', () async {
const String deviceId = '1234';
final AndroidDevice device = AndroidDevice(deviceId, modelID: 'TestModel');
final Directory sdkDir = MockAndroidSdk.createSdkDirectory();
Config.instance.setValue('android-sdk', sdkDir.path);
final File adbExe = fs.file(getAdbPath(androidSdk));
when(mockAndroidSdk.licensesAvailable).thenReturn(true);
when(mockAndroidSdk.latestVersion).thenReturn(MockAndroidSdkVersion());
when(mockProcessManager.run(
<String>[adbExe.path, '-s', deviceId, 'shell', 'getprop'],
stdoutEncoding: latin1,
stderrEncoding: latin1,
)).thenAnswer((_) async {
return ProcessResult(0, 0, '[ro.build.version.sdk]: [24]\n[ro.product.cpu.abi]: [x86_64]', '');
});
final LaunchResult launchResult = await device.startApp(
mockApk,
prebuiltApplication: true,
debuggingOptions: DebuggingOptions.disabled(
const BuildInfo(BuildMode.release, null),
),
platformArgs: <String, dynamic>{},
);
expect(launchResult.started, true);
}, overrides: <Type, Generator>{
AndroidSdk: () => mockAndroidSdk,
FileSystem: () => MemoryFileSystem(),
ProcessManager: () => mockProcessManager,
ProcessUtils: () => mockProcessUtils,
});
}); });
}); });
...@@ -378,7 +420,7 @@ Use the 'android' tool to install them: ...@@ -378,7 +420,7 @@ Use the 'android' tool to install them:
ProcessManager: () => mockProcessManager ProcessManager: () => mockProcessManager
}); });
testUsingContext('detects kind fire ABI', () async { testUsingContext('detects kindle fire ABI', () async {
cpu = 'arm64-v8a'; cpu = 'arm64-v8a';
abilist = 'arm'; abilist = 'arm';
final AndroidDevice device = AndroidDevice('test'); final AndroidDevice device = AndroidDevice('test');
......
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