ios_app_with_extensions_test.dart 1.81 KB
Newer Older
1 2 3 4 5 6 7
// 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/framework.dart';
8
import 'package:flutter_devicelab/framework/task_result.dart';
9
import 'package:flutter_devicelab/framework/utils.dart';
10
import 'package:path/path.dart' as path;
11 12 13

Future<void> main() async {
  await task(() async {
14
    section('Copy test Flutter App with watchOS Companion');
15 16

    final Directory tempDir = Directory.systemTemp
17
        .createTempSync('flutter_ios_app_with_extensions_test.');
18
    final Directory projectDir =
19
        Directory(path.join(tempDir.path, 'app_with_extensions'));
20 21 22 23
    try {
      mkdir(projectDir);
      recursiveCopy(
        Directory(path.join(flutterDirectory.path, 'dev', 'integration_tests',
24
            'ios_app_with_extensions')),
25 26 27 28 29
        projectDir,
      );

      section('Create release build');

30 31 32
      // This attempts to build the companion watchOS app. However, the watchOS
      // SDK is not available in CI and therefore the build will fail.
      // Check to make sure that the tool attempts to build the companion watchOS app.
33
      // See https://github.com/flutter/flutter/pull/94190.
34
      await inDirectory(projectDir, () async {
35
        final String buildOutput = await evalFlutter(
36
          'build',
37
          options: <String>['ios', '--no-codesign', '--release', '--verbose'],
38
        );
39 40 41
        if (!buildOutput.contains('-destination generic/platform=watchOS')) {
          print(buildOutput);
          throw TaskResult.failure('Did not try to get watch build settings');
42
        }
43 44
      });

45 46 47 48 49 50 51 52
      return TaskResult.success(null);
    } catch (e) {
      return TaskResult.failure(e.toString());
    } finally {
      rmTree(tempDir);
    }
  });
}