Unverified Commit 84322041 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] throw if asked to build release for x86_64 (#57874)

parent a926715d
......@@ -58,7 +58,13 @@ abstract class AotAssemblyBase extends Target {
?.toList()
?? <DarwinArch>[DarwinArch.arm64];
if (targetPlatform != TargetPlatform.ios) {
throw Exception('aot_assembly is only supported for iOS applications');
throw Exception('aot_assembly is only supported for iOS applications.');
}
if (iosArchs.contains(DarwinArch.x86_64)) {
throw Exception(
'release/profile builds are only supported for physical devices. '
'attempted to build for $iosArchs.'
);
}
// If we're building multiple iOS archs the binaries need to be lipo'd
......
......@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/build_system/build_system.dart';
import 'package:flutter_tools/src/build_system/targets/dart.dart';
......@@ -175,6 +177,30 @@ void main() {
expect(assetDirectory.childFile('vm_snapshot_data'), isNot(exists));
expect(assetDirectory.childFile('isolate_snapshot_data'), isNot(exists));
}));
test('AotAssemblyRelease throws exception if asked to build for x86 target', () => testbed.run(() async {
final FileSystem fileSystem = MemoryFileSystem.test();
final Environment environment = Environment.test(
fileSystem.currentDirectory,
defines: <String, String>{
kTargetPlatform: 'ios',
},
processManager: processManager,
artifacts: MockArtifacts(),
logger: BufferLogger.test(),
fileSystem: fileSystem,
);
environment.defines[kBuildMode] = 'release';
environment.defines[kIosArchs] = 'x86_64';
expect(const AotAssemblyRelease().build(environment), throwsA(isA<Exception>()
.having(
(Exception exception) => exception.toString(),
'description',
contains('release/profile builds are only supported for physical devices.'),
)
));
}));
}
class MockArtifacts extends Mock implements Artifacts {}
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