Remove build ios-framework --universal flag (#73383)
This commit is contained in:
@@ -10,7 +10,7 @@ import 'package:flutter_devicelab/framework/task_result.dart';
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
/// Tests that iOS .frameworks can be built on module projects.
|
||||
/// Tests that iOS .xcframeworks can be built.
|
||||
Future<void> main() async {
|
||||
await task(() async {
|
||||
|
||||
@@ -76,10 +76,10 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
);
|
||||
});
|
||||
|
||||
// First, build the module in Debug to copy the debug version of Flutter.framework.
|
||||
// This proves "flutter build ios-framework" re-copies the relevant Flutter.framework,
|
||||
// First, build the module in Debug to copy the debug version of Flutter.xcframework.
|
||||
// This proves "flutter build ios-framework" re-copies the relevant Flutter.xcframework,
|
||||
// otherwise building plugins with bitcode will fail linking because the debug version
|
||||
// of Flutter.framework does not contain bitcode.
|
||||
// of Flutter.xcframework does not contain bitcode.
|
||||
await inDirectory(projectDir, () async {
|
||||
await flutter(
|
||||
'build',
|
||||
@@ -101,7 +101,6 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
'build',
|
||||
options: <String>[
|
||||
'ios-framework',
|
||||
'--universal',
|
||||
'--verbose',
|
||||
'--output=$outputDirectoryName'
|
||||
],
|
||||
@@ -110,40 +109,6 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
|
||||
final String outputPath = path.join(projectDir.path, outputDirectoryName);
|
||||
|
||||
section('Check debug build has Dart snapshot as asset');
|
||||
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
'Debug',
|
||||
'App.framework',
|
||||
'flutter_assets',
|
||||
'vm_snapshot_data',
|
||||
));
|
||||
|
||||
section('Check debug build has no Dart AOT');
|
||||
|
||||
// There's still an App.framework with a dylib, but it's empty.
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
'Debug',
|
||||
'App.framework',
|
||||
'App',
|
||||
));
|
||||
|
||||
final String debugAppFrameworkPath = path.join(
|
||||
outputPath,
|
||||
'Debug',
|
||||
'App.framework',
|
||||
'App',
|
||||
);
|
||||
final String aotSymbols = await dylibSymbols(debugAppFrameworkPath);
|
||||
|
||||
if (aotSymbols.contains('architecture') ||
|
||||
aotSymbols.contains('_kDartVmSnapshot')) {
|
||||
throw TaskResult.failure('Debug App.framework contains AOT');
|
||||
}
|
||||
await _checkFrameworkArchs(debugAppFrameworkPath, true);
|
||||
|
||||
// Xcode changed the name of this generated directory in Xcode 12.
|
||||
const String xcode11ArmDirectoryName = 'ios-armv7_arm64';
|
||||
const String xcode12ArmDirectoryName = 'ios-arm64_armv7';
|
||||
@@ -202,26 +167,49 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
throw const FileSystemException('Expected Flutter.framework binary to exist.');
|
||||
}
|
||||
|
||||
final String debugAppFrameworkPath = path.join(
|
||||
outputPath,
|
||||
'Debug',
|
||||
'App.xcframework',
|
||||
localXcodeArmDirectoryName,
|
||||
'App.framework',
|
||||
'App',
|
||||
);
|
||||
checkFileExists(debugAppFrameworkPath);
|
||||
|
||||
section('Check debug build has Dart snapshot as asset');
|
||||
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
'Debug',
|
||||
'App.xcframework',
|
||||
'ios-x86_64-simulator',
|
||||
'App.framework',
|
||||
'App',
|
||||
'flutter_assets',
|
||||
'vm_snapshot_data',
|
||||
));
|
||||
|
||||
section('Check debug build has no Dart AOT');
|
||||
|
||||
final String aotSymbols = await dylibSymbols(debugAppFrameworkPath);
|
||||
|
||||
if (aotSymbols.contains('architecture') ||
|
||||
aotSymbols.contains('_kDartVmSnapshot')) {
|
||||
throw TaskResult.failure('Debug App.framework contains AOT');
|
||||
}
|
||||
|
||||
section('Check profile, release builds has Dart AOT dylib');
|
||||
|
||||
for (final String mode in <String>['Profile', 'Release']) {
|
||||
final String appFrameworkPath = path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
'App.xcframework',
|
||||
localXcodeArmDirectoryName,
|
||||
'App.framework',
|
||||
'App',
|
||||
);
|
||||
|
||||
await _checkFrameworkArchs(appFrameworkPath, false);
|
||||
await _checkBitcode(appFrameworkPath, mode);
|
||||
|
||||
final String aotSymbols = await dylibSymbols(appFrameworkPath);
|
||||
@@ -231,20 +219,13 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
}
|
||||
|
||||
checkFileNotExists(path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
'App.framework',
|
||||
'flutter_assets',
|
||||
'vm_snapshot_data',
|
||||
));
|
||||
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
'App.xcframework',
|
||||
localXcodeArmDirectoryName,
|
||||
'App.framework',
|
||||
'App',
|
||||
'flutter_assets',
|
||||
'vm_snapshot_data',
|
||||
));
|
||||
|
||||
checkFileNotExists(path.join(
|
||||
@@ -261,23 +242,16 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
|
||||
for (final String mode in <String>['Debug', 'Profile', 'Release']) {
|
||||
final String engineFrameworkPath = path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
'Flutter.framework',
|
||||
'Flutter',
|
||||
);
|
||||
|
||||
await _checkFrameworkArchs(engineFrameworkPath, true);
|
||||
await _checkBitcode(engineFrameworkPath, mode);
|
||||
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
'Flutter.xcframework',
|
||||
builderXcodeArmDirectoryName,
|
||||
'Flutter.framework',
|
||||
'Flutter',
|
||||
));
|
||||
);
|
||||
|
||||
await _checkBitcode(engineFrameworkPath, mode);
|
||||
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
@@ -286,34 +260,30 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
'Flutter.framework',
|
||||
'Flutter',
|
||||
));
|
||||
}
|
||||
|
||||
section("Check all modes' engine header");
|
||||
|
||||
for (final String mode in <String>['Debug', 'Profile', 'Release']) {
|
||||
checkFileExists(path.join(outputPath, mode, 'Flutter.framework', 'Headers', 'Flutter.h'));
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
'Flutter.xcframework',
|
||||
'ios-x86_64-simulator',
|
||||
'Flutter.framework',
|
||||
'Headers',
|
||||
'Flutter.h',
|
||||
));
|
||||
}
|
||||
|
||||
section('Check all modes have plugins');
|
||||
|
||||
for (final String mode in <String>['Debug', 'Profile', 'Release']) {
|
||||
final String pluginFrameworkPath = path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
'device_info.framework',
|
||||
'device_info',
|
||||
);
|
||||
await _checkFrameworkArchs(pluginFrameworkPath, mode == 'Debug');
|
||||
await _checkBitcode(pluginFrameworkPath, mode);
|
||||
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
'device_info.xcframework',
|
||||
localXcodeArmDirectoryName,
|
||||
'device_info.framework',
|
||||
'device_info',
|
||||
));
|
||||
);
|
||||
await _checkBitcode(pluginFrameworkPath, mode);
|
||||
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
@@ -362,20 +332,13 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
final String registrantFrameworkPath = path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
'FlutterPluginRegistrant.xcframework',
|
||||
localXcodeArmDirectoryName,
|
||||
'FlutterPluginRegistrant.framework',
|
||||
'FlutterPluginRegistrant'
|
||||
'FlutterPluginRegistrant',
|
||||
);
|
||||
|
||||
await _checkFrameworkArchs(registrantFrameworkPath, mode == 'Debug');
|
||||
await _checkBitcode(registrantFrameworkPath, mode);
|
||||
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
'FlutterPluginRegistrant.framework',
|
||||
'Headers',
|
||||
'GeneratedPluginRegistrant.h',
|
||||
));
|
||||
checkFileExists(path.join(
|
||||
outputPath,
|
||||
mode,
|
||||
@@ -412,7 +375,6 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
options: <String>[
|
||||
'ios-framework',
|
||||
'--cocoapods',
|
||||
'--universal',
|
||||
'--force', // Allow podspec creation on master.
|
||||
'--output=$cocoapodsOutputDirectoryName'
|
||||
],
|
||||
@@ -430,29 +392,29 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
checkDirectoryExists(path.join(
|
||||
cocoapodsOutputPath,
|
||||
mode,
|
||||
'App.framework',
|
||||
'App.xcframework',
|
||||
));
|
||||
|
||||
if (Directory(path.join(
|
||||
cocoapodsOutputPath,
|
||||
mode,
|
||||
'FlutterPluginRegistrant.framework',
|
||||
'FlutterPluginRegistrant.xcframework',
|
||||
)).existsSync() !=
|
||||
isModule) {
|
||||
throw TaskResult.failure(
|
||||
'Unexpected FlutterPluginRegistrant.framework.');
|
||||
'Unexpected FlutterPluginRegistrant.xcframework.');
|
||||
}
|
||||
|
||||
checkDirectoryExists(path.join(
|
||||
cocoapodsOutputPath,
|
||||
mode,
|
||||
'device_info.framework',
|
||||
'device_info.xcframework',
|
||||
));
|
||||
|
||||
checkDirectoryExists(path.join(
|
||||
cocoapodsOutputPath,
|
||||
mode,
|
||||
'package_info.framework',
|
||||
'package_info.xcframework',
|
||||
));
|
||||
}
|
||||
|
||||
@@ -473,27 +435,6 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _checkFrameworkArchs(String frameworkPath, bool shouldContainSimulator) async {
|
||||
checkFileExists(frameworkPath);
|
||||
|
||||
final String archs = await fileType(frameworkPath);
|
||||
if (!archs.contains('armv7')) {
|
||||
throw TaskResult.failure('$frameworkPath armv7 architecture missing');
|
||||
}
|
||||
|
||||
if (!archs.contains('arm64')) {
|
||||
throw TaskResult.failure('$frameworkPath arm64 architecture missing');
|
||||
}
|
||||
final bool containsSimulator = archs.contains('x86_64');
|
||||
|
||||
// Debug should contain the simulator archs.
|
||||
// Release and Profile should not.
|
||||
if (containsSimulator != shouldContainSimulator) {
|
||||
throw TaskResult.failure(
|
||||
'$frameworkPath x86_64 architecture ${shouldContainSimulator ? 'missing' : 'present'}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _checkBitcode(String frameworkPath, String mode) async {
|
||||
checkFileExists(frameworkPath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user