Commit 568a6e1e authored by Yegor's avatar Yegor Committed by GitHub

measure IPA size (#7158)

parent 7da3ab63
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter_devicelab/tasks/size_tests.dart'; import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/size_tests.dart';
Future<Null> main() async { Future<Null> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createBasicMaterialAppSizeTest()); await task(createBasicMaterialAppSizeTest());
} }
// Copyright 2016 The Chromium 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:async';
import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/size_tests.dart';
Future<Null> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createBasicMaterialAppSizeTest());
}
...@@ -7,6 +7,8 @@ import 'dart:io'; ...@@ -7,6 +7,8 @@ import 'dart:io';
import '../framework/framework.dart'; import '../framework/framework.dart';
import '../framework/utils.dart'; import '../framework/utils.dart';
import 'package:flutter_devicelab/framework/adb.dart';
TaskFunction createBasicMaterialAppSizeTest() { TaskFunction createBasicMaterialAppSizeTest() {
return () async { return () async {
const String sampleAppName = 'sample_flutter_app'; const String sampleAppName = 'sample_flutter_app';
...@@ -15,7 +17,7 @@ TaskFunction createBasicMaterialAppSizeTest() { ...@@ -15,7 +17,7 @@ TaskFunction createBasicMaterialAppSizeTest() {
if (await sampleDir.exists()) if (await sampleDir.exists())
rmTree(sampleDir); rmTree(sampleDir);
int apkSizeInBytes; int releaseSizeInBytes;
await inDirectory(Directory.systemTemp, () async { await inDirectory(Directory.systemTemp, () async {
await flutter('create', options: <String>[sampleAppName]); await flutter('create', options: <String>[sampleAppName]);
...@@ -26,13 +28,21 @@ TaskFunction createBasicMaterialAppSizeTest() { ...@@ -26,13 +28,21 @@ TaskFunction createBasicMaterialAppSizeTest() {
await inDirectory(sampleDir, () async { await inDirectory(sampleDir, () async {
await flutter('packages', options: <String>['get']); await flutter('packages', options: <String>['get']);
await flutter('build', options: <String>['clean']); await flutter('build', options: <String>['clean']);
await flutter('build', options: <String>['apk', '--release']);
apkSizeInBytes = await file('${sampleDir.path}/build/app.apk').length(); if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
await flutter('build', options: <String>['ios', '--release']);
// IPAs are created manually AFAICT
await exec('tar', <String>['-zcf', 'build/app.ipa', 'build/ios/Release-iphoneos/Runner.app/']);
releaseSizeInBytes = await file('${sampleDir.path}/build/app.ipa').length();
} else {
await flutter('build', options: <String>['apk', '--release']);
releaseSizeInBytes = await file('${sampleDir.path}/build/app.apk').length();
}
}); });
}); });
return new TaskResult.success( return new TaskResult.success(
<String, dynamic>{'release_size_in_bytes': apkSizeInBytes}, <String, dynamic>{'release_size_in_bytes': releaseSizeInBytes},
benchmarkScoreKeys: <String>['release_size_in_bytes']); benchmarkScoreKeys: <String>['release_size_in_bytes']);
}; };
} }
...@@ -52,7 +52,7 @@ tasks: ...@@ -52,7 +52,7 @@ tasks:
basic_material_app__size: basic_material_app__size:
description: > description: >
Measures the APK/IPA sizes of a basic material app. Measures the APK size of a basic material app.
stage: devicelab stage: devicelab
required_agent_capabilities: ["has-android-device"] required_agent_capabilities: ["has-android-device"]
...@@ -138,10 +138,10 @@ tasks: ...@@ -138,10 +138,10 @@ tasks:
required_agent_capabilities: ["has-ios-device"] required_agent_capabilities: ["has-ios-device"]
flutter_gallery_ios__start_up: flutter_gallery_ios__start_up:
stage: devicelab_ios
required_agent_capabilities: ["has-ios-device"]
description: > description: >
Measures the startup time of the Flutter Gallery app on iOS. Measures the startup time of the Flutter Gallery app on iOS.
stage: devicelab_ios
required_agent_capabilities: ["has-ios-device"]
complex_layout_ios__start_up: complex_layout_ios__start_up:
description: > description: >
...@@ -150,8 +150,14 @@ tasks: ...@@ -150,8 +150,14 @@ tasks:
required_agent_capabilities: ["has-ios-device"] required_agent_capabilities: ["has-ios-device"]
flutter_gallery_ios__transition_perf: flutter_gallery_ios__transition_perf:
stage: devicelab_ios
required_agent_capabilities: ["has-ios-device"]
description: > description: >
Measures the performance of screen transitions in Flutter Gallery on Measures the performance of screen transitions in Flutter Gallery on
iOS. iOS.
stage: devicelab_ios
required_agent_capabilities: ["has-ios-device"]
basic_material_app_ios__size:
description: >
Measures the IPA size of a basic material app.
stage: devicelab_ios
required_agent_capabilities: ["has-android-device"]
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