Unverified Commit eee0dc84 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Exclude arm64 from valid iOS simulators (#73828)

parent effa7d52
...@@ -447,6 +447,7 @@ ...@@ -447,6 +447,7 @@
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 50; objectVersion = 51;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
5EF266650049BC10ECFD8C86 /* Pods-Host.debug.xcconfig */, 5EF266650049BC10ECFD8C86 /* Pods-Host.debug.xcconfig */,
A412A4193ADC80C963762A82 /* Pods-Host.release.xcconfig */, A412A4193ADC80C963762A82 /* Pods-Host.release.xcconfig */,
); );
name = Pods;
path = Pods; path = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
...@@ -200,7 +199,7 @@ ...@@ -200,7 +199,7 @@
name = "[CP-User] Run Flutter Build hello Script"; name = "[CP-User] Run Flutter Build hello Script";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; 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 */ = { 96286B727046BA8457A788D0 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
...@@ -391,6 +390,7 @@ ...@@ -391,6 +390,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
INFOPLIST_FILE = Host/Info.plist; INFOPLIST_FILE = Host/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
......
...@@ -68,6 +68,9 @@ def flutter_additional_ios_build_settings(target) ...@@ -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. # 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. # 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 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
end end
......
...@@ -255,7 +255,7 @@ Future<XcodeBuildResult> buildXcodeProject({ ...@@ -255,7 +255,7 @@ Future<XcodeBuildResult> buildXcodeProject({
if (buildForDevice) { if (buildForDevice) {
buildCommands.addAll(<String>['-sdk', 'iphoneos']); buildCommands.addAll(<String>['-sdk', 'iphoneos']);
} else { } else {
buildCommands.addAll(<String>['-sdk', 'iphonesimulator', '-arch', 'x86_64']); buildCommands.addAll(<String>['-sdk', 'iphonesimulator']);
} }
} }
......
...@@ -111,8 +111,10 @@ void _updateGeneratedEnvironmentVariablesScript({ ...@@ -111,8 +111,10 @@ void _updateGeneratedEnvironmentVariablesScript({
localsBuffer.writeln('#!/bin/sh'); localsBuffer.writeln('#!/bin/sh');
localsBuffer.writeln('# This is a generated file; do not edit or check into version control.'); localsBuffer.writeln('# This is a generated file; do not edit or check into version control.');
for (final String line in xcodeBuildSettings) { for (final String line in xcodeBuildSettings) {
if (!line.contains('[')) { // Exported conditional Xcode build settings do not work.
localsBuffer.writeln('export "$line"'); localsBuffer.writeln('export "$line"');
} }
}
final File generatedModuleBuildPhaseScript = useMacOSConfig final File generatedModuleBuildPhaseScript = useMacOSConfig
? project.macos.generatedEnvironmentVariableExportScript ? project.macos.generatedEnvironmentVariableExportScript
...@@ -226,6 +228,9 @@ List<String> _xcodeBuildSettingsLines({ ...@@ -226,6 +228,9 @@ List<String> _xcodeBuildSettingsLines({
if (useMacOSConfig) { if (useMacOSConfig) {
// ARM not yet supported https://github.com/flutter/flutter/issues/69221 // ARM not yet supported https://github.com/flutter/flutter/issues/69221
xcodeBuildSettings.add('EXCLUDED_ARCHS=arm64'); xcodeBuildSettings.add('EXCLUDED_ARCHS=arm64');
} else {
// Apple Silicon ARM simulators not yet supported.
xcodeBuildSettings.add('EXCLUDED_ARCHS[sdk=iphonesimulator*]=arm64 i386');
} }
for (final MapEntry<String, String> config in buildInfo.toEnvironmentConfig().entries) { for (final MapEntry<String, String> config in buildInfo.toEnvironmentConfig().entries) {
......
...@@ -671,12 +671,14 @@ Information about project "Runner": ...@@ -671,12 +671,14 @@ Information about project "Runner":
final String contents = config.readAsStringSync(); final String contents = config.readAsStringSync();
expect(contents.contains('ARCHS=armv7'), isTrue); 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'); final File buildPhaseScript = fs.file('path/to/project/ios/Flutter/flutter_export_environment.sh');
expect(buildPhaseScript.existsSync(), isTrue); expect(buildPhaseScript.existsSync(), isTrue);
final String buildPhaseScriptContents = buildPhaseScript.readAsStringSync(); final String buildPhaseScriptContents = buildPhaseScript.readAsStringSync();
expect(buildPhaseScriptContents.contains('ARCHS=armv7'), isTrue); expect(buildPhaseScriptContents.contains('ARCHS=armv7'), isTrue);
expect(buildPhaseScriptContents.contains('EXCLUDED_ARCHS'), isFalse);
}); });
testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async { testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async {
......
...@@ -43,10 +43,7 @@ void main() { ...@@ -43,10 +43,7 @@ void main() {
// Config is updated if command succeeded. // Config is updated if command succeeded.
expect(generatedConfig, exists); expect(generatedConfig, exists);
expect(generatedConfig.readAsStringSync(), allOf( expect(generatedConfig.readAsStringSync(), contains('DART_OBFUSCATION=true'));
contains('DART_OBFUSCATION=true'),
isNot(contains('EXCLUDED_ARCHS')),
));
// file that only exists if app was fully built. // file that only exists if app was fully built.
final File frameworkPlist = fileSystem.file( final File frameworkPlist = fileSystem.file(
......
...@@ -14,13 +14,40 @@ import '../src/darwin_common.dart'; ...@@ -14,13 +14,40 @@ import '../src/darwin_common.dart';
import 'test_utils.dart'; import 'test_utils.dart';
void main() { void main() {
for (final BuildMode buildMode in <BuildMode>[BuildMode.debug, BuildMode.release]) { group('iOS app validation', () {
group(buildMode.name, () {
String flutterRoot; String flutterRoot;
String projectRoot; String projectRoot;
String flutterBin; String flutterBin;
Directory tempDir; Directory tempDir;
setUpAll(() {
flutterRoot = getFlutterRoot();
tempDir = createResolvedTempDirectorySync('ios_content_validation.');
flutterBin = fileSystem.path.join(
flutterRoot,
'bin',
'flutter',
);
processManager.runSync(<String>[
flutterBin,
...getLocalEngineArguments(),
'create',
'--platforms=ios',
'-i',
'objc',
'hello',
], workingDirectory: tempDir.path);
projectRoot = tempDir.childDirectory('hello').path;
});
tearDownAll(() {
tryToDelete(tempDir);
});
for (final BuildMode buildMode in <BuildMode>[BuildMode.debug, BuildMode.release]) {
group('build in ${buildMode.name} mode', () {
Directory buildPath; Directory buildPath;
Directory outputApp; Directory outputApp;
Directory frameworkDirectory; Directory frameworkDirectory;
...@@ -79,10 +106,6 @@ void main() { ...@@ -79,10 +106,6 @@ void main() {
outputAppFrameworkBinary = outputAppFramework.childFile('App'); outputAppFrameworkBinary = outputAppFramework.childFile('App');
}); });
tearDownAll(() {
tryToDelete(tempDir);
});
testWithoutContext('flutter build ios builds a valid app', () { testWithoutContext('flutter build ios builds a valid app', () {
// Should only contain Flutter.framework and App.framework. // Should only contain Flutter.framework and App.framework.
expect(frameworkDirectory.listSync().length, 2); expect(frameworkDirectory.listSync().length, 2);
...@@ -205,9 +228,44 @@ void main() { ...@@ -205,9 +228,44 @@ void main() {
]); ]);
expect(grepResult.stdout, isNot(contains('matches'))); expect(grepResult.stdout, isNot(contains('matches')));
}); });
});
}
testWithoutContext('build for simulator with all available architectures', () {
final ProcessResult buildSimulator = processManager.runSync(
<String>[
flutterBin,
...getLocalEngineArguments(),
'build',
'ios',
'--simulator',
'--verbose',
'--no-codesign',
],
workingDirectory: projectRoot,
environment: <String, String>{
'FLUTTER_XCODE_ONLY_ACTIVE_ARCH': 'NO',
}, },
skip: !platform.isMacOS,
timeout: const Timeout(Duration(minutes: 5)),
); );
} // This test case would fail if arm64 or i386 were not excluded.
expect(buildSimulator.exitCode, 0);
final File simulatorAppFrameworkBinary = fileSystem.file(fileSystem.path.join(
projectRoot,
'build',
'ios',
'iphonesimulator',
'Runner.app',
'Frameworks',
'App.framework',
'App',
));
expect(simulatorAppFrameworkBinary, exists);
final ProcessResult archs = processManager.runSync(
<String>['file', simulatorAppFrameworkBinary.path],
);
expect(archs.stdout, contains('Mach-O 64-bit dynamically linked shared library x86_64'));
});
}, skip: !platform.isMacOS, timeout: const Timeout(Duration(minutes: 5))
);
} }
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