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 '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());
|
||||||
}
|
}
|
||||||
|
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/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() {
|
|||||||
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() {
|
|||||||
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:
|
|||||||
|
|
||||||
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:
|
|||||||
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:
|
|||||||
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"]
|
||||||
|
Loading…
Reference in New Issue
Block a user