From ac6e3f87b2c44b29ba81f2028bc1aee98fa92f2f Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 5 Mar 2021 18:44:02 -0800 Subject: [PATCH] Add iOS archive codesign test (#77428) --- .../tasks/ios_content_validation_test.dart | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/dev/devicelab/bin/tasks/ios_content_validation_test.dart b/dev/devicelab/bin/tasks/ios_content_validation_test.dart index ec1b89c407b..79c6493d3f9 100644 --- a/dev/devicelab/bin/tasks/ios_content_validation_test.dart +++ b/dev/devicelab/bin/tasks/ios_content_validation_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:io'; + import 'package:flutter_devicelab/framework/apk_utils.dart'; import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/task_result.dart'; @@ -28,16 +30,38 @@ Future main() async { 'Runner.xcarchive', ); - checkDirectoryExists(path.join( - archivePath, - 'Products', - )); + final String products = path.join(archivePath, 'Products'); + + checkDirectoryExists(products); checkDirectoryExists(path.join( archivePath, 'dSYMs', 'Runner.app.dSYM', )); + final Directory applications = Directory(path.join(products, 'Applications')); + + final Directory appBundle = applications + .listSync() + .whereType() + .singleWhere((Directory directory) => path.extension(directory.path) == '.app', orElse: () => null); + + final String flutterFramework = path.join( + appBundle.path, + 'Frameworks', + 'Flutter.framework', + 'Flutter', + ); + // Exits 0 only if codesigned. + eval('xcrun', ['codesign', '--verify', flutterFramework]); + + final String appFramework = path.join( + appBundle.path, + 'Frameworks', + 'App.framework', + 'App', + ); + eval('xcrun', ['codesign', '--verify', appFramework]); }); return TaskResult.success(null);