Pin the version of flutter/plugins to test against (#71166)
diff --git a/dev/bots/test.dart b/dev/bots/test.dart index c0c732d..61d4383 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart
@@ -7,6 +7,8 @@ import 'dart:io'; import 'dart:math' as math; +import 'package:file/file.dart' as fs; +import 'package:file/local.dart'; import 'package:googleapis/bigquery/v2.dart' as bq; import 'package:googleapis_auth/auth_io.dart' as auth; import 'package:http/http.dart' as http; @@ -37,6 +39,7 @@ final String pubCache = path.join(flutterRoot, '.pub-cache'); final String toolRoot = path.join(flutterRoot, 'packages', 'flutter_tools'); final String engineVersionFile = path.join(flutterRoot, 'bin', 'internal', 'engine.version'); +final String flutterPluginsVersionFile = path.join(flutterRoot, 'bin', 'internal', 'flutter_plugins.version'); String get platformFolderName { if (Platform.isWindows) @@ -861,6 +864,25 @@ await _stopChromeDriver(); } +/// Returns the commit hash of the flutter/plugins repository that's rolled in. +/// +/// The flutter/plugins repository is a downstream dependency, it is only used +/// by flutter/flutter for testing purposes, to assure stable tests for a given +/// flutter commit the flutter/plugins commit hash to test against is coded in +/// the bin/internal/flutter_plugins.version file. +/// +/// The `filesystem` parameter specified filesystem to read the plugins version file from. +/// The `pluginsVersionFile` parameter allows specifying an alternative path for the +/// plugins version file, when null [flutterPluginsVersionFile] is used. +Future<String> getFlutterPluginsVersion({ + fs.FileSystem fileSystem = const LocalFileSystem(), + String pluginsVersionFile, +}) async { + final File versionFile = fileSystem.file(pluginsVersionFile ?? flutterPluginsVersionFile); + final String versionFileContents = await versionFile.readAsString(); + return versionFileContents.trim(); +} + /// Executes the test suite for the flutter/plugins repo. Future<void> _runFlutterPluginsTests() async { Future<void> runAnalyze() async { @@ -877,6 +899,17 @@ ], workingDirectory: checkout.path, ); + final String pluginsCommit = await getFlutterPluginsVersion(); + await runCommand( + 'git', + <String>[ + '-c', + 'core.longPaths=true', + 'checkout', + pluginsCommit, + ], + workingDirectory: checkout.path, + ); await runCommand( pub, <String>[