Commit dc99d61e authored by Jenn Magder's avatar Jenn Magder Committed by Flutter GitHub Bot

Remove simulator arch in Profile and Release, App.xcframework (#48002)

parent a6c3ffe1
...@@ -80,61 +80,51 @@ Future<void> main() async { ...@@ -80,61 +80,51 @@ Future<void> main() async {
'App', 'App',
)); ));
final String appFrameworkPath = path.join( final String debugAppFrameworkPath = path.join(
outputPath, outputPath,
'Debug', 'Debug',
'App.framework', 'App.framework',
'App', 'App',
); );
final String aotSymbols = await dylibSymbols(appFrameworkPath); final String aotSymbols = await dylibSymbols(debugAppFrameworkPath);
if (aotSymbols.contains('architecture') || if (aotSymbols.contains('architecture') ||
aotSymbols.contains('_kDartVmSnapshot')) { aotSymbols.contains('_kDartVmSnapshot')) {
throw TaskResult.failure('Debug App.framework contains AOT'); throw TaskResult.failure('Debug App.framework contains AOT');
} }
await _checkFrameworkArchs(debugAppFrameworkPath, 'Debug');
final String debugAppArchs = await fileType(appFrameworkPath); checkFileExists(path.join(
outputPath,
if (!debugAppArchs.contains('armv7')) { 'Debug',
throw TaskResult.failure('Debug App.framework armv7 architecture missing'); 'App.xcframework',
} 'ios-armv7_arm64',
'App.framework',
if (!debugAppArchs.contains('arm64')) { 'App',
throw TaskResult.failure('Debug App.framework arm64 architecture missing'); ));
}
if (!debugAppArchs.contains('x86_64')) { checkFileExists(path.join(
throw TaskResult.failure('Debug App.framework x86_64 architecture missing'); outputPath,
} 'Debug',
'App.xcframework',
'ios-x86_64-simulator',
'App.framework',
'App',
));
section('Check profile, release builds has Dart AOT dylib'); section('Check profile, release builds has Dart AOT dylib');
for (String mode in <String>['Profile', 'Release']) { for (String mode in <String>['Profile', 'Release']) {
checkFileExists(path.join( final String appFrameworkPath = path.join(
outputPath,
mode,
'App.framework',
'App',
));
final String aotSymbols = await dylibSymbols(path.join(
outputPath, outputPath,
mode, mode,
'App.framework', 'App.framework',
'App', 'App',
)); );
if (!aotSymbols.contains('armv7')) { await _checkFrameworkArchs(appFrameworkPath, mode);
throw TaskResult.failure('$mode App.framework armv7 architecture missing');
}
if (!aotSymbols.contains('arm64')) { final String aotSymbols = await dylibSymbols(appFrameworkPath);
throw TaskResult.failure('$mode App.framework arm64 architecture missing');
}
if (aotSymbols.contains('x86_64')) {
throw TaskResult.failure('$mode App.framework contains x86_64 architecture');
}
if (!aotSymbols.contains('_kDartVmSnapshot')) { if (!aotSymbols.contains('_kDartVmSnapshot')) {
throw TaskResult.failure('$mode App.framework missing Dart AOT'); throw TaskResult.failure('$mode App.framework missing Dart AOT');
...@@ -147,17 +137,38 @@ Future<void> main() async { ...@@ -147,17 +137,38 @@ Future<void> main() async {
'flutter_assets', 'flutter_assets',
'vm_snapshot_data', 'vm_snapshot_data',
)); ));
checkFileExists(path.join(
outputPath,
mode,
'App.xcframework',
'ios-armv7_arm64',
'App.framework',
'App',
));
checkFileNotExists(path.join(
outputPath,
mode,
'App.xcframework',
'ios-x86_64-simulator',
'App.framework',
'App',
));
} }
section("Check all modes' engine dylib"); section("Check all modes' engine dylib");
for (String mode in <String>['Debug', 'Profile', 'Release']) { for (String mode in <String>['Debug', 'Profile', 'Release']) {
checkFileExists(path.join( final String engineFrameworkPath = path.join(
outputPath, outputPath,
mode, mode,
'Flutter.framework', 'Flutter.framework',
'Flutter', 'Flutter',
)); );
await _checkFrameworkArchs(engineFrameworkPath, mode);
checkFileExists(path.join( checkFileExists(path.join(
outputPath, outputPath,
mode, mode,
...@@ -166,14 +177,19 @@ Future<void> main() async { ...@@ -166,14 +177,19 @@ Future<void> main() async {
'Flutter.framework', 'Flutter.framework',
'Flutter', 'Flutter',
)); ));
checkFileExists(path.join( final String simulatorFrameworkPath = path.join(
outputPath, outputPath,
mode, mode,
'Flutter.xcframework', 'Flutter.xcframework',
'ios-x86_64-simulator', 'ios-x86_64-simulator',
'Flutter.framework', 'Flutter.framework',
'Flutter', 'Flutter',
)); );
if (mode == 'Debug') {
checkFileExists(simulatorFrameworkPath);
} else {
checkFileNotExists(simulatorFrameworkPath);
}
} }
section("Check all modes' engine header"); section("Check all modes' engine header");
...@@ -188,12 +204,14 @@ Future<void> main() async { ...@@ -188,12 +204,14 @@ Future<void> main() async {
section("Check all modes' have plugin dylib"); section("Check all modes' have plugin dylib");
for (String mode in <String>['Debug', 'Profile', 'Release']) { for (String mode in <String>['Debug', 'Profile', 'Release']) {
checkFileExists(path.join( final String pluginFrameworkPath = path.join(
outputPath, outputPath,
mode, mode,
'device_info.framework', 'device_info.framework',
'device_info', 'device_info',
)); );
await _checkFrameworkArchs(pluginFrameworkPath, mode);
checkFileExists(path.join( checkFileExists(path.join(
outputPath, outputPath,
mode, mode,
...@@ -202,19 +220,33 @@ Future<void> main() async { ...@@ -202,19 +220,33 @@ Future<void> main() async {
'device_info.framework', 'device_info.framework',
'device_info', 'device_info',
)); ));
checkFileExists(path.join( final String simulatorFrameworkPath = path.join(
outputPath, outputPath,
mode, mode,
'device_info.xcframework', 'device_info.xcframework',
'ios-x86_64-simulator', 'ios-x86_64-simulator',
'device_info.framework', 'device_info.framework',
'device_info', 'device_info',
)); );
if (mode == 'Debug') {
checkFileExists(simulatorFrameworkPath);
} else {
checkFileNotExists(simulatorFrameworkPath);
}
} }
section("Check all modes' have generated plugin registrant"); section("Check all modes' have generated plugin registrant");
for (String mode in <String>['Debug', 'Profile', 'Release']) { for (String mode in <String>['Debug', 'Profile', 'Release']) {
final String registrantFrameworkPath = path.join(
outputPath,
mode,
'FlutterPluginRegistrant.framework',
'FlutterPluginRegistrant'
);
await _checkFrameworkArchs(registrantFrameworkPath, mode);
checkFileExists(path.join( checkFileExists(path.join(
outputPath, outputPath,
mode, mode,
...@@ -231,7 +263,7 @@ Future<void> main() async { ...@@ -231,7 +263,7 @@ Future<void> main() async {
'Headers', 'Headers',
'GeneratedPluginRegistrant.h', 'GeneratedPluginRegistrant.h',
)); ));
checkFileExists(path.join( final String simulatorHeaderPath = path.join(
outputPath, outputPath,
mode, mode,
'FlutterPluginRegistrant.xcframework', 'FlutterPluginRegistrant.xcframework',
...@@ -239,7 +271,12 @@ Future<void> main() async { ...@@ -239,7 +271,12 @@ Future<void> main() async {
'FlutterPluginRegistrant.framework', 'FlutterPluginRegistrant.framework',
'Headers', 'Headers',
'GeneratedPluginRegistrant.h', 'GeneratedPluginRegistrant.h',
)); );
if (mode == 'Debug') {
checkFileExists(simulatorHeaderPath);
} else {
checkFileNotExists(simulatorHeaderPath);
}
} }
return TaskResult.success(null); return TaskResult.success(null);
...@@ -252,3 +289,24 @@ Future<void> main() async { ...@@ -252,3 +289,24 @@ Future<void> main() async {
} }
}); });
} }
Future<void> _checkFrameworkArchs(String frameworkPath, String mode) async {
checkFileExists(frameworkPath);
final String archs = await fileType(frameworkPath);
if (!archs.contains('armv7')) {
throw TaskResult.failure('$mode $frameworkPath armv7 architecture missing');
}
if (!archs.contains('arm64')) {
throw TaskResult.failure('$mode $frameworkPath arm64 architecture missing');
}
final bool containsSimulator = archs.contains('x86_64');
final bool isDebug = mode == 'Debug';
// Debug should contain the simulator archs.
// Release and Profile should not.
if (containsSimulator != isDebug) {
throw TaskResult.failure('$mode $frameworkPath x86_64 architecture ${isDebug ? 'missing' : 'present'}');
}
}
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