blob: c37f011c95cc6b0947030c84b3686952e84548a8 [file] [log] [blame]
// Copyright 2014 The Flutter Authors. All rights reserved.
// 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';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
Future<void> main() async {
await task(() async {
try {
await runProjectTest((FlutterProject flutterProject) async {
await inDirectory(flutterProject.rootPath, () async {
final String output = await evalFlutter('build', options: <String>[
// Note this isBot so usage won't actually be sent,
// this log line is printed whenever the app is archived.
if (!output.contains('Sending archive event if usage enabled')) {
throw TaskResult.failure('Usage archive event not sent');
final String archivePath = path.join(
final String products = path.join(archivePath, 'Products');
final Directory applications = Directory(path.join(products, 'Applications'));
final Directory appBundle = applications
.singleWhere((Directory directory) => path.extension(directory.path) == '.app');
final String flutterFramework = path.join(
// Exits 0 only if codesigned.
final Future<String> flutterCodesign =
eval('xcrun', <String>['codesign', '--verify', flutterFramework]);
final String appFramework = path.join(
final Future<String> appCodesign =
eval('xcrun', <String>['codesign', '--verify', appFramework]);
await flutterCodesign;
await appCodesign;
return TaskResult.success(null);
} on TaskResult catch (taskResult) {
return taskResult;
} catch (e) {
return TaskResult.failure(e.toString());