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

Make module tests pass on Xcode 14 (#110556)

parent 253e3c08
......@@ -101,28 +101,14 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
final String outputPath = path.join(projectDir.path, outputDirectoryName);
// TODO(jmagman): Remove ios-arm64_armv7 checks when armv7 engine artifacts are removed.
final String arm64FlutterFramework = path.join(
checkFileExists(path.join(
outputPath,
'Debug',
'Flutter.xcframework',
'ios-arm64',
'Flutter.framework',
);
final String armv7FlutterFramework = path.join(
outputPath,
'Debug',
'Flutter.xcframework',
'ios-arm64_armv7',
'Flutter.framework',
);
final bool arm64FlutterBinaryExists = exists(File(path.join(arm64FlutterFramework, 'Flutter')));
final bool armv7FlutterBinaryExists = exists(File(path.join(armv7FlutterFramework, 'Flutter')));
if (!arm64FlutterBinaryExists && !armv7FlutterBinaryExists) {
throw TaskResult.failure('Expected debug Flutter engine artifact binary to exist');
}
'Flutter',
));
final String debugAppFrameworkPath = path.join(
outputPath,
......@@ -225,8 +211,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
section("Check all modes' engine dylib");
for (final String mode in <String>['Debug', 'Profile', 'Release']) {
// TODO(jmagman): Remove ios-arm64_armv7 checks when armv7 engine artifacts are removed.
final String arm64EngineBinary = path.join(
final String engineBinary = path.join(
outputPath,
mode,
'Flutter.xcframework',
......@@ -234,23 +219,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
'Flutter.framework',
'Flutter',
);
final String arm64Armv7EngineBinary = path.join(
outputPath,
mode,
'Flutter.xcframework',
'ios-arm64_armv7',
'Flutter.framework',
'Flutter',
);
if (exists(File(arm64EngineBinary))) {
await _checkBitcode(arm64EngineBinary, mode);
} else if (exists(File(arm64Armv7EngineBinary))) {
await _checkBitcode(arm64Armv7EngineBinary, mode);
} else {
throw TaskResult.failure('Expected Flutter $mode engine artifact binary to exist');
}
await _checkBitcode(engineBinary, mode);
checkFileExists(path.join(
outputPath,
......@@ -285,12 +254,21 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
);
await _checkDylib(pluginFrameworkPath);
await _checkBitcode(pluginFrameworkPath, mode);
if (!await _linksOnFlutter(pluginFrameworkPath)) {
throw TaskResult.failure('$pluginFrameworkPath does not link on Flutter');
}
// TODO(jmagman): Remove ios-arm64_armv7 checks when CI is updated to Xcode 14.
final String transitiveDependencyFrameworkPath = path.join(
outputPath,
mode,
'Reachability.xcframework',
'ios-arm64',
'Reachability.framework',
'Reachability',
);
final String armv7TransitiveDependencyFrameworkPath = path.join(
outputPath,
mode,
'Reachability.xcframework',
......@@ -298,8 +276,17 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
'Reachability.framework',
'Reachability',
);
if (await _linksOnFlutter(transitiveDependencyFrameworkPath)) {
throw TaskResult.failure('Transitive dependency $transitiveDependencyFrameworkPath unexpectedly links on Flutter');
final bool transitiveDependencyExists = exists(File(transitiveDependencyFrameworkPath));
final bool armv7TransitiveDependencyExists = exists(File(armv7TransitiveDependencyFrameworkPath));
if (!transitiveDependencyExists && !armv7TransitiveDependencyExists) {
throw TaskResult.failure('Expected debug Flutter engine artifact binary to exist');
}
if ((transitiveDependencyExists && await _linksOnFlutter(transitiveDependencyFrameworkPath)) ||
(armv7TransitiveDependencyExists && await _linksOnFlutter(armv7TransitiveDependencyFrameworkPath))) {
throw TaskResult.failure(
'Transitive dependency $transitiveDependencyFrameworkPath unexpectedly links on Flutter');
}
checkFileExists(path.join(
......@@ -346,14 +333,6 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
checkFileExists(simulatorFrameworkHeaderPath);
}
checkDirectoryExists(path.join(
outputPath,
'Release',
'connectivity.xcframework',
'ios-arm64',
'BCSymbolMaps',
));
section('Check all modes have generated plugin registrant');
for (final String mode in <String>['Debug', 'Profile', 'Release']) {
......@@ -369,7 +348,6 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
'FlutterPluginRegistrant',
);
await _checkStatic(registrantFrameworkPath);
await _checkBitcode(registrantFrameworkPath, mode);
checkFileExists(path.join(
outputPath,
......
......@@ -421,7 +421,6 @@ end
if ((await fileType(builtFlutterBinary)).contains('armv7')) {
throw TaskResult.failure('Unexpected armv7 architecture slice in $builtFlutterBinary');
}
await checkContainsBitcode(builtFlutterBinary);
final String builtAppBinary = path.join(
archivedAppPath,
......@@ -433,7 +432,6 @@ end
if ((await fileType(builtAppBinary)).contains('armv7')) {
throw TaskResult.failure('Unexpected armv7 architecture slice in $builtAppBinary');
}
await checkContainsBitcode(builtAppBinary);
// The host app example builds plugins statically, url_launcher_ios.framework
// should not exist.
......
......@@ -8,7 +8,6 @@ import 'dart:io';
import 'package:path/path.dart' as path;
import 'host_agent.dart';
import 'task_result.dart';
import 'utils.dart';
typedef SimulatorFunction = Future<void> Function(String deviceId);
......@@ -85,12 +84,6 @@ Future<bool> containsBitcode(String pathToBinary) async {
return !emptyBitcodeMarkerFound;
}
Future<void> checkContainsBitcode(String pathToBinary) async {
if (!await containsBitcode(pathToBinary)) {
throw TaskResult.failure('Expected bitcode in $pathToBinary');
}
}
/// Creates and boots a new simulator, passes the new simulator's identifier to
/// `testFunction`.
///
......
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