Unverified Commit 90f38907 authored by Emmanuel Garcia's avatar Emmanuel Garcia Committed by GitHub

Support ARM 32 and 64 bits in app bundles

parent c2a93bd5
......@@ -63,6 +63,51 @@ Future<void> main() async {
await runProjectTest((FlutterProject project) async {
section('gradlew assembleRelease');
await project.runGradleTask('assembleRelease');
// When the platform-target isn't specified, we generate the snapshots
// for arm and arm64.
final List<String> targetPlatforms = <String>[
'android-arm',
'android-arm64'
];
for (final String targetPlatform in targetPlatforms) {
final String androidArmSnapshotPath = path.join(
project.rootPath,
'build',
'app',
'intermediates',
'flutter',
'release',
targetPlatform);
final String isolateSnapshotData =
path.join(androidArmSnapshotPath, 'isolate_snapshot_data');
if (!File(isolateSnapshotData).existsSync()) {
throw TaskResult.failure(
'Snapshot doesn\'t exist: $isolateSnapshotData');
}
final String isolateSnapshotInstr =
path.join(androidArmSnapshotPath, 'isolate_snapshot_instr');
if (!File(isolateSnapshotInstr).existsSync()) {
throw TaskResult.failure(
'Snapshot doesn\'t exist: $isolateSnapshotInstr');
}
final String vmSnapshotData =
path.join(androidArmSnapshotPath, 'vm_snapshot_data');
if (!File(isolateSnapshotData).existsSync()) {
throw TaskResult.failure(
'Snapshot doesn\'t exist: $vmSnapshotData');
}
final String vmSnapshotInstr =
path.join(androidArmSnapshotPath, 'vm_snapshot_instr');
if (!File(isolateSnapshotData).existsSync()) {
throw TaskResult.failure(
'Snapshot doesn\'t exist: $vmSnapshotInstr');
}
}
});
await runProjectTest((FlutterProject project) async {
......@@ -311,7 +356,7 @@ class _Dependencies {
String _validateSnapshotDependency(FlutterProject project, String expectedTarget) {
final _Dependencies deps = _Dependencies(
path.join(project.rootPath, 'build', 'app', 'intermediates',
'flutter', 'debug', 'snapshot_blob.bin.d'));
'flutter', 'debug', 'android-arm', 'snapshot_blob.bin.d'));
return deps.target == expectedTarget ? null :
'Dependency file should have $expectedTarget as target. Instead has ${deps.target}';
}
......@@ -27,7 +27,9 @@ class BuildApkCommand extends BuildSubCommand {
)
..addOption('target-platform',
defaultsTo: 'android-arm',
allowed: <String>['android-arm', 'android-arm64', 'android-x86', 'android-x64']);
allowed: <String>['android-arm', 'android-arm64', 'android-x86', 'android-x64'],
help: 'The target platform for which the app is compiled.',
);
}
@override
......
......@@ -20,23 +20,30 @@ class BuildAppBundleCommand extends BuildSubCommand {
argParser
..addFlag('track-widget-creation', negatable: false, hide: !verboseHelp)
..addFlag('build-shared-library',
..addFlag(
'build-shared-library',
negatable: false,
help: 'Whether to prefer compiling to a *.so file (android only).',
)
..addOption('target-platform',
defaultsTo: 'android-arm',
allowed: <String>['android-arm', 'android-arm64']);
..addOption(
'target-platform',
allowed: <String>['android-arm', 'android-arm64'],
help: 'The target platform for which the app is compiled.\n'
'By default, the bundle will include \'arm\' and \'arm64\', '
'which is the recommended configuration for app bundles.\n'
'For more, see https://developer.android.com/distribute/best-practices/develop/64-bit',
);
}
@override
final String name = 'appbundle';
@override
final String description = 'Build an Android App Bundle file from your app.\n\n'
'This command can build debug and release versions of an app bundle for your application. \'debug\' builds support '
'debugging and a quick development cycle. \'release\' builds don\'t support debugging and are '
'suitable for deploying to app stores. \n app bundle improves your app size';
final String description =
'Build an Android App Bundle file from your app.\n\n'
'This command can build debug and release versions of an app bundle for your application. \'debug\' builds support '
'debugging and a quick development cycle. \'release\' builds don\'t support debugging and are '
'suitable for deploying to app stores. \n app bundle improves your app size';
@override
Future<FlutterCommandResult> runCommand() async {
......
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