diff --git a/dev/integration_tests/ios_host_app/Host.xcodeproj/project.pbxproj b/dev/integration_tests/ios_host_app/Host.xcodeproj/project.pbxproj index 1c91f1d64d..586f3b015d 100644 --- a/dev/integration_tests/ios_host_app/Host.xcodeproj/project.pbxproj +++ b/dev/integration_tests/ios_host_app/Host.xcodeproj/project.pbxproj @@ -447,6 +447,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; diff --git a/dev/integration_tests/ios_host_app_swift/Host.xcodeproj/project.pbxproj b/dev/integration_tests/ios_host_app_swift/Host.xcodeproj/project.pbxproj index 4caf66477b..c30ae601c9 100644 --- a/dev/integration_tests/ios_host_app_swift/Host.xcodeproj/project.pbxproj +++ b/dev/integration_tests/ios_host_app_swift/Host.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ @@ -56,7 +56,6 @@ 5EF266650049BC10ECFD8C86 /* Pods-Host.debug.xcconfig */, A412A4193ADC80C963762A82 /* Pods-Host.release.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -200,7 +199,7 @@ name = "[CP-User] Run Flutter Build hello Script"; runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -e\nset -u\nsource \"${SRCROOT}/../hello/.ios/Flutter/flutter_export_environment.sh\"\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build"; + shellScript = "set -e\nset -u\nsource \"${SRCROOT}/../hello/.ios/Flutter/flutter_export_environment.sh\"\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build\n"; }; 96286B727046BA8457A788D0 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; @@ -391,6 +390,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; INFOPLIST_FILE = Host/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/packages/flutter_tools/bin/podhelper.rb b/packages/flutter_tools/bin/podhelper.rb index b47e2c4124..30c34b36ae 100644 --- a/packages/flutter_tools/bin/podhelper.rb +++ b/packages/flutter_tools/bin/podhelper.rb @@ -68,6 +68,9 @@ def flutter_additional_ios_build_settings(target) # When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target. # If the pod only supports a higher version, do not delete to correctly produce an error. build_configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' if inherit_deployment_target + + # Apple Silicon ARM simulators not yet supported. + build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386' end end diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart index 7cf04c1ba9..808631afb6 100644 --- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart +++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart @@ -108,7 +108,9 @@ void _updateGeneratedEnvironmentVariablesScript({ localsBuffer.writeln('#!/bin/sh'); localsBuffer.writeln('# This is a generated file; do not edit or check into version control.'); for (final String line in xcodeBuildSettings) { - localsBuffer.writeln('export "$line"'); + if (!line.contains('[')) { // Exported conditional Xcode build settings do not work. + localsBuffer.writeln('export "$line"'); + } } final File generatedModuleBuildPhaseScript = useMacOSConfig @@ -209,6 +211,9 @@ List _xcodeBuildSettingsLines({ if (useMacOSConfig) { // ARM not yet supported https://github.com/flutter/flutter/issues/69221 xcodeBuildSettings.add('EXCLUDED_ARCHS=arm64'); + } else { + // Apple Silicon ARM simulators not yet supported. + xcodeBuildSettings.add('EXCLUDED_ARCHS[sdk=iphonesimulator*]=arm64 i386'); } for (final MapEntry config in buildInfo.toEnvironmentConfig().entries) { diff --git a/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart b/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart index 30b3b686f6..88d58a47cb 100644 --- a/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart @@ -683,12 +683,14 @@ Information about project "Runner": final String contents = config.readAsStringSync(); expect(contents.contains('ARCHS=armv7'), isTrue); + expect(contents.contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=arm64 i386'), isTrue); final File buildPhaseScript = fs.file('path/to/project/ios/Flutter/flutter_export_environment.sh'); expect(buildPhaseScript.existsSync(), isTrue); final String buildPhaseScriptContents = buildPhaseScript.readAsStringSync(); expect(buildPhaseScriptContents.contains('ARCHS=armv7'), isTrue); + expect(buildPhaseScriptContents.contains('"EXCLUDED_ARCHS'), isFalse); }); testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async { diff --git a/packages/flutter_tools/test/integration.shard/build_ios_config_only_test.dart b/packages/flutter_tools/test/integration.shard/build_ios_config_only_test.dart index a2b86f5690..7382a46ced 100644 --- a/packages/flutter_tools/test/integration.shard/build_ios_config_only_test.dart +++ b/packages/flutter_tools/test/integration.shard/build_ios_config_only_test.dart @@ -41,10 +41,7 @@ void main() { // Config is updated if command succeeded. expect(generatedConfig, exists); - expect(generatedConfig.readAsStringSync(), allOf( - contains('DART_OBFUSCATION=true'), - isNot(contains('EXCLUDED_ARCHS')), - )); + expect(generatedConfig.readAsStringSync(), contains('DART_OBFUSCATION=true')); // file that only exists if app was fully built. final File frameworkPlist = fileSystem.file(