mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[ Tool ] Remove support for Android x86 targets (#169884)
Dart x86 is deprecated, no longer shipped, and will eventually be removed from the Dart VM. This PR removes the last remaining x86 target, android-x86, from the tool. Work towards https://github.com/flutter/flutter/issues/157543 and https://github.com/flutter/flutter/issues/160932
This commit is contained in:
parent
afd5927b36
commit
c46d4102a5
@ -27,15 +27,13 @@ Future<void> main() async {
|
||||
...baseApkFiles,
|
||||
'lib/armeabi-v7a/libflutter.so',
|
||||
'lib/arm64-v8a/libflutter.so',
|
||||
// Debug mode intentionally includes `x86` and `x86_64`.
|
||||
'lib/x86/libflutter.so',
|
||||
// Debug mode intentionally includes `x86_64`.
|
||||
'lib/x86_64/libflutter.so',
|
||||
], apkFiles);
|
||||
|
||||
checkCollectionDoesNotContain<String>(<String>[
|
||||
'lib/arm64-v8a/libapp.so',
|
||||
'lib/armeabi-v7a/libapp.so',
|
||||
'lib/x86/libapp.so',
|
||||
'lib/x86_64/libapp.so',
|
||||
], apkFiles);
|
||||
|
||||
|
||||
@ -35,31 +35,6 @@ Future<void> main() async {
|
||||
checkCollectionDoesNotContain<String>(<String>[
|
||||
'lib/arm64-v8a/libapp.so',
|
||||
'lib/armeabi-v7a/libapp.so',
|
||||
'lib/x86/libapp.so',
|
||||
'lib/x86_64/libapp.so',
|
||||
], apkFiles);
|
||||
|
||||
section('APK content for task assembleDebug with target platform = android-x86');
|
||||
// This is used by `flutter run`
|
||||
await inDirectory(pluginProject.exampleAndroidPath, () {
|
||||
return flutter(
|
||||
'build',
|
||||
options: <String>['apk', '--debug', '--target-platform=android-x86'],
|
||||
);
|
||||
});
|
||||
|
||||
apkFiles = await getFilesInApk(pluginProject.debugApkPath);
|
||||
|
||||
checkCollectionContains<String>(<String>[
|
||||
...flutterAssets,
|
||||
...debugAssets,
|
||||
...baseApkFiles,
|
||||
'lib/x86/libflutter.so',
|
||||
], apkFiles);
|
||||
|
||||
checkCollectionDoesNotContain<String>(<String>[
|
||||
'lib/armeabi-v7a/libapp.so',
|
||||
'lib/x86/libapp.so',
|
||||
'lib/x86_64/libapp.so',
|
||||
], apkFiles);
|
||||
|
||||
@ -84,7 +59,6 @@ Future<void> main() async {
|
||||
|
||||
checkCollectionDoesNotContain<String>(<String>[
|
||||
'lib/armeabi-v7a/libapp.so',
|
||||
'lib/x86/libapp.so',
|
||||
'lib/x86_64/libapp.so',
|
||||
], apkFiles);
|
||||
|
||||
|
||||
@ -207,8 +207,6 @@ class AndroidDevice extends Device {
|
||||
}
|
||||
case 'x86_64':
|
||||
return TargetPlatform.android_x64;
|
||||
case 'x86':
|
||||
return TargetPlatform.android_x86;
|
||||
default:
|
||||
return TargetPlatform.android_arm;
|
||||
}
|
||||
@ -221,8 +219,6 @@ class AndroidDevice extends Device {
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
return buildMode != BuildMode.jitRelease;
|
||||
case TargetPlatform.android_x86:
|
||||
return buildMode == BuildMode.debug;
|
||||
case TargetPlatform.android:
|
||||
case TargetPlatform.darwin:
|
||||
case TargetPlatform.fuchsia_arm64:
|
||||
@ -535,10 +531,6 @@ class AndroidDevice extends Device {
|
||||
}
|
||||
|
||||
final TargetPlatform devicePlatform = await targetPlatform;
|
||||
if (devicePlatform == TargetPlatform.android_x86 && !debuggingOptions.buildInfo.isDebug) {
|
||||
_logger.printError('Profile and release builds are only supported on ARM/x64 targets.');
|
||||
return LaunchResult.failed();
|
||||
}
|
||||
|
||||
AndroidApk? builtPackage = package;
|
||||
AndroidArch androidArch;
|
||||
@ -549,8 +541,6 @@ class AndroidDevice extends Device {
|
||||
androidArch = AndroidArch.arm64_v8a;
|
||||
case TargetPlatform.android_x64:
|
||||
androidArch = AndroidArch.x86_64;
|
||||
case TargetPlatform.android_x86:
|
||||
androidArch = AndroidArch.x86;
|
||||
case TargetPlatform.android:
|
||||
case TargetPlatform.darwin:
|
||||
case TargetPlatform.fuchsia_arm64:
|
||||
|
||||
@ -18,12 +18,6 @@ void validateBuild(AndroidBuildInfo androidBuildInfo) {
|
||||
'--target-platform flag.',
|
||||
);
|
||||
}
|
||||
if (buildInfo.mode.isPrecompiled && androidBuildInfo.targetArchs.contains(AndroidArch.x86)) {
|
||||
throwToolExit(
|
||||
'Cannot build ${androidBuildInfo.buildInfo.mode.cliName} mode for x86 ABI.\n'
|
||||
'For more information see $kSupportedAbis .',
|
||||
);
|
||||
}
|
||||
if (buildInfo.buildNumber != null) {
|
||||
final int? result = int.tryParse(buildInfo.buildNumber!);
|
||||
if (result == null) {
|
||||
|
||||
@ -204,11 +204,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
outputDirectory = outputDirectory.childDirectory('host');
|
||||
}
|
||||
|
||||
final bool containsX86Targets =
|
||||
androidBuildInfo.where((AndroidBuildInfo info) => info.containsX86Target).isNotEmpty;
|
||||
if (containsX86Targets) {
|
||||
_logger.printWarning(androidX86DeprecationWarning);
|
||||
}
|
||||
for (final AndroidBuildInfo androidBuildInfo in androidBuildInfo) {
|
||||
await generateTooling(project, releaseMode: androidBuildInfo.buildInfo.isRelease);
|
||||
await buildGradleAar(
|
||||
@ -454,9 +449,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
int retry = 0,
|
||||
@visibleForTesting int? maxRetries,
|
||||
}) async {
|
||||
if (androidBuildInfo.containsX86Target) {
|
||||
_logger.printWarning(androidX86DeprecationWarning);
|
||||
}
|
||||
if (!project.android.isSupportedVersion) {
|
||||
_exitWithUnsupportedProjectMessage(_logger.terminal, _analytics);
|
||||
}
|
||||
@ -1354,9 +1346,7 @@ Directory _getLocalEngineRepo({
|
||||
|
||||
String _getAbiByLocalEnginePath(String engineOutPath) {
|
||||
String result = 'armeabi_v7a';
|
||||
if (engineOutPath.contains('x86')) {
|
||||
result = 'x86';
|
||||
} else if (engineOutPath.contains('x64')) {
|
||||
if (engineOutPath.contains('x64')) {
|
||||
result = 'x86_64';
|
||||
} else if (engineOutPath.contains('arm64')) {
|
||||
result = 'arm64_v8a';
|
||||
@ -1366,9 +1356,7 @@ String _getAbiByLocalEnginePath(String engineOutPath) {
|
||||
|
||||
String _getTargetPlatformByLocalEnginePath(String engineOutPath) {
|
||||
String result = 'android-arm';
|
||||
if (engineOutPath.contains('x86')) {
|
||||
result = 'android-x86';
|
||||
} else if (engineOutPath.contains('x64')) {
|
||||
if (engineOutPath.contains('x64')) {
|
||||
result = 'android-x64';
|
||||
} else if (engineOutPath.contains('arm64')) {
|
||||
result = 'android-arm64';
|
||||
|
||||
@ -164,7 +164,6 @@ TargetPlatform? _mapTargetPlatform(TargetPlatform? targetPlatform) {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
case null:
|
||||
return targetPlatform;
|
||||
}
|
||||
@ -511,7 +510,6 @@ class CachedArtifacts implements Artifacts {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
assert(platform != TargetPlatform.android);
|
||||
return _getAndroidArtifactPath(artifact, platform!, mode!);
|
||||
case TargetPlatform.ios:
|
||||
@ -897,7 +895,6 @@ class CachedArtifacts implements Artifacts {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
assert(mode != null, 'Need to specify a build mode for platform $platform.');
|
||||
final String suffix = mode != BuildMode.debug ? '-${kebabCase(mode!.cliName)}' : '';
|
||||
return _fileSystem.path.join(engineDir, platformName + suffix);
|
||||
@ -1348,7 +1345,6 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
case TargetPlatform.fuchsia_arm64:
|
||||
case TargetPlatform.fuchsia_x64:
|
||||
case TargetPlatform.web_javascript:
|
||||
@ -1577,7 +1573,6 @@ class CachedLocalWebSdkArtifacts implements Artifacts {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
case TargetPlatform.fuchsia_arm64:
|
||||
case TargetPlatform.fuchsia_x64:
|
||||
case TargetPlatform.web_javascript:
|
||||
|
||||
@ -397,8 +397,6 @@ class AndroidBuildInfo {
|
||||
/// The target platforms for the build.
|
||||
final Iterable<AndroidArch> targetArchs;
|
||||
|
||||
bool get containsX86Target => targetArchs.contains(AndroidArch.x86);
|
||||
|
||||
/// Whether to bootstrap an empty application.
|
||||
final bool fastStart;
|
||||
}
|
||||
@ -477,8 +475,7 @@ String? validatedBuildNumberForPlatform(
|
||||
}
|
||||
if (targetPlatform == TargetPlatform.android_arm ||
|
||||
targetPlatform == TargetPlatform.android_arm64 ||
|
||||
targetPlatform == TargetPlatform.android_x64 ||
|
||||
targetPlatform == TargetPlatform.android_x86) {
|
||||
targetPlatform == TargetPlatform.android_x64) {
|
||||
// See versionCode at https://developer.android.com/studio/publish/versioning
|
||||
final RegExp disallowed = RegExp(r'[^\d]');
|
||||
String tmpBuildNumberStr = buildNumber.replaceAll(disallowed, '');
|
||||
@ -530,8 +527,7 @@ String? validatedBuildNameForPlatform(
|
||||
if (targetPlatform == TargetPlatform.android ||
|
||||
targetPlatform == TargetPlatform.android_arm ||
|
||||
targetPlatform == TargetPlatform.android_arm64 ||
|
||||
targetPlatform == TargetPlatform.android_x64 ||
|
||||
targetPlatform == TargetPlatform.android_x86) {
|
||||
targetPlatform == TargetPlatform.android_x64) {
|
||||
// See versionName at https://developer.android.com/studio/publish/versioning
|
||||
return buildName;
|
||||
}
|
||||
@ -570,8 +566,7 @@ enum TargetPlatform {
|
||||
// and [AndroidArch].
|
||||
android_arm,
|
||||
android_arm64,
|
||||
android_x64,
|
||||
android_x86;
|
||||
android_x64;
|
||||
|
||||
String get fuchsiaArchForTargetPlatform {
|
||||
switch (this) {
|
||||
@ -583,7 +578,6 @@ enum TargetPlatform {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
case TargetPlatform.darwin:
|
||||
case TargetPlatform.ios:
|
||||
case TargetPlatform.linux_arm64:
|
||||
@ -609,7 +603,6 @@ enum TargetPlatform {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
case TargetPlatform.fuchsia_arm64:
|
||||
case TargetPlatform.fuchsia_x64:
|
||||
case TargetPlatform.ios:
|
||||
@ -647,21 +640,18 @@ enum DarwinArch {
|
||||
enum AndroidArch {
|
||||
armeabi_v7a,
|
||||
arm64_v8a,
|
||||
x86,
|
||||
x86_64;
|
||||
|
||||
String get archName => switch (this) {
|
||||
AndroidArch.armeabi_v7a => 'armeabi-v7a',
|
||||
AndroidArch.arm64_v8a => 'arm64-v8a',
|
||||
AndroidArch.x86_64 => 'x86_64',
|
||||
AndroidArch.x86 => 'x86',
|
||||
};
|
||||
|
||||
String get platformName => switch (this) {
|
||||
AndroidArch.armeabi_v7a => 'android-arm',
|
||||
AndroidArch.arm64_v8a => 'android-arm64',
|
||||
AndroidArch.x86_64 => 'android-x64',
|
||||
AndroidArch.x86 => 'android-x86',
|
||||
};
|
||||
}
|
||||
|
||||
@ -731,7 +721,6 @@ String getNameForTargetPlatform(TargetPlatform platform, {DarwinArch? darwinArch
|
||||
TargetPlatform.android_arm => 'android-arm',
|
||||
TargetPlatform.android_arm64 => 'android-arm64',
|
||||
TargetPlatform.android_x64 => 'android-x64',
|
||||
TargetPlatform.android_x86 => 'android-x86',
|
||||
TargetPlatform.linux_x64 => 'linux-x64',
|
||||
TargetPlatform.linux_arm64 => 'linux-arm64',
|
||||
TargetPlatform.windows_x64 => 'windows-x64',
|
||||
@ -750,7 +739,6 @@ TargetPlatform getTargetPlatformForName(String platform) {
|
||||
'android-arm' => TargetPlatform.android_arm,
|
||||
'android-arm64' => TargetPlatform.android_arm64,
|
||||
'android-x64' => TargetPlatform.android_x64,
|
||||
'android-x86' => TargetPlatform.android_x86,
|
||||
'fuchsia-arm64' => TargetPlatform.fuchsia_arm64,
|
||||
'fuchsia-x64' => TargetPlatform.fuchsia_x64,
|
||||
'ios' => TargetPlatform.ios,
|
||||
@ -772,7 +760,6 @@ AndroidArch getAndroidArchForName(String platform) {
|
||||
'android-arm' => AndroidArch.armeabi_v7a,
|
||||
'android-arm64' => AndroidArch.arm64_v8a,
|
||||
'android-x64' => AndroidArch.x86_64,
|
||||
'android-x86' => AndroidArch.x86,
|
||||
_ => throw Exception('Unsupported Android arch name "$platform"'),
|
||||
};
|
||||
}
|
||||
|
||||
@ -216,7 +216,6 @@ class KernelSnapshot extends Target {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
case TargetPlatform.fuchsia_arm64:
|
||||
case TargetPlatform.fuchsia_x64:
|
||||
case TargetPlatform.ios:
|
||||
@ -231,8 +230,7 @@ class KernelSnapshot extends Target {
|
||||
TargetPlatform.android ||
|
||||
TargetPlatform.android_arm ||
|
||||
TargetPlatform.android_arm64 ||
|
||||
TargetPlatform.android_x64 ||
|
||||
TargetPlatform.android_x86 => 'android',
|
||||
TargetPlatform.android_x64 => 'android',
|
||||
TargetPlatform.darwin => 'macos',
|
||||
TargetPlatform.ios => 'ios',
|
||||
TargetPlatform.linux_arm64 || TargetPlatform.linux_x64 => 'linux',
|
||||
|
||||
@ -107,7 +107,6 @@ class ShaderCompiler {
|
||||
List<String> _shaderTargetsFromTargetPlatform(TargetPlatform targetPlatform) {
|
||||
switch (targetPlatform) {
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android:
|
||||
|
||||
@ -53,7 +53,7 @@ class BuildAarCommand extends BuildSubCommand {
|
||||
argParser.addMultiOption(
|
||||
'target-platform',
|
||||
defaultsTo: <String>['android-arm', 'android-arm64', 'android-x64'],
|
||||
allowed: <String>['android-arm', 'android-arm64', 'android-x86', 'android-x64'],
|
||||
allowed: <String>['android-arm', 'android-arm64', 'android-x64'],
|
||||
help: 'The target platform for which the project is compiled.',
|
||||
);
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ class BuildApkCommand extends BuildSubCommand {
|
||||
)
|
||||
..addMultiOption(
|
||||
'target-platform',
|
||||
allowed: <String>['android-arm', 'android-arm64', 'android-x86', 'android-x64'],
|
||||
allowed: <String>['android-arm', 'android-arm64', 'android-x64'],
|
||||
help: 'The target platform for which the app is compiled.',
|
||||
);
|
||||
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
||||
@ -72,7 +72,6 @@ class BuildApkCommand extends BuildSubCommand {
|
||||
static const List<String> _kDefaultJitArchs = <String>[
|
||||
'android-arm',
|
||||
'android-arm64',
|
||||
'android-x86',
|
||||
'android-x64',
|
||||
];
|
||||
static const List<String> _kDefaultAotArchs = <String>[
|
||||
|
||||
@ -41,7 +41,6 @@ class BuildBundleCommand extends BuildSubCommand {
|
||||
allowed: const <String>[
|
||||
'android-arm',
|
||||
'android-arm64',
|
||||
'android-x86',
|
||||
'android-x64',
|
||||
'ios',
|
||||
'darwin',
|
||||
@ -130,7 +129,6 @@ class BuildBundleCommand extends BuildSubCommand {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
case TargetPlatform.fuchsia_arm64:
|
||||
case TargetPlatform.fuchsia_x64:
|
||||
case TargetPlatform.ios:
|
||||
|
||||
@ -54,7 +54,6 @@ class FlutterApplicationPackageFactory extends ApplicationPackageFactory {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
if (applicationBinary == null) {
|
||||
return AndroidApk.fromAndroidProject(
|
||||
FlutterProject.current().android,
|
||||
|
||||
@ -46,7 +46,6 @@ Architecture getNativeAndroidArchitecture(AndroidArch androidArch) {
|
||||
return switch (androidArch) {
|
||||
AndroidArch.armeabi_v7a => Architecture.arm,
|
||||
AndroidArch.arm64_v8a => Architecture.arm64,
|
||||
AndroidArch.x86 => Architecture.ia32,
|
||||
AndroidArch.x86_64 => Architecture.x64,
|
||||
};
|
||||
}
|
||||
@ -56,7 +55,6 @@ AndroidArch _getAndroidArch(Architecture architecture) {
|
||||
return switch (architecture) {
|
||||
Architecture.arm => AndroidArch.armeabi_v7a,
|
||||
Architecture.arm64 => AndroidArch.arm64_v8a,
|
||||
Architecture.ia32 => AndroidArch.x86,
|
||||
Architecture.x64 => AndroidArch.x86_64,
|
||||
Architecture.riscv64 => throwToolExit('Android RISC-V not yet supported.'),
|
||||
_ => throwToolExit('Invalid architecture: $architecture.'),
|
||||
|
||||
@ -728,7 +728,6 @@ Architecture _getNativeArchitecture(TargetPlatform targetPlatform) {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
throw Exception('Unknown targetPlatform: $targetPlatform.');
|
||||
}
|
||||
}
|
||||
@ -781,7 +780,6 @@ OS getNativeOSFromTargetPlatform(TargetPlatform platform) {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
return OS.android;
|
||||
case TargetPlatform.tester:
|
||||
if (const LocalPlatform().isMacOS) {
|
||||
@ -806,8 +804,6 @@ List<AndroidArch> _androidArchs(TargetPlatform targetPlatform, String? androidAr
|
||||
return <AndroidArch>[AndroidArch.arm64_v8a];
|
||||
case TargetPlatform.android_x64:
|
||||
return <AndroidArch>[AndroidArch.x86_64];
|
||||
case TargetPlatform.android_x86:
|
||||
return <AndroidArch>[AndroidArch.x86];
|
||||
case TargetPlatform.android:
|
||||
if (androidArchsEnvironment == null) {
|
||||
throw MissingDefineException(kAndroidArchs, 'native_assets');
|
||||
|
||||
@ -597,7 +597,6 @@ class MDnsVmServiceDiscovery {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
case TargetPlatform.darwin:
|
||||
case TargetPlatform.fuchsia_arm64:
|
||||
case TargetPlatform.fuchsia_x64:
|
||||
|
||||
@ -1542,7 +1542,6 @@ Future<String?> getMissingPackageHintForPlatform(TargetPlatform platform) async
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
final FlutterProject project = FlutterProject.current();
|
||||
final String manifestPath = globals.fs.path.relative(project.android.appManifestFile.path);
|
||||
return 'Is your project missing an $manifestPath?\nConsider running "flutter create ." to create one.';
|
||||
|
||||
@ -2048,7 +2048,6 @@ DevelopmentArtifact? artifactFromTargetPlatform(TargetPlatform targetPlatform) {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
return DevelopmentArtifact.androidGenSnapshot;
|
||||
case TargetPlatform.web_javascript:
|
||||
return DevelopmentArtifact.web;
|
||||
|
||||
@ -249,7 +249,7 @@ void main() {
|
||||
'--no-debug',
|
||||
'--no-profile',
|
||||
'--target-platform',
|
||||
'android-x86',
|
||||
'android-x64',
|
||||
'--tree-shake-icons',
|
||||
'--flavor',
|
||||
'free',
|
||||
@ -272,7 +272,7 @@ void main() {
|
||||
|
||||
final AndroidBuildInfo androidBuildInfo =
|
||||
(buildAarCall.namedArguments[#androidBuildInfo] as Set<AndroidBuildInfo>).single;
|
||||
expect(androidBuildInfo.targetArchs, <AndroidArch>[AndroidArch.x86]);
|
||||
expect(androidBuildInfo.targetArchs, <AndroidArch>[AndroidArch.x86_64]);
|
||||
|
||||
final BuildInfo buildInfo = androidBuildInfo.buildInfo;
|
||||
expect(buildInfo.mode, BuildMode.release);
|
||||
|
||||
@ -78,7 +78,7 @@ void main() {
|
||||
Event.commandUsageValues(
|
||||
workflow: 'apk',
|
||||
commandHasTerminal: false,
|
||||
buildApkTargetPlatform: 'android-arm,android-arm64,android-x86,android-x64',
|
||||
buildApkTargetPlatform: 'android-arm,android-arm64,android-x64',
|
||||
buildApkBuildMode: 'debug',
|
||||
buildApkSplitPerAbi: false,
|
||||
),
|
||||
@ -92,7 +92,7 @@ void main() {
|
||||
Event.commandUsageValues(
|
||||
workflow: 'apk',
|
||||
commandHasTerminal: false,
|
||||
buildApkTargetPlatform: 'android-arm,android-arm64,android-x86,android-x64',
|
||||
buildApkTargetPlatform: 'android-arm,android-arm64,android-x64',
|
||||
buildApkBuildMode: 'jit_release',
|
||||
buildApkSplitPerAbi: false,
|
||||
),
|
||||
|
||||
@ -128,46 +128,6 @@ void main() {
|
||||
});
|
||||
}
|
||||
|
||||
testWithoutContext('AndroidDevice.startApp does not allow release builds on x86', () async {
|
||||
final AndroidDevice device = AndroidDevice(
|
||||
'1234',
|
||||
modelID: 'TestModel',
|
||||
fileSystem: fileSystem,
|
||||
processManager: processManager,
|
||||
logger: BufferLogger.test(),
|
||||
platform: FakePlatform(),
|
||||
androidSdk: androidSdk,
|
||||
);
|
||||
final File apkFile = fileSystem.file('app-debug.apk')..createSync();
|
||||
final AndroidApk apk = AndroidApk(
|
||||
id: 'FlutterApp',
|
||||
applicationPackage: apkFile,
|
||||
launchActivity: 'FlutterActivity',
|
||||
versionCode: 1,
|
||||
);
|
||||
|
||||
processManager.addCommand(kAdbVersionCommand);
|
||||
processManager.addCommand(kStartServer);
|
||||
|
||||
// This configures the target platform of the device.
|
||||
processManager.addCommand(
|
||||
const FakeCommand(
|
||||
command: <String>['adb', '-s', '1234', 'shell', 'getprop'],
|
||||
stdout: '[ro.product.cpu.abi]: [x86]',
|
||||
),
|
||||
);
|
||||
|
||||
final LaunchResult launchResult = await device.startApp(
|
||||
apk,
|
||||
prebuiltApplication: true,
|
||||
debuggingOptions: DebuggingOptions.disabled(BuildInfo.release),
|
||||
platformArgs: <String, dynamic>{},
|
||||
);
|
||||
|
||||
expect(launchResult.started, false);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
});
|
||||
|
||||
testWithoutContext('AndroidDevice.startApp forwards all supported debugging options', () async {
|
||||
final AndroidDevice device = AndroidDevice(
|
||||
'1234',
|
||||
|
||||
@ -78,7 +78,6 @@ void main() {
|
||||
// The format is [ABI, ABI list]: expected target platform.
|
||||
final Map<List<String>, TargetPlatform> values = <List<String>, TargetPlatform>{
|
||||
<String>['x86_64', 'unknown']: TargetPlatform.android_x64,
|
||||
<String>['x86', 'unknown']: TargetPlatform.android_x86,
|
||||
// The default ABI is arm32
|
||||
<String>['???', 'unknown']: TargetPlatform.android_arm,
|
||||
<String>['arm64-v8a', 'arm64-v8a,']: TargetPlatform.android_arm64,
|
||||
@ -107,7 +106,6 @@ void main() {
|
||||
// The format is [ABI, ABI list]: expected release mode support.
|
||||
final Map<List<String>, bool> values = <List<String>, bool>{
|
||||
<String>['x86_64', 'unknown']: true,
|
||||
<String>['x86', 'unknown']: false,
|
||||
// The default ABI is arm32
|
||||
<String>['???', 'unknown']: true,
|
||||
<String>['arm64-v8a', 'arm64-v8a,']: true,
|
||||
|
||||
@ -1225,86 +1225,6 @@ void main() {
|
||||
overrides: <Type, Generator>{AndroidStudio: () => FakeAndroidStudio()},
|
||||
);
|
||||
|
||||
testUsingContext(
|
||||
'prints deprecation warning when building for x86',
|
||||
() async {
|
||||
// See https://github.com/flutter/flutter/issues/157543 for details.
|
||||
final AndroidGradleBuilder builder = AndroidGradleBuilder(
|
||||
java: FakeJava(),
|
||||
logger: logger,
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
androidStudio: FakeAndroidStudio(),
|
||||
);
|
||||
processManager.addCommand(
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'gradlew',
|
||||
'-q',
|
||||
'-Ptarget-platform=android-x86',
|
||||
'-Ptarget=lib/main.dart',
|
||||
'-Pbase-application-name=android.app.Application',
|
||||
'-Pdart-obfuscation=false',
|
||||
'-Ptrack-widget-creation=false',
|
||||
'-Ptree-shake-icons=false',
|
||||
'assembleRelease',
|
||||
],
|
||||
),
|
||||
);
|
||||
fileSystem.directory('android').childFile('build.gradle').createSync(recursive: true);
|
||||
|
||||
fileSystem.directory('android').childFile('gradle.properties').createSync(recursive: true);
|
||||
|
||||
fileSystem.directory('android').childDirectory('app').childFile('build.gradle')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('apply from: irrelevant/flutter.gradle');
|
||||
|
||||
fileSystem
|
||||
.directory('build')
|
||||
.childDirectory('app')
|
||||
.childDirectory('outputs')
|
||||
.childDirectory('flutter-apk')
|
||||
.childFile('app-release.apk')
|
||||
.createSync(recursive: true);
|
||||
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(
|
||||
fileSystem.currentDirectory,
|
||||
);
|
||||
project.android.appManifestFile
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync(minimalV2EmbeddingManifest);
|
||||
|
||||
await builder.buildGradleApp(
|
||||
project: project,
|
||||
androidBuildInfo: const AndroidBuildInfo(
|
||||
BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
treeShakeIcons: false,
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
targetArchs: <AndroidArch>[AndroidArch.x86],
|
||||
),
|
||||
target: 'lib/main.dart',
|
||||
isBuildingBundle: false,
|
||||
configOnly: false,
|
||||
localGradleErrors: const <GradleHandledError>[],
|
||||
);
|
||||
|
||||
expect(
|
||||
logger.statusText,
|
||||
contains('Built build/app/outputs/flutter-apk/app-release.apk (0.0MB)'),
|
||||
);
|
||||
expect(logger.warningText, contains(androidX86DeprecationWarning));
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
},
|
||||
overrides: <Type, Generator>{AndroidStudio: () => FakeAndroidStudio()},
|
||||
);
|
||||
|
||||
testUsingContext('Uses namespace attribute if manifest lacks a package attribute', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final AndroidSdk sdk = FakeAndroidSdk();
|
||||
@ -2051,103 +1971,6 @@ Gradle Crashed
|
||||
overrides: <Type, Generator>{AndroidStudio: () => FakeAndroidStudio()},
|
||||
);
|
||||
|
||||
testUsingContext(
|
||||
'build apk uses selected local engine with x86 ABI',
|
||||
() async {
|
||||
final AndroidGradleBuilder builder = AndroidGradleBuilder(
|
||||
java: FakeJava(),
|
||||
logger: logger,
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.testLocalEngine(
|
||||
localEngine: 'out/android_x86',
|
||||
localEngineHost: 'out/host_release',
|
||||
),
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
androidStudio: FakeAndroidStudio(),
|
||||
);
|
||||
processManager.addCommand(
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'gradlew',
|
||||
'-q',
|
||||
'-Plocal-engine-repo=/.tmp_rand0/flutter_tool_local_engine_repo.rand0',
|
||||
'-Plocal-engine-build-mode=release',
|
||||
'-Plocal-engine-out=out/android_x86',
|
||||
'-Plocal-engine-host-out=out/host_release',
|
||||
'-Ptarget-platform=android-x86',
|
||||
'-Ptarget=lib/main.dart',
|
||||
'-Pbase-application-name=android.app.Application',
|
||||
'-Pdart-obfuscation=false',
|
||||
'-Ptrack-widget-creation=false',
|
||||
'-Ptree-shake-icons=false',
|
||||
'assembleRelease',
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
fileSystem.file('out/android_x86/flutter_embedding_release.pom')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project>
|
||||
<version>1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b</version>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</project>
|
||||
''');
|
||||
fileSystem.file('out/android_x86/x86_release.pom').createSync(recursive: true);
|
||||
fileSystem.file('out/android_x86/x86_release.jar').createSync(recursive: true);
|
||||
fileSystem
|
||||
.file('out/android_x86/x86_release.maven-metadata.xml')
|
||||
.createSync(recursive: true);
|
||||
fileSystem
|
||||
.file('out/android_x86/flutter_embedding_release.jar')
|
||||
.createSync(recursive: true);
|
||||
fileSystem
|
||||
.file('out/android_x86/flutter_embedding_release.pom')
|
||||
.createSync(recursive: true);
|
||||
fileSystem
|
||||
.file('out/android_x86/flutter_embedding_release.maven-metadata.xml')
|
||||
.createSync(recursive: true);
|
||||
|
||||
fileSystem.file('android/gradlew').createSync(recursive: true);
|
||||
fileSystem.directory('android').childFile('gradle.properties').createSync(recursive: true);
|
||||
fileSystem.file('android/build.gradle').createSync(recursive: true);
|
||||
fileSystem.directory('android').childDirectory('app').childFile('build.gradle')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('apply from: irrelevant/flutter.gradle');
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(
|
||||
fileSystem.currentDirectory,
|
||||
);
|
||||
project.android.appManifestFile
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync(minimalV2EmbeddingManifest);
|
||||
|
||||
await expectLater(() async {
|
||||
await builder.buildGradleApp(
|
||||
project: project,
|
||||
androidBuildInfo: const AndroidBuildInfo(
|
||||
BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
treeShakeIcons: false,
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
),
|
||||
target: 'lib/main.dart',
|
||||
isBuildingBundle: false,
|
||||
configOnly: false,
|
||||
localGradleErrors: const <GradleHandledError>[],
|
||||
);
|
||||
}, throwsToolExit());
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
},
|
||||
overrides: <Type, Generator>{AndroidStudio: () => FakeAndroidStudio()},
|
||||
);
|
||||
|
||||
testUsingContext(
|
||||
'build apk uses selected local engine with x64 ABI',
|
||||
() async {
|
||||
@ -2530,114 +2353,6 @@ Gradle Crashed
|
||||
overrides: <Type, Generator>{AndroidStudio: () => FakeAndroidStudio()},
|
||||
);
|
||||
|
||||
testUsingContext(
|
||||
'build aar uses selected local engine with x86 ABI',
|
||||
() async {
|
||||
final AndroidGradleBuilder builder = AndroidGradleBuilder(
|
||||
java: FakeJava(),
|
||||
logger: logger,
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.testLocalEngine(
|
||||
localEngine: 'out/android_x86',
|
||||
localEngineHost: 'out/host_release',
|
||||
),
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
androidStudio: FakeAndroidStudio(),
|
||||
);
|
||||
processManager.addCommand(
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'gradlew',
|
||||
'-I=/packages/flutter_tools/gradle/aar_init_script.gradle',
|
||||
'-Pflutter-root=/',
|
||||
'-Poutput-dir=build/',
|
||||
'-Pis-plugin=false',
|
||||
'-PbuildNumber=2.0',
|
||||
'-q',
|
||||
'-Pdart-obfuscation=false',
|
||||
'-Ptrack-widget-creation=false',
|
||||
'-Ptree-shake-icons=false',
|
||||
'-Plocal-engine-repo=/.tmp_rand0/flutter_tool_local_engine_repo.rand0',
|
||||
'-Plocal-engine-build-mode=release',
|
||||
'-Plocal-engine-out=out/android_x86',
|
||||
'-Plocal-engine-host-out=out/host_release',
|
||||
'-Ptarget-platform=android-x86',
|
||||
'assembleAarRelease',
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
fileSystem.file('out/android_x86/flutter_embedding_release.pom')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project>
|
||||
<version>1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b</version>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</project>
|
||||
''');
|
||||
fileSystem.file('out/android_x86/x86_release.pom').createSync(recursive: true);
|
||||
fileSystem.file('out/android_x86/x86_release.jar').createSync(recursive: true);
|
||||
fileSystem
|
||||
.file('out/android_x86/x86_release.maven-metadata.xml')
|
||||
.createSync(recursive: true);
|
||||
fileSystem
|
||||
.file('out/android_x86/flutter_embedding_release.jar')
|
||||
.createSync(recursive: true);
|
||||
fileSystem
|
||||
.file('out/android_x86/flutter_embedding_release.pom')
|
||||
.createSync(recursive: true);
|
||||
fileSystem
|
||||
.file('out/android_x86/flutter_embedding_release.maven-metadata.xml')
|
||||
.createSync(recursive: true);
|
||||
|
||||
final File manifestFile = fileSystem.file('pubspec.yaml');
|
||||
manifestFile.createSync(recursive: true);
|
||||
manifestFile.writeAsStringSync('''
|
||||
flutter:
|
||||
module:
|
||||
androidPackage: com.example.test
|
||||
''');
|
||||
|
||||
fileSystem.directory('.android/gradle').createSync(recursive: true);
|
||||
fileSystem.directory('.android/gradle/wrapper').createSync(recursive: true);
|
||||
fileSystem.file('.android/gradlew').createSync(recursive: true);
|
||||
fileSystem.file('.android/gradle.properties').writeAsStringSync('irrelevant');
|
||||
fileSystem.file('.android/build.gradle').createSync(recursive: true);
|
||||
fileSystem.directory('build/outputs/repo').createSync(recursive: true);
|
||||
|
||||
await builder.buildGradleAar(
|
||||
androidBuildInfo: const AndroidBuildInfo(
|
||||
BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
treeShakeIcons: false,
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
),
|
||||
project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
||||
outputDirectory: fileSystem.directory('build/'),
|
||||
target: '',
|
||||
buildNumber: '2.0',
|
||||
);
|
||||
|
||||
expect(
|
||||
fileSystem.link(
|
||||
'build/outputs/repo/io/flutter/flutter_embedding_release/'
|
||||
'1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/'
|
||||
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom',
|
||||
),
|
||||
exists,
|
||||
);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
},
|
||||
overrides: <Type, Generator>{AndroidStudio: () => FakeAndroidStudio()},
|
||||
);
|
||||
|
||||
testUsingContext(
|
||||
'build aar uses selected local engine on x64 ABI',
|
||||
() async {
|
||||
|
||||
@ -8,15 +8,6 @@ import 'package:flutter_tools/src/build_info.dart';
|
||||
import '../../src/common.dart';
|
||||
|
||||
void main() {
|
||||
testWithoutContext('validateBuild throws if attempting to build release/profile on x86', () {
|
||||
expect(
|
||||
() => validateBuild(
|
||||
const AndroidBuildInfo(BuildInfo.release, targetArchs: <AndroidArch>[AndroidArch.x86]),
|
||||
),
|
||||
throwsToolExit(message: 'Cannot build release mode for x86 ABI.'),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('validateBuild does not throw on AOT supported architectures', () {
|
||||
expect(
|
||||
() => validateBuild(
|
||||
@ -45,7 +36,7 @@ void main() {
|
||||
buildNumber: 'a',
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
targetArchs: <AndroidArch>[AndroidArch.x86],
|
||||
targetArchs: <AndroidArch>[AndroidArch.x86_64],
|
||||
),
|
||||
),
|
||||
throwsToolExit(message: 'buildNumber: a was not a valid integer value.'),
|
||||
@ -62,7 +53,7 @@ void main() {
|
||||
buildNumber: '-1',
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
targetArchs: <AndroidArch>[AndroidArch.x86],
|
||||
targetArchs: <AndroidArch>[AndroidArch.x86_64],
|
||||
),
|
||||
),
|
||||
throwsToolExit(message: 'buildNumber: -1 must be a positive integer value.'),
|
||||
@ -79,7 +70,7 @@ void main() {
|
||||
buildNumber: '2100000001',
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
targetArchs: <AndroidArch>[AndroidArch.x86],
|
||||
targetArchs: <AndroidArch>[AndroidArch.x86_64],
|
||||
),
|
||||
),
|
||||
throwsToolExit(
|
||||
@ -101,7 +92,7 @@ void main() {
|
||||
buildNumber: '2',
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
targetArchs: <AndroidArch>[AndroidArch.x86],
|
||||
targetArchs: <AndroidArch>[AndroidArch.x86_64],
|
||||
),
|
||||
),
|
||||
returnsNormally,
|
||||
|
||||
@ -127,9 +127,8 @@ void main() {
|
||||
expect(nativeAssetsDir, exists);
|
||||
|
||||
// We expect one subdirectory for each Android architecture.
|
||||
expect(nativeAssetsDir.listSync().length, 4);
|
||||
expect(nativeAssetsDir.listSync().length, 3);
|
||||
expect(nativeAssetsDir..childDirectory('armeabi-v7a'), exists);
|
||||
expect(nativeAssetsDir..childDirectory('x86'), exists);
|
||||
expect(nativeAssetsDir..childDirectory('arm64-v8a'), exists);
|
||||
expect(nativeAssetsDir..childDirectory('x86_64'), exists);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user