Make the pub roller bot re-generate gradle lockfiles (#149355)
Fixes https://github.com/flutter/flutter/issues/142475
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:process/process.dart';
|
||||
|
||||
import 'git.dart';
|
||||
@@ -93,6 +95,7 @@ This PR was generated by the automated
|
||||
log('Packages are already at latest.');
|
||||
return;
|
||||
}
|
||||
await generateGradleLockfiles(await framework.checkoutDirectory);
|
||||
await pushBranch();
|
||||
await createPr(repository: await framework.checkoutDirectory);
|
||||
await authLogout();
|
||||
@@ -135,6 +138,15 @@ This PR was generated by the automated
|
||||
return true;
|
||||
}
|
||||
|
||||
@visibleForTesting
|
||||
Future<void> generateGradleLockfiles(Directory repoRoot) async {
|
||||
await framework.runDart(<String>[
|
||||
'${repoRoot.path}/dev/tools/bin/generate_gradle_lockfiles.dart',
|
||||
'--no-gradle-generation',
|
||||
'--no-exclusion',
|
||||
]);
|
||||
}
|
||||
|
||||
Future<void> pushBranch() async {
|
||||
final String projectName = framework.mirrorRemote!.url.split(r'/').last;
|
||||
// Encode the token into the remote URL for authentication to work
|
||||
|
||||
@@ -601,6 +601,13 @@ class FrameworkRepository extends Repository {
|
||||
]);
|
||||
}
|
||||
|
||||
Future<io.ProcessResult> runDart(List<String> args) async {
|
||||
return processManager.run(<String>[
|
||||
fileSystem.path.join((await checkoutDirectory).path, 'bin', 'dart'),
|
||||
...args,
|
||||
]);
|
||||
}
|
||||
|
||||
Future<io.ProcessResult> runFlutter(List<String> args) async {
|
||||
await _ensureToolReady();
|
||||
return processManager.run(<String>[
|
||||
|
||||
@@ -432,6 +432,12 @@ void main() {
|
||||
'rev-parse',
|
||||
'HEAD',
|
||||
], stdout: '000deadbeef'),
|
||||
const FakeCommand(command: <String>[
|
||||
'$checkoutsParentDirectory/flutter_conductor_checkouts/framework/bin/dart',
|
||||
'$checkoutsParentDirectory/flutter_conductor_checkouts/framework/dev/tools/bin/generate_gradle_lockfiles.dart',
|
||||
'--no-gradle-generation',
|
||||
'--no-exclusion',
|
||||
]),
|
||||
const FakeCommand(command: <String>[
|
||||
'git',
|
||||
'push',
|
||||
|
||||
Reference in New Issue
Block a user