Unverified Commit d71a8a70 authored by Stephen (Alex) Wallen's avatar Stephen (Alex) Wallen Committed by GitHub

[macOS] Bring up "hello_world" devicelab, compilation test for x86. (#109891)

parent 82f35976
...@@ -2521,6 +2521,15 @@ targets: ...@@ -2521,6 +2521,15 @@ targets:
- bin/** - bin/**
- .ci.yaml - .ci.yaml
- name: Mac hello_world_macos__compile
bringup: true # New target https://github.com/flutter/flutter/issues/109633
recipe: devicelab/devicelab_drone
timeout: 60
properties:
tags: >
["devicelab", "hostonly"]
task_name: hello_world_macos__compile
- name: Mac module_custom_host_app_name_test - name: Mac module_custom_host_app_name_test
recipe: devicelab/devicelab_drone recipe: devicelab/devicelab_drone
timeout: 60 timeout: 60
......
...@@ -226,6 +226,7 @@ ...@@ -226,6 +226,7 @@
/dev/devicelab/bin/tasks/complex_layout_win_desktop__start_up.dart @schectman @flutter/desktop /dev/devicelab/bin/tasks/complex_layout_win_desktop__start_up.dart @schectman @flutter/desktop
/dev/devicelab/bin/tasks/flutter_view_win_desktop__start_up.dart @schectman @flutter/desktop /dev/devicelab/bin/tasks/flutter_view_win_desktop__start_up.dart @schectman @flutter/desktop
/dev/devicelab/bin/tasks/platform_view_win_desktop__start_up.dart @schectman @flutter/desktop /dev/devicelab/bin/tasks/platform_view_win_desktop__start_up.dart @schectman @flutter/desktop
/dev/devicelab/bin/tasks/hello_world_macos__compile.dart @a-wallen @flutter/desktop
## Host only framework tests ## Host only framework tests
# Linux analyze # Linux analyze
......
// 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 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.macos;
await task(createHelloWorldCompileTest());
}
...@@ -671,7 +671,7 @@ class StartupTest { ...@@ -671,7 +671,7 @@ class StartupTest {
'--profile', '--profile',
'--target=$target', '--target=$target',
]); ]);
applicationBinaryPath = _findIosAppInBuildDirectory('$testDirectory/build/ios/iphoneos'); applicationBinaryPath = _findDarwinAppInBuildDirectory('$testDirectory/build/ios/iphoneos');
break; break;
case DeviceOperatingSystem.fake: case DeviceOperatingSystem.fake:
case DeviceOperatingSystem.fuchsia: case DeviceOperatingSystem.fuchsia:
...@@ -805,7 +805,7 @@ class DevtoolsStartupTest { ...@@ -805,7 +805,7 @@ class DevtoolsStartupTest {
'-v', '-v',
'--profile', '--profile',
]); ]);
applicationBinaryPath = _findIosAppInBuildDirectory('$testDirectory/build/ios/iphoneos'); applicationBinaryPath = _findDarwinAppInBuildDirectory('$testDirectory/build/ios/iphoneos');
break; break;
case DeviceOperatingSystem.fake: case DeviceOperatingSystem.fake:
case DeviceOperatingSystem.fuchsia: case DeviceOperatingSystem.fuchsia:
...@@ -1376,28 +1376,41 @@ class CompileTest { ...@@ -1376,28 +1376,41 @@ class CompileTest {
switch (deviceOperatingSystem) { switch (deviceOperatingSystem) {
case DeviceOperatingSystem.ios: case DeviceOperatingSystem.ios:
options.insert(0, 'ios'); case DeviceOperatingSystem.macos:
unawaited(stderr.flush());
late final String deviceId;
if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
deviceId = 'ios';
} else if (deviceOperatingSystem == DeviceOperatingSystem.macos) {
deviceId = 'macos';
} else {
throw Exception('Attempted to run darwin compile workflow with $deviceOperatingSystem');
}
options.insert(0, deviceId);
options.add('--tree-shake-icons'); options.add('--tree-shake-icons');
options.add('--split-debug-info=infos/'); options.add('--split-debug-info=infos/');
watch.start(); watch.start();
await flutter('build', options: options); await flutter('build', options: options);
watch.stop(); watch.stop();
final Directory appBuildDirectory = dir(path.join(cwd, 'build/ios/Release-iphoneos')); final Directory buildDirectory = dir(path.join(
final Directory? appBundle = appBuildDirectory cwd,
.listSync() 'build',
.whereType<Directory?>() ));
.singleWhere((Directory? directory) => final String? appBundlePath =
directory != null && path.extension(directory.path) == '.app', _findDarwinAppInBuildDirectory(buildDirectory.path);
orElse: () => null); if (appBundlePath == null) {
if (appBundle == null) { throw 'Failed to find app bundle in ${buildDirectory.path}';
throw 'Failed to find app bundle in ${appBuildDirectory.path}'; }
}
final String appPath = appBundle.path;
// IPAs are created manually, https://flutter.dev/ios-release/ // IPAs are created manually, https://flutter.dev/ios-release/
await exec('tar', <String>['-zcf', 'build/app.ipa', appPath]); await exec('tar', <String>['-zcf', 'build/app.ipa', appBundlePath]);
releaseSizeInBytes = await file('$cwd/build/app.ipa').length(); releaseSizeInBytes = await file('$cwd/build/app.ipa').length();
if (reportPackageContentSizes) { if (reportPackageContentSizes) {
metrics.addAll(await getSizesFromIosApp(appPath)); final Map<String, Object> sizeMetrics = await getSizesFromDarwinApp(
appPath: appBundlePath,
operatingSystem: deviceOperatingSystem,
);
metrics.addAll(sizeMetrics);
} }
break; break;
case DeviceOperatingSystem.android: case DeviceOperatingSystem.android:
...@@ -1435,8 +1448,6 @@ class CompileTest { ...@@ -1435,8 +1448,6 @@ class CompileTest {
throw Exception('Unsupported option for fake devices'); throw Exception('Unsupported option for fake devices');
case DeviceOperatingSystem.fuchsia: case DeviceOperatingSystem.fuchsia:
throw Exception('Unsupported option for Fuchsia devices'); throw Exception('Unsupported option for Fuchsia devices');
case DeviceOperatingSystem.macos:
throw Exception('Unsupported option for macOS devices');
case DeviceOperatingSystem.windows: case DeviceOperatingSystem.windows:
unawaited(stderr.flush()); unawaited(stderr.flush());
options.insert(0, 'windows'); options.insert(0, 'windows');
...@@ -1496,7 +1507,9 @@ class CompileTest { ...@@ -1496,7 +1507,9 @@ class CompileTest {
case DeviceOperatingSystem.fuchsia: case DeviceOperatingSystem.fuchsia:
throw Exception('Unsupported option for Fuchsia devices'); throw Exception('Unsupported option for Fuchsia devices');
case DeviceOperatingSystem.macos: case DeviceOperatingSystem.macos:
throw Exception('Unsupported option for Fuchsia devices'); unawaited(stderr.flush());
options.insert(0, 'macos');
break;
case DeviceOperatingSystem.windows: case DeviceOperatingSystem.windows:
unawaited(stderr.flush()); unawaited(stderr.flush());
options.insert(0, 'windows'); options.insert(0, 'windows');
...@@ -1511,19 +1524,52 @@ class CompileTest { ...@@ -1511,19 +1524,52 @@ class CompileTest {
}; };
} }
static Future<Map<String, dynamic>> getSizesFromIosApp(String appPath) async { static Future<Map<String, Object>> getSizesFromDarwinApp({
// Thin the binary to only contain one architecture. required String appPath,
final String xcodeBackend = path.join(flutterDirectory.path, 'packages', 'flutter_tools', 'bin', 'xcode_backend.sh'); required DeviceOperatingSystem operatingSystem,
await exec(xcodeBackend, <String>['thin'], environment: <String, String>{ }) async {
'ARCHS': 'arm64', late final File flutterFramework;
'WRAPPER_NAME': path.basename(appPath), late final String frameworkDirectory;
'TARGET_BUILD_DIR': path.dirname(appPath), switch (deviceOperatingSystem) {
}); case DeviceOperatingSystem.ios:
frameworkDirectory = path.join(
appPath,
'Frameworks',
);
flutterFramework = File(path.join(
frameworkDirectory,
'Flutter.framework',
'Flutter',
));
break;
case DeviceOperatingSystem.macos:
frameworkDirectory = path.join(
appPath,
'Contents',
'Frameworks',
);
flutterFramework = File(path.join(
frameworkDirectory,
'FlutterMacOS.framework',
'FlutterMacOS',
)); // https://github.com/flutter/flutter/issues/70413
break;
case DeviceOperatingSystem.android:
case DeviceOperatingSystem.androidArm:
case DeviceOperatingSystem.androidArm64:
case DeviceOperatingSystem.fake:
case DeviceOperatingSystem.fuchsia:
case DeviceOperatingSystem.windows:
throw Exception('Called ${CompileTest.getSizesFromDarwinApp} with $operatingSystem.');
}
final File appFramework = File(path.join(appPath, 'Frameworks', 'App.framework', 'App')); final File appFramework = File(path.join(
final File flutterFramework = File(path.join(appPath, 'Frameworks', 'Flutter.framework', 'Flutter')); frameworkDirectory,
'App.framework',
'App',
));
return <String, dynamic>{ return <String, Object>{
'app_framework_uncompressed_bytes': await appFramework.length(), 'app_framework_uncompressed_bytes': await appFramework.length(),
'flutter_framework_uncompressed_bytes': await flutterFramework.length(), 'flutter_framework_uncompressed_bytes': await flutterFramework.length(),
}; };
...@@ -1884,8 +1930,9 @@ Future<File> waitForFile(String path) async { ...@@ -1884,8 +1930,9 @@ Future<File> waitForFile(String path) async {
throw StateError('Did not find vmservice out file after 1 hour'); throw StateError('Did not find vmservice out file after 1 hour');
} }
String? _findIosAppInBuildDirectory(String searchDirectory) { String? _findDarwinAppInBuildDirectory(String searchDirectory) {
for (final FileSystemEntity entity in Directory(searchDirectory).listSync()) { for (final FileSystemEntity entity in Directory(searchDirectory)
.listSync(recursive: true)) {
if (entity.path.endsWith('.app')) { if (entity.path.endsWith('.app')) {
return entity.path; return entity.path;
} }
......
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