mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
measure IPA size (#7158)
This commit is contained in:
parent
7da3ab634a
commit
568a6e1e65
@ -4,9 +4,11 @@
|
||||
|
||||
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/tasks/size_tests.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
deviceOperatingSystem = DeviceOperatingSystem.android;
|
||||
await task(createBasicMaterialAppSizeTest());
|
||||
}
|
||||
|
14
dev/devicelab/bin/tasks/basic_material_app_ios__size.dart
Normal file
14
dev/devicelab/bin/tasks/basic_material_app_ios__size.dart
Normal file
@ -0,0 +1,14 @@
|
||||
// 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';
|
||||
import '../framework/framework.dart';
|
||||
import '../framework/utils.dart';
|
||||
|
||||
import 'package:flutter_devicelab/framework/adb.dart';
|
||||
|
||||
TaskFunction createBasicMaterialAppSizeTest() {
|
||||
return () async {
|
||||
const String sampleAppName = 'sample_flutter_app';
|
||||
@ -15,7 +17,7 @@ TaskFunction createBasicMaterialAppSizeTest() {
|
||||
if (await sampleDir.exists())
|
||||
rmTree(sampleDir);
|
||||
|
||||
int apkSizeInBytes;
|
||||
int releaseSizeInBytes;
|
||||
|
||||
await inDirectory(Directory.systemTemp, () async {
|
||||
await flutter('create', options: <String>[sampleAppName]);
|
||||
@ -26,13 +28,21 @@ TaskFunction createBasicMaterialAppSizeTest() {
|
||||
await inDirectory(sampleDir, () async {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
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(
|
||||
<String, dynamic>{'release_size_in_bytes': apkSizeInBytes},
|
||||
<String, dynamic>{'release_size_in_bytes': releaseSizeInBytes},
|
||||
benchmarkScoreKeys: <String>['release_size_in_bytes']);
|
||||
};
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ tasks:
|
||||
|
||||
basic_material_app__size:
|
||||
description: >
|
||||
Measures the APK/IPA sizes of a basic material app.
|
||||
Measures the APK size of a basic material app.
|
||||
stage: devicelab
|
||||
required_agent_capabilities: ["has-android-device"]
|
||||
|
||||
@ -138,10 +138,10 @@ tasks:
|
||||
required_agent_capabilities: ["has-ios-device"]
|
||||
|
||||
flutter_gallery_ios__start_up:
|
||||
stage: devicelab_ios
|
||||
required_agent_capabilities: ["has-ios-device"]
|
||||
description: >
|
||||
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:
|
||||
description: >
|
||||
@ -150,8 +150,14 @@ tasks:
|
||||
required_agent_capabilities: ["has-ios-device"]
|
||||
|
||||
flutter_gallery_ios__transition_perf:
|
||||
stage: devicelab_ios
|
||||
required_agent_capabilities: ["has-ios-device"]
|
||||
description: >
|
||||
Measures the performance of screen transitions in Flutter Gallery on
|
||||
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"]
|
||||
|
Loading…
Reference in New Issue
Block a user