[tools]build ipa validate app icon size (#115594)

* [tools]build ipa validate icon size

* add more checks in case apple change the format, and also add device lab tests

* do not depend on collection package
This commit is contained in:
hellohuanlin
2022-11-29 15:19:02 -08:00
committed by GitHub
parent 900b395451
commit e438a12057
3 changed files with 473 additions and 28 deletions

View File

@@ -17,6 +17,20 @@ Future<void> main() async {
section('Archive');
await inDirectory(flutterProject.rootPath, () async {
final File appIconFile = File(path.join(
flutterProject.rootPath,
'ios',
'Runner',
'Assets.xcassets',
'AppIcon.appiconset',
'Icon-App-20x20@1x.png',
));
// Resizes app icon to 123x456 (it is supposed to be 20x20).
appIconFile.writeAsBytesSync(appIconFile.readAsBytesSync()
..buffer.asByteData().setInt32(16, 123)
..buffer.asByteData().setInt32(20, 456)
);
final String output = await evalFlutter('build', options: <String>[
'xcarchive',
'-v',
@@ -27,6 +41,15 @@ Future<void> main() async {
if (!output.contains('Sending archive event if usage enabled')) {
throw TaskResult.failure('Usage archive event not sent');
}
if (!output.contains('Warning: App icon is using the wrong size (e.g. Icon-App-20x20@1x.png).')) {
throw TaskResult.failure('Must validate incorrect app icon image size.');
}
// The project is still using Flutter template icon.
if (!output.contains('Warning: App icon is set to the default placeholder icon. Replace with unique icons.')) {
throw TaskResult.failure('Must validate template app icon.');
}
});
final String archivePath = path.join(