gen_snapshot: fix Platform.operatingSystem issue (#213)

This change fixes an issue that `Platform.operatingSystem` returns Android on x64 hosts and when cross-building for arm64 targets on x64 hosts. To fix the issue, use the gen_snapshot of linux and elinux instead of Android's one.

Fixed https://github.com/sony/flutter-elinux/issues/212

Signed-off-by: Hidenori Matsubayashi <[email protected]>
This commit is contained in:
Hidenori Matsubayashi
2023-08-29 12:07:51 +00:00
committed by GitHub
parent fa64bab806
commit d2ae0ffdb9
4 changed files with 18 additions and 34 deletions
+2 -19
View File
@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/android/gradle.dart';
import 'package:flutter_tools/src/base/analyze_size.dart';
import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/os.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/build_system/build_system.dart';
import 'package:flutter_tools/src/cache.dart';
@@ -179,22 +178,11 @@ class ELinuxBuilder {
/// See: [getTargetPlatformForName] in `build_info.dart`
TargetPlatform _getTargetPlatformForArch(String arch) {
final String hostArch = _getCurrentHostPlatformArchName();
switch (arch) {
case 'arm64':
// Use gensnapshot for Arm64 Linux when the host is arm64 because
// the artifacts for arm64 host don't support self-building now.
if (hostArch == 'arm64') {
return TargetPlatform.linux_arm64;
}
return TargetPlatform.android_arm64;
return TargetPlatform.linux_arm64;
default:
// Use gensnapshot for Arm64 Linux when the host is arm64 because
// the artifacts for arm64 host don't support self-building now.
if (hostArch == 'arm64') {
return TargetPlatform.linux_x64;
}
return TargetPlatform.android_x64;
return TargetPlatform.linux_x64;
}
}
@@ -211,8 +199,3 @@ String _getTargetPlatformPlatformName(TargetPlatform targetPlatform) {
return 'android-x64';
}
}
String _getCurrentHostPlatformArchName() {
final HostPlatform hostPlatform = getCurrentHostPlatform();
return hostPlatform.platformName;
}