Unverified Commit a0e86814 authored by godofredoc's avatar godofredoc Committed by GitHub

Add flutter update packages to some tests. (#75530)

* Add flutter update packages to some tests.

Analyzer_benchmark and flutter_test_performance require to pub get
multiple directories. Rather than delegating the recipes to run flutter
update-packages we explicitly running on tests that need it.

Bug: https://github.com/flutter/flutter/issues/75524

* Add pub get directly on the analyis classes.

* Run flutter get in dev/tools.

* Fix directory path.

* Add more dependency directories.

* Fix typo.

* Add more dependencies.

* Add stocks dependency.

* Fix paths to some apps.

* Add more dependencies.

* Complete dependencies definition.

* More analysis dependencies.

* Add examples dependencies.

* Dev tool dependencies.

* Use update-packages for analyzer benchmark.
parent afd1d92a
......@@ -101,11 +101,20 @@ Future<int> runTest({bool coverage = false, bool noPub = false}) async {
return clock.elapsedMilliseconds;
}
Future<void> pubGetDependencies(List<Directory> directories) async {
for (final Directory directory in directories) {
await inDirectory<void>(directory, () async {
await flutter('pub', options: <String>['get']);
});
}
}
void main() {
task(() async {
final File nodeSourceFile = File(path.join(
flutterDirectory.path, 'packages', 'flutter', 'lib', 'src', 'foundation', 'node.dart',
));
await pubGetDependencies(<Directory>[Directory(path.join(flutterDirectory.path, 'dev', 'automated_tests')),]);
final String originalSource = await nodeSourceFile.readAsString();
try {
await runTest(noPub: true); // first number is meaningless; could have had to build the tool, run pub get, have a cache, etc
......
......@@ -24,6 +24,7 @@ Future<TaskResult> analyzerBenchmarkTask() async {
await inDirectory<void>(flutterDirectory, () async {
rmTree(_megaGalleryDirectory);
mkdirs(_megaGalleryDirectory);
await flutter('update-packages');
await dart(<String>['dev/tools/mega_gallery.dart', '--out=${_megaGalleryDirectory.path}']);
});
......@@ -56,7 +57,7 @@ class _BenchmarkResult {
}
abstract class _Benchmark {
_Benchmark({ this.watch = false });
_Benchmark({this.watch = false});
final bool watch;
......@@ -65,9 +66,9 @@ abstract class _Benchmark {
Directory get directory;
List<String> get options => <String>[
'--benchmark',
if (watch) '--watch',
];
'--benchmark',
if (watch) '--watch',
];
Future<double> execute(int iteration, int targetIterations) async {
section('Analyze $title ${watch ? 'with watcher' : ''} - ${iteration + 1} / $targetIterations');
......@@ -83,7 +84,7 @@ abstract class _Benchmark {
/// Times how long it takes to analyze the Flutter repository.
class _FlutterRepoBenchmark extends _Benchmark {
_FlutterRepoBenchmark({ bool watch = false }) : super(watch: watch);
_FlutterRepoBenchmark({bool watch = false}) : super(watch: watch);
@override
String get title => 'Flutter repo';
......@@ -93,14 +94,13 @@ class _FlutterRepoBenchmark extends _Benchmark {
@override
List<String> get options {
return super.options
..add('--flutter-repo');
return super.options..add('--flutter-repo');
}
}
/// Times how long it takes to analyze the generated "mega_gallery" app.
class _MegaGalleryBenchmark extends _Benchmark {
_MegaGalleryBenchmark({ bool watch = false }) : super(watch: watch);
_MegaGalleryBenchmark({bool watch = false}) : super(watch: watch);
@override
String get title => 'mega gallery';
......
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