[flutter_tools] restore report timings functionality to build aot (#52918)
This commit is contained in:
@@ -22,6 +22,10 @@ void main() {
|
||||
Platform: () => FakePlatform(operatingSystem: 'linux', environment: const <String, String>{}),
|
||||
});
|
||||
|
||||
test('Android AOT targets has analyicsName', () {
|
||||
expect(androidArmProfile.analyticsName, 'android_aot');
|
||||
});
|
||||
|
||||
testbed.test('debug bundle contains expected resources', () async {
|
||||
final Environment environment = Environment.test(
|
||||
globals.fs.currentDirectory,
|
||||
|
||||
@@ -45,6 +45,11 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
test('iOS AOT targets has analyicsName', () {
|
||||
expect(const AotAssemblyRelease().analyticsName, 'ios_aot');
|
||||
expect(const AotAssemblyProfile().analyticsName, 'ios_aot');
|
||||
});
|
||||
|
||||
test('DebugUniveralFramework creates expected binary with arm64 only arch', () => testbed.run(() async {
|
||||
environment.defines[kIosArchs] = 'arm64';
|
||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/aot.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/process.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
import 'package:flutter_tools/src/ios/bitcode.dart';
|
||||
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
||||
import 'package:flutter_tools/src/macos/xcode.dart';
|
||||
@@ -106,6 +108,48 @@ void main() {
|
||||
PlistParser: () => mockPlistUtils,
|
||||
});
|
||||
|
||||
testUsingContext('build aot outputs timing info', () async {
|
||||
globals.fs.file('.dart_tool/flutter_build/cce09742720db17ffec62331bd7e42d5/app.so')
|
||||
.createSync(recursive: true);
|
||||
when(buildSystem.build(any, any))
|
||||
.thenAnswer((Invocation invocation) async {
|
||||
return BuildResult(success: true, performance: <String, PerformanceMeasurement>{
|
||||
'kernel_snapshot': PerformanceMeasurement(
|
||||
analyicsName: 'kernel_snapshot',
|
||||
target: 'kernel_snapshot',
|
||||
elapsedMilliseconds: 1000,
|
||||
passed: true,
|
||||
skipped: false,
|
||||
),
|
||||
'anything': PerformanceMeasurement(
|
||||
analyicsName: 'android_aot',
|
||||
target: 'anything',
|
||||
elapsedMilliseconds: 1000,
|
||||
passed: true,
|
||||
skipped: false,
|
||||
),
|
||||
});
|
||||
});
|
||||
|
||||
await AotBuilder().build(
|
||||
platform: TargetPlatform.android_arm64,
|
||||
outputPath: '/',
|
||||
buildInfo: BuildInfo.release,
|
||||
mainDartFile: globals.fs.path.join('lib', 'main.dart'),
|
||||
reportTimings: true,
|
||||
);
|
||||
|
||||
expect(testLogger.statusText, allOf(
|
||||
contains('frontend(CompileTime): 1000 ms.'),
|
||||
contains('snapshot(CompileTime): 1000 ms.'),
|
||||
));
|
||||
}, overrides: <Type, Generator>{
|
||||
BuildSystem: () => MockBuildSystem(),
|
||||
FileSystem: () => MemoryFileSystem.test(),
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
|
||||
testUsingContext('build aot can parse valid Xcode Clang version (11)', () async {
|
||||
final Directory flutterFramework = memoryFileSystem.directory('ios_profile/Flutter.framework')
|
||||
..createSync(recursive: true);
|
||||
@@ -227,3 +271,4 @@ void main() {
|
||||
|
||||
class MockXcode extends Mock implements Xcode {}
|
||||
class MockPlistUtils extends Mock implements PlistParser {}
|
||||
class MockBuildSystem extends Mock implements BuildSystem {}
|
||||
|
||||
Reference in New Issue
Block a user