Pass ARCHS build setting to flutter assemble on macOS (#100811)

This commit is contained in:
Jenn Magder 2022-03-28 10:55:14 -07:00 committed by GitHub
parent 810784842a
commit 231c1a4b55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -70,7 +70,7 @@ BuildApp() {
"assemble"
"--no-version-check"
"-dTargetPlatform=darwin"
"-dDarwinArchs=x86_64 arm64"
"-dDarwinArchs=${ARCHS}"
"-dTargetFile=${target_path}"
"-dBuildMode=${build_mode}"
"-dTreeShakeIcons=${TREE_SHAKE_ICONS}"

View File

@ -79,7 +79,21 @@ void main() {
'App.framework',
));
expect(outputAppFramework.childFile('App'), exists);
final File outputAppFrameworkBinary = outputAppFramework.childFile('App');
final String archs = processManager.runSync(
<String>['file', outputAppFrameworkBinary.path],
).stdout as String;
final bool containsX64 = archs.contains('Mach-O 64-bit dynamically linked shared library x86_64');
final bool containsArm = archs.contains('Mach-O 64-bit dynamically linked shared library arm64');
if (buildModeLower == 'debug') {
// Only build the architecture matching the machine running this test, not both.
expect(containsX64 ^ containsArm, isTrue, reason: 'Unexpected architecture $archs');
} else {
expect(containsX64, isTrue, reason: 'Unexpected architecture $archs');
expect(containsArm, isTrue, reason: 'Unexpected architecture $archs');
}
expect(outputAppFramework.childLink('Resources'), exists);
final File vmSnapshot = fileSystem.file(fileSystem.path.join(