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

Do not build for iOS armv7 (#97341)

parent 888208c1
...@@ -138,7 +138,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -138,7 +138,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
outputPath, outputPath,
'Debug', 'Debug',
'App.xcframework', 'App.xcframework',
'ios-arm64_armv7', 'ios-arm64',
'App.framework', 'App.framework',
'App', 'App',
); );
...@@ -148,7 +148,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -148,7 +148,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
outputPath, outputPath,
'Debug', 'Debug',
'App.xcframework', 'App.xcframework',
'ios-arm64_armv7', 'ios-arm64',
'App.framework', 'App.framework',
'Info.plist', 'Info.plist',
)); ));
...@@ -173,12 +173,6 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -173,12 +173,6 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
'app.ios-arm64.symbols', 'app.ios-arm64.symbols',
)); ));
checkFileExists(path.join(
projectDir.path,
'symbols',
'app.ios-armv7.symbols',
));
section('Check debug build has no Dart AOT'); section('Check debug build has no Dart AOT');
final String aotSymbols = await _dylibSymbols(debugAppFrameworkPath); final String aotSymbols = await _dylibSymbols(debugAppFrameworkPath);
...@@ -195,7 +189,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -195,7 +189,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
outputPath, outputPath,
mode, mode,
'App.xcframework', 'App.xcframework',
'ios-arm64_armv7', 'ios-arm64',
'App.framework', 'App.framework',
'App', 'App',
); );
...@@ -212,7 +206,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -212,7 +206,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
outputPath, outputPath,
mode, mode,
'App.xcframework', 'App.xcframework',
'ios-arm64_armv7', 'ios-arm64',
'App.framework', 'App.framework',
'flutter_assets', 'flutter_assets',
'vm_snapshot_data', 'vm_snapshot_data',
...@@ -294,7 +288,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -294,7 +288,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
outputPath, outputPath,
mode, mode,
'connectivity.xcframework', 'connectivity.xcframework',
'ios-arm64_armv7', 'ios-arm64',
'connectivity.framework', 'connectivity.framework',
'connectivity', 'connectivity',
); );
...@@ -319,7 +313,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -319,7 +313,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
outputPath, outputPath,
mode, mode,
'connectivity.xcframework', 'connectivity.xcframework',
'ios-arm64_armv7', 'ios-arm64',
'connectivity.framework', 'connectivity.framework',
'Headers', 'Headers',
'FLTConnectivityPlugin.h', 'FLTConnectivityPlugin.h',
...@@ -330,7 +324,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -330,7 +324,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
outputPath, outputPath,
mode, mode,
'connectivity.xcframework', 'connectivity.xcframework',
'ios-arm64_armv7', 'ios-arm64',
'dSYMs', 'dSYMs',
'connectivity.framework.dSYM', 'connectivity.framework.dSYM',
)); ));
...@@ -363,7 +357,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -363,7 +357,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
outputPath, outputPath,
'Release', 'Release',
'connectivity.xcframework', 'connectivity.xcframework',
'ios-arm64_armv7', 'ios-arm64',
'BCSymbolMaps', 'BCSymbolMaps',
)); ));
...@@ -377,7 +371,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -377,7 +371,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
outputPath, outputPath,
mode, mode,
'FlutterPluginRegistrant.xcframework', 'FlutterPluginRegistrant.xcframework',
'ios-arm64_armv7', 'ios-arm64',
'FlutterPluginRegistrant.framework', 'FlutterPluginRegistrant.framework',
'FlutterPluginRegistrant', 'FlutterPluginRegistrant',
); );
...@@ -387,7 +381,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals ...@@ -387,7 +381,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
outputPath, outputPath,
mode, mode,
'FlutterPluginRegistrant.xcframework', 'FlutterPluginRegistrant.xcframework',
'ios-arm64_armv7', 'ios-arm64',
'FlutterPluginRegistrant.framework', 'FlutterPluginRegistrant.framework',
'Headers', 'Headers',
'GeneratedPluginRegistrant.h', 'GeneratedPluginRegistrant.h',
......
...@@ -81,6 +81,7 @@ def flutter_additional_ios_build_settings(target) ...@@ -81,6 +81,7 @@ def flutter_additional_ios_build_settings(target)
# Override legacy Xcode 11 style VALID_ARCHS[sdk=iphonesimulator*]=x86_64 and prefer Xcode 12 EXCLUDED_ARCHS. # Override legacy Xcode 11 style VALID_ARCHS[sdk=iphonesimulator*]=x86_64 and prefer Xcode 12 EXCLUDED_ARCHS.
build_configuration.build_settings['VALID_ARCHS[sdk=iphonesimulator*]'] = '$(ARCHS_STANDARD)' build_configuration.build_settings['VALID_ARCHS[sdk=iphonesimulator*]'] = '$(ARCHS_STANDARD)'
build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = '$(inherited) i386' build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = '$(inherited) i386'
build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphoneos*]'] = '$(inherited) armv7'
end end
end end
......
...@@ -57,6 +57,7 @@ class GenSnapshot { ...@@ -57,6 +57,7 @@ class GenSnapshot {
DarwinArch? darwinArch, DarwinArch? darwinArch,
Iterable<String> additionalArgs = const <String>[], Iterable<String> additionalArgs = const <String>[],
}) { }) {
assert(darwinArch != DarwinArch.armv7);
assert(snapshotType.platform != TargetPlatform.ios || darwinArch != null); assert(snapshotType.platform != TargetPlatform.ios || darwinArch != null);
final List<String> args = <String>[ final List<String> args = <String>[
...additionalArgs, ...additionalArgs,
...@@ -171,9 +172,8 @@ class AOTSnapshotter { ...@@ -171,9 +172,8 @@ class AOTSnapshotter {
genSnapshotArgs.add('--strip'); genSnapshotArgs.add('--strip');
} }
if (platform == TargetPlatform.android_arm || darwinArch == DarwinArch.armv7) { if (platform == TargetPlatform.android_arm) {
// Use softfp for Android armv7 devices. // Use softfp for Android armv7 devices.
// This is the default for armv7 iOS builds, but harmless to set.
// TODO(cbracken): eliminate this when we fix https://github.com/flutter/flutter/issues/17489 // TODO(cbracken): eliminate this when we fix https://github.com/flutter/flutter/issues/17489
genSnapshotArgs.add('--no-sim-use-hardfp'); genSnapshotArgs.add('--no-sim-use-hardfp');
......
...@@ -546,7 +546,7 @@ enum TargetPlatform { ...@@ -546,7 +546,7 @@ enum TargetPlatform {
// //
// TODO(cbracken): split TargetPlatform.ios into ios_armv7, ios_arm64. // TODO(cbracken): split TargetPlatform.ios into ios_armv7, ios_arm64.
enum DarwinArch { enum DarwinArch {
armv7, armv7, // Deprecated. Used to display 32-bit unsupported devices.
arm64, arm64,
x86_64, x86_64,
} }
...@@ -569,7 +569,6 @@ List<DarwinArch> defaultIOSArchsForEnvironment( ...@@ -569,7 +569,6 @@ List<DarwinArch> defaultIOSArchsForEnvironment(
]; ];
} }
return <DarwinArch>[ return <DarwinArch>[
DarwinArch.armv7,
DarwinArch.arm64, DarwinArch.arm64,
]; ];
} }
...@@ -922,8 +921,6 @@ const String kFileSystemRoots = 'FileSystemRoots'; ...@@ -922,8 +921,6 @@ const String kFileSystemRoots = 'FileSystemRoots';
/// ///
/// This is expected to be a space-delimited list of architectures. If not /// This is expected to be a space-delimited list of architectures. If not
/// provided, defaults to arm64. /// provided, defaults to arm64.
///
/// The other supported value is armv7, the 32-bit iOS architecture.
const String kIosArchs = 'IosArchs'; const String kIosArchs = 'IosArchs';
/// The define to control what macOS architectures are built for. /// The define to control what macOS architectures are built for.
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import '../artifacts.dart'; import '../artifacts.dart';
import '../base/common.dart';
import '../base/file_system.dart'; import '../base/file_system.dart';
import '../build_info.dart'; import '../build_info.dart';
import '../cache.dart'; import '../cache.dart';
...@@ -194,7 +195,7 @@ Future<List<String>> _xcodeBuildSettingsLines({ ...@@ -194,7 +195,7 @@ Future<List<String>> _xcodeBuildSettingsLines({
} }
} else { } else {
if (localEngineName.endsWith('_arm')) { if (localEngineName.endsWith('_arm')) {
arch = 'armv7'; throwToolExit('32-bit iOS local engine binaries are not supported.');
} else if (localEngineName.contains('_arm64')) { } else if (localEngineName.contains('_arm64')) {
arch = 'arm64'; arch = 'arm64';
} else if (localEngineName.contains('_sim')) { } else if (localEngineName.contains('_sim')) {
...@@ -215,6 +216,7 @@ Future<List<String>> _xcodeBuildSettingsLines({ ...@@ -215,6 +216,7 @@ Future<List<String>> _xcodeBuildSettingsLines({
excludedSimulatorArchs += ' arm64'; excludedSimulatorArchs += ' arm64';
} }
xcodeBuildSettings.add('EXCLUDED_ARCHS[sdk=iphonesimulator*]=$excludedSimulatorArchs'); xcodeBuildSettings.add('EXCLUDED_ARCHS[sdk=iphonesimulator*]=$excludedSimulatorArchs');
xcodeBuildSettings.add('EXCLUDED_ARCHS[sdk=iphoneos*]=armv7');
} }
for (final MapEntry<String, String> config in buildInfo.toEnvironmentConfig().entries) { for (final MapEntry<String, String> config in buildInfo.toEnvironmentConfig().entries) {
......
...@@ -1177,6 +1177,7 @@ void main() { ...@@ -1177,6 +1177,7 @@ void main() {
expect(xcodeConfig, contains('FLUTTER_APPLICATION_PATH=')); expect(xcodeConfig, contains('FLUTTER_APPLICATION_PATH='));
expect(xcodeConfig, contains('FLUTTER_TARGET=')); expect(xcodeConfig, contains('FLUTTER_TARGET='));
expect(xcodeConfig, contains('COCOAPODS_PARALLEL_CODE_SIGN=true')); expect(xcodeConfig, contains('COCOAPODS_PARALLEL_CODE_SIGN=true'));
expect(xcodeConfig, contains('EXCLUDED_ARCHS[sdk=iphoneos*]=armv7'));
// Avoid legacy build locations to support Swift Package Manager. // Avoid legacy build locations to support Swift Package Manager.
expect(xcodeConfig, isNot(contains('SYMROOT'))); expect(xcodeConfig, isNot(contains('SYMROOT')));
...@@ -1279,6 +1280,7 @@ void main() { ...@@ -1279,6 +1280,7 @@ void main() {
expect(xcodeConfig, contains('FLUTTER_ROOT=')); expect(xcodeConfig, contains('FLUTTER_ROOT='));
expect(xcodeConfig, contains('FLUTTER_APPLICATION_PATH=')); expect(xcodeConfig, contains('FLUTTER_APPLICATION_PATH='));
expect(xcodeConfig, contains('COCOAPODS_PARALLEL_CODE_SIGN=true')); expect(xcodeConfig, contains('COCOAPODS_PARALLEL_CODE_SIGN=true'));
expect(xcodeConfig, contains('EXCLUDED_ARCHS[sdk=iphoneos*]=armv7'));
// Xcode project // Xcode project
final String xcodeProjectPath = globals.fs.path.join('ios', 'Runner.xcodeproj', 'project.pbxproj'); final String xcodeProjectPath = globals.fs.path.join('ios', 'Runner.xcodeproj', 'project.pbxproj');
expectExists(xcodeProjectPath); expectExists(xcodeProjectPath);
......
...@@ -88,24 +88,6 @@ void main() { ...@@ -88,24 +88,6 @@ void main() {
expect(result, 0); expect(result, 0);
}); });
testWithoutContext('iOS armv7', () async {
processManager.addCommand(
FakeCommand(
command: <String>[
'${artifacts.getArtifactPath(Artifact.genSnapshot, platform: TargetPlatform.ios, mode: BuildMode.release)}_armv7',
'--additional_arg'
],
),
);
final int result = await genSnapshot.run(
snapshotType: SnapshotType(TargetPlatform.ios, BuildMode.release),
darwinArch: DarwinArch.armv7,
additionalArgs: <String>['--additional_arg'],
);
expect(result, 0);
});
testWithoutContext('iOS arm64', () async { testWithoutContext('iOS arm64', () async {
final String genSnapshotPath = artifacts.getArtifactPath( final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshot, Artifact.genSnapshot,
...@@ -224,13 +206,11 @@ void main() { ...@@ -224,13 +206,11 @@ void main() {
); );
processManager.addCommands(<FakeCommand>[ processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'${genSnapshotPath}_armv7', '${genSnapshotPath}_arm64',
'--deterministic', '--deterministic',
'--snapshot_kind=app-aot-assembly', '--snapshot_kind=app-aot-assembly',
'--assembly=$assembly', '--assembly=$assembly',
'--strip', '--strip',
'--no-sim-use-hardfp',
'--no-use-integer-division',
'main.dill', 'main.dill',
]), ]),
kWhichSysctlCommand, kWhichSysctlCommand,
...@@ -239,7 +219,7 @@ void main() { ...@@ -239,7 +219,7 @@ void main() {
'xcrun', 'xcrun',
'cc', 'cc',
'-arch', '-arch',
'armv7', 'arm64',
'-miphoneos-version-min=9.0', '-miphoneos-version-min=9.0',
'-isysroot', '-isysroot',
'path/to/sdk', 'path/to/sdk',
...@@ -253,7 +233,7 @@ void main() { ...@@ -253,7 +233,7 @@ void main() {
'xcrun', 'xcrun',
'clang', 'clang',
'-arch', '-arch',
'armv7', 'arm64',
'-miphoneos-version-min=9.0', '-miphoneos-version-min=9.0',
'-isysroot', '-isysroot',
'path/to/sdk', 'path/to/sdk',
...@@ -280,7 +260,7 @@ void main() { ...@@ -280,7 +260,7 @@ void main() {
buildMode: BuildMode.profile, buildMode: BuildMode.profile,
mainPath: 'main.dill', mainPath: 'main.dill',
outputPath: outputPath, outputPath: outputPath,
darwinArch: DarwinArch.armv7, darwinArch: DarwinArch.arm64,
sdkRoot: 'path/to/sdk', sdkRoot: 'path/to/sdk',
bitcode: true, bitcode: true,
dartObfuscation: false, dartObfuscation: false,
...@@ -290,10 +270,10 @@ void main() { ...@@ -290,10 +270,10 @@ void main() {
expect(processManager, hasNoRemainingExpectations); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds iOS armv7 snapshot with dwarStackTraces', () async { testWithoutContext('builds iOS snapshot with dwarfStackTraces', () async {
final String outputPath = fileSystem.path.join('build', 'foo'); final String outputPath = fileSystem.path.join('build', 'foo');
final String assembly = fileSystem.path.join(outputPath, 'snapshot_assembly.S'); final String assembly = fileSystem.path.join(outputPath, 'snapshot_assembly.S');
final String debugPath = fileSystem.path.join('foo', 'app.ios-armv7.symbols'); final String debugPath = fileSystem.path.join('foo', 'app.ios-arm64.symbols');
final String genSnapshotPath = artifacts.getArtifactPath( final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshot, Artifact.genSnapshot,
platform: TargetPlatform.ios, platform: TargetPlatform.ios,
...@@ -301,13 +281,11 @@ void main() { ...@@ -301,13 +281,11 @@ void main() {
); );
processManager.addCommands(<FakeCommand>[ processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'${genSnapshotPath}_armv7', '${genSnapshotPath}_arm64',
'--deterministic', '--deterministic',
'--snapshot_kind=app-aot-assembly', '--snapshot_kind=app-aot-assembly',
'--assembly=$assembly', '--assembly=$assembly',
'--strip', '--strip',
'--no-sim-use-hardfp',
'--no-use-integer-division',
'--dwarf-stack-traces', '--dwarf-stack-traces',
'--save-debugging-info=$debugPath', '--save-debugging-info=$debugPath',
'main.dill', 'main.dill',
...@@ -318,7 +296,7 @@ void main() { ...@@ -318,7 +296,7 @@ void main() {
'xcrun', 'xcrun',
'cc', 'cc',
'-arch', '-arch',
'armv7', 'arm64',
'-miphoneos-version-min=9.0', '-miphoneos-version-min=9.0',
'-isysroot', '-isysroot',
'path/to/sdk', 'path/to/sdk',
...@@ -331,7 +309,7 @@ void main() { ...@@ -331,7 +309,7 @@ void main() {
'xcrun', 'xcrun',
'clang', 'clang',
'-arch', '-arch',
'armv7', 'arm64',
...kDefaultClang, ...kDefaultClang,
]), ]),
]); ]);
...@@ -341,7 +319,7 @@ void main() { ...@@ -341,7 +319,7 @@ void main() {
buildMode: BuildMode.profile, buildMode: BuildMode.profile,
mainPath: 'main.dill', mainPath: 'main.dill',
outputPath: outputPath, outputPath: outputPath,
darwinArch: DarwinArch.armv7, darwinArch: DarwinArch.arm64,
sdkRoot: 'path/to/sdk', sdkRoot: 'path/to/sdk',
bitcode: false, bitcode: false,
splitDebugInfo: 'foo', splitDebugInfo: 'foo',
...@@ -352,7 +330,7 @@ void main() { ...@@ -352,7 +330,7 @@ void main() {
expect(processManager, hasNoRemainingExpectations); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds iOS armv7 snapshot with obfuscate', () async { testWithoutContext('builds iOS snapshot with obfuscate', () async {
final String outputPath = fileSystem.path.join('build', 'foo'); final String outputPath = fileSystem.path.join('build', 'foo');
final String assembly = fileSystem.path.join(outputPath, 'snapshot_assembly.S'); final String assembly = fileSystem.path.join(outputPath, 'snapshot_assembly.S');
final String genSnapshotPath = artifacts.getArtifactPath( final String genSnapshotPath = artifacts.getArtifactPath(
...@@ -362,13 +340,11 @@ void main() { ...@@ -362,13 +340,11 @@ void main() {
); );
processManager.addCommands(<FakeCommand>[ processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'${genSnapshotPath}_armv7', '${genSnapshotPath}_arm64',
'--deterministic', '--deterministic',
'--snapshot_kind=app-aot-assembly', '--snapshot_kind=app-aot-assembly',
'--assembly=$assembly', '--assembly=$assembly',
'--strip', '--strip',
'--no-sim-use-hardfp',
'--no-use-integer-division',
'--obfuscate', '--obfuscate',
'main.dill', 'main.dill',
]), ]),
...@@ -378,7 +354,7 @@ void main() { ...@@ -378,7 +354,7 @@ void main() {
'xcrun', 'xcrun',
'cc', 'cc',
'-arch', '-arch',
'armv7', 'arm64',
'-miphoneos-version-min=9.0', '-miphoneos-version-min=9.0',
'-isysroot', '-isysroot',
'path/to/sdk', 'path/to/sdk',
...@@ -391,7 +367,7 @@ void main() { ...@@ -391,7 +367,7 @@ void main() {
'xcrun', 'xcrun',
'clang', 'clang',
'-arch', '-arch',
'armv7', 'arm64',
...kDefaultClang, ...kDefaultClang,
]), ]),
]); ]);
...@@ -401,7 +377,7 @@ void main() { ...@@ -401,7 +377,7 @@ void main() {
buildMode: BuildMode.profile, buildMode: BuildMode.profile,
mainPath: 'main.dill', mainPath: 'main.dill',
outputPath: outputPath, outputPath: outputPath,
darwinArch: DarwinArch.armv7, darwinArch: DarwinArch.arm64,
sdkRoot: 'path/to/sdk', sdkRoot: 'path/to/sdk',
bitcode: false, bitcode: false,
dartObfuscation: true, dartObfuscation: true,
...@@ -411,64 +387,7 @@ void main() { ...@@ -411,64 +387,7 @@ void main() {
expect(processManager, hasNoRemainingExpectations); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds iOS armv7 snapshot', () async { testWithoutContext('builds iOS snapshot', () async {
final String outputPath = fileSystem.path.join('build', 'foo');
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.ios,
mode: BuildMode.release,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
'${genSnapshotPath}_armv7',
'--deterministic',
'--snapshot_kind=app-aot-assembly',
'--assembly=${fileSystem.path.join(outputPath, 'snapshot_assembly.S')}',
'--strip',
'--no-sim-use-hardfp',
'--no-use-integer-division',
'main.dill',
]),
kWhichSysctlCommand,
kARMCheckCommand,
const FakeCommand(command: <String>[
'xcrun',
'cc',
'-arch',
'armv7',
'-miphoneos-version-min=9.0',
'-isysroot',
'path/to/sdk',
'-c',
'build/foo/snapshot_assembly.S',
'-o',
'build/foo/snapshot_assembly.o',
]),
const FakeCommand(command: <String>[
'xcrun',
'clang',
'-arch',
'armv7',
...kDefaultClang,
]),
]);
final int genSnapshotExitCode = await snapshotter.build(
platform: TargetPlatform.ios,
buildMode: BuildMode.release,
mainPath: 'main.dill',
outputPath: outputPath,
darwinArch: DarwinArch.armv7,
sdkRoot: 'path/to/sdk',
bitcode: false,
dartObfuscation: false,
);
expect(genSnapshotExitCode, 0);
expect(processManager, hasNoRemainingExpectations);
});
testWithoutContext('builds iOS arm64 snapshot', () async {
final String outputPath = fileSystem.path.join('build', 'foo'); final String outputPath = fileSystem.path.join('build', 'foo');
final String genSnapshotPath = artifacts.getArtifactPath( final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshot, Artifact.genSnapshot,
......
...@@ -451,123 +451,7 @@ void main() { ...@@ -451,123 +451,7 @@ void main() {
ProcessManager: () => processManager, ProcessManager: () => processManager,
}); });
testUsingContext('AotAssemblyProfile generates multiple arches and lipos together', () async { testUsingContext('AotAssemblyProfile with bitcode sends correct argument to snapshotter', () async {
final String build = iosEnvironment.buildDir.path;
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
// This path is not known by the cache due to the iOS gen_snapshot split.
'Artifact.genSnapshot.TargetPlatform.ios.profile_armv7',
'--deterministic',
kAssemblyAot,
'--assembly=$build/armv7/snapshot_assembly.S',
'--strip',
'--no-sim-use-hardfp',
'--no-use-integer-division',
'$build/app.dill',
]),
FakeCommand(command: <String>[
// This path is not known by the cache due to the iOS gen_snapshot split.
'Artifact.genSnapshot.TargetPlatform.ios.profile_arm64',
'--deterministic',
kAssemblyAot,
'--assembly=$build/arm64/snapshot_assembly.S',
'--strip',
'$build/app.dill',
]),
FakeCommand(command: <String>[
'xcrun',
'cc',
'-arch',
'armv7',
'-miphoneos-version-min=9.0',
'-isysroot',
'path/to/iPhoneOS.sdk',
'-c',
'$build/armv7/snapshot_assembly.S',
'-o',
'$build/armv7/snapshot_assembly.o',
]),
FakeCommand(command: <String>[
'xcrun',
'cc',
'-arch',
'arm64',
'-miphoneos-version-min=9.0',
'-isysroot',
'path/to/iPhoneOS.sdk',
'-c',
'$build/arm64/snapshot_assembly.S',
'-o',
'$build/arm64/snapshot_assembly.o',
]),
FakeCommand(command: <String>[
'xcrun',
'clang',
'-arch',
'armv7',
'-miphoneos-version-min=9.0',
'-isysroot',
'path/to/iPhoneOS.sdk',
'-dynamiclib',
'-Xlinker',
'-rpath',
'-Xlinker',
'@executable_path/Frameworks',
'-Xlinker',
'-rpath',
'-Xlinker',
'@loader_path/Frameworks',
'-install_name',
'@rpath/App.framework/App',
'-o',
'$build/armv7/App.framework/App',
'$build/armv7/snapshot_assembly.o',
]),
FakeCommand(command: <String>[
'xcrun',
'clang',
'-arch',
'arm64',
'-miphoneos-version-min=9.0',
'-isysroot',
'path/to/iPhoneOS.sdk',
'-dynamiclib',
'-Xlinker',
'-rpath',
'-Xlinker',
'@executable_path/Frameworks',
'-Xlinker',
'-rpath',
'-Xlinker',
'@loader_path/Frameworks',
'-install_name',
'@rpath/App.framework/App',
'-o',
'$build/arm64/App.framework/App',
'$build/arm64/snapshot_assembly.o',
]),
FakeCommand(command: <String>[
'lipo',
'$build/armv7/App.framework/App',
'$build/arm64/App.framework/App',
'-create',
'-output',
'$build/App.framework/App',
]),
]);
iosEnvironment.defines[kIosArchs] ='armv7 arm64';
iosEnvironment.defines[kSdkRoot] = 'path/to/iPhoneOS.sdk';
await const AotAssemblyProfile().build(iosEnvironment);
expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{
Platform: () => macPlatform,
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
});
testUsingContext('AotAssemblyProfile with bitcode sends correct argument to snapshotter (one arch)', () async {
iosEnvironment.defines[kIosArchs] = 'arm64'; iosEnvironment.defines[kIosArchs] = 'arm64';
iosEnvironment.defines[kBitcodeFlag] = 'true'; iosEnvironment.defines[kBitcodeFlag] = 'true';
iosEnvironment.defines[kSdkRoot] = 'path/to/iPhoneOS.sdk'; iosEnvironment.defines[kSdkRoot] = 'path/to/iPhoneOS.sdk';
......
...@@ -683,7 +683,7 @@ Information about project "Runner": ...@@ -683,7 +683,7 @@ Information about project "Runner":
setUp(() { setUp(() {
fs = MemoryFileSystem.test(); fs = MemoryFileSystem.test();
localIosArtifacts = Artifacts.test(localEngine: 'out/ios_profile_arm'); localIosArtifacts = Artifacts.test(localEngine: 'out/ios_profile_arm64');
macOS = FakePlatform(operatingSystem: 'macos'); macOS = FakePlatform(operatingSystem: 'macos');
fs.file(xcodebuild).createSync(recursive: true); fs.file(xcodebuild).createSync(recursive: true);
}); });
...@@ -744,6 +744,7 @@ Build settings for action build and target plugin2: ...@@ -744,6 +744,7 @@ Build settings for action build and target plugin2:
final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig'); final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig');
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386\n')); expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386\n'));
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphoneos*]=armv7\n'));
expect(fakeProcessManager, hasNoRemainingExpectations); expect(fakeProcessManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => localIosArtifacts, Artifacts: () => localIosArtifacts,
...@@ -788,6 +789,7 @@ Build settings for action build and target plugin2: ...@@ -788,6 +789,7 @@ Build settings for action build and target plugin2:
final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig'); final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig');
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 arm64\n')); expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 arm64\n'));
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphoneos*]=armv7\n'));
expect(fakeProcessManager, hasNoRemainingExpectations); expect(fakeProcessManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => localIosArtifacts, Artifacts: () => localIosArtifacts,
...@@ -844,6 +846,7 @@ Build settings for action build and target plugin2: ...@@ -844,6 +846,7 @@ Build settings for action build and target plugin2:
final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig'); final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig');
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 arm64\n')); expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 arm64\n'));
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphoneos*]=armv7\n'));
expect(fakeProcessManager, hasNoRemainingExpectations); expect(fakeProcessManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => localIosArtifacts, Artifacts: () => localIosArtifacts,
...@@ -863,27 +866,17 @@ Build settings for action build and target plugin2: ...@@ -863,27 +866,17 @@ Build settings for action build and target plugin2:
}); });
} }
testUsingOsxContext('sets ARCHS=armv7 when armv7 local iOS engine is set', () async { testUsingOsxContext('exits when armv7 local engine is set', () async {
localIosArtifacts = Artifacts.test(localEngine: 'out/ios_profile_arm');
const BuildInfo buildInfo = BuildInfo.debug; const BuildInfo buildInfo = BuildInfo.debug;
final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project')); final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
await updateGeneratedXcodeProperties( await expectLater(() =>
project: project, updateGeneratedXcodeProperties(
buildInfo: buildInfo, project: project,
buildInfo: buildInfo,
),
throwsToolExit(message: '32-bit iOS local engine binaries are not supported.'),
); );
final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig');
expect(config.existsSync(), isTrue);
final String contents = config.readAsStringSync();
expect(contents.contains('ARCHS=armv7'), isTrue);
expect(contents.contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=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);
}); });
testUsingContext('sets ARCHS=arm64 when arm64 local host engine is set', () async { testUsingContext('sets ARCHS=arm64 when arm64 local host engine is set', () async {
...@@ -950,6 +943,7 @@ Build settings for action build and target plugin2: ...@@ -950,6 +943,7 @@ Build settings for action build and target plugin2:
final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig'); final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig');
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386\n')); expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386\n'));
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphoneos*]=armv7\n'));
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.readAsStringSync(), isNot(contains('EXCLUDED_ARCHS'))); expect(buildPhaseScript.readAsStringSync(), isNot(contains('EXCLUDED_ARCHS')));
...@@ -1051,35 +1045,6 @@ Build settings for action build and target plugin2: ...@@ -1051,35 +1045,6 @@ Build settings for action build and target plugin2:
}); });
}); });
group('armv7 local engine', () {
Artifacts localArtifacts;
setUp(() {
localArtifacts = Artifacts.test(localEngine: 'out/ios_profile');
});
testUsingContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
const BuildInfo buildInfo = BuildInfo.debug;
final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
await updateGeneratedXcodeProperties(
project: project,
buildInfo: buildInfo,
);
final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig');
expect(config.existsSync(), isTrue);
final String contents = config.readAsStringSync();
expect(contents.contains('ARCHS=arm64'), isTrue);
}, overrides: <Type, Generator>{
Artifacts: () => localArtifacts,
Platform: () => macOS,
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
});
});
String propertyFor(String key, File file) { String propertyFor(String key, File file) {
final List<String> properties = file final List<String> properties = file
.readAsLinesSync() .readAsLinesSync()
......
...@@ -130,7 +130,7 @@ void main() { ...@@ -130,7 +130,7 @@ void main() {
..createSync(recursive: true); ..createSync(recursive: true);
final Directory flutterRoot = fileSystem.directory('/path/to/flutter') final Directory flutterRoot = fileSystem.directory('/path/to/flutter')
..createSync(recursive: true); ..createSync(recursive: true);
const String archs = 'arm64 armv7'; const String archs = 'arm64';
const String buildMode = 'Release'; const String buildMode = 'Release';
const String dartObfuscation = 'false'; const String dartObfuscation = 'false';
const String dartDefines = 'flutter.inspector.structuredErrors%3Dtrue'; const String dartDefines = 'flutter.inspector.structuredErrors%3Dtrue';
......
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