Improve tracing and fix packages_autoroller (#154841)
Reverts flutter/flutter#154555
Re-lands of https://github.com/flutter/flutter/pull/154441 and https://github.com/flutter/flutter/pull/154369
New changes in this PR:
1. extend timeout of the `Linux packages_autoroller` shard (see step 14 in this example [LED build](https://ci.chromium.org/ui/p/flutter/builders/prod.shadow/Linux%20packages_autoroller/7/infra))
2. use the managed framework repo as the working directory in the `framework.streamDart()` helper function--we were generating gradle lockfiles in the wrong directory
A LED build with this code generated the following gradle lockfile update: d939981cd2
This commit is contained in:
parent
81d23d93f6
commit
92697d3ecc
4
.ci.yaml
4
.ci.yaml
@ -389,7 +389,9 @@ targets:
|
|||||||
- name: Linux packages_autoroller
|
- name: Linux packages_autoroller
|
||||||
presubmit: false
|
presubmit: false
|
||||||
recipe: pub_autoroller/pub_autoroller
|
recipe: pub_autoroller/pub_autoroller
|
||||||
timeout: 30
|
# This takes a while because we need to fetch network dependencies and run
|
||||||
|
# Gradle for every android app in the repo
|
||||||
|
timeout: 45
|
||||||
enabled_branches:
|
enabled_branches:
|
||||||
# Don't run this on release branches
|
# Don't run this on release branches
|
||||||
- master
|
- master
|
||||||
|
@ -33,7 +33,7 @@ class Git {
|
|||||||
_reportFailureAndExit(args, workingDirectory, result, explanation);
|
_reportFailureAndExit(args, workingDirectory, result, explanation);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> run(
|
Future<ProcessResult> run(
|
||||||
List<String> args,
|
List<String> args,
|
||||||
String explanation, {
|
String explanation, {
|
||||||
bool allowNonZeroExitCode = false,
|
bool allowNonZeroExitCode = false,
|
||||||
@ -48,7 +48,7 @@ class Git {
|
|||||||
if (result.exitCode != 0 && !allowNonZeroExitCode) {
|
if (result.exitCode != 0 && !allowNonZeroExitCode) {
|
||||||
_reportFailureAndExit(args, workingDirectory, result, explanation);
|
_reportFailureAndExit(args, workingDirectory, result, explanation);
|
||||||
}
|
}
|
||||||
return result.exitCode;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<ProcessResult> _run(List<String> args, String workingDirectory) async {
|
Future<ProcessResult> _run(List<String> args, String workingDirectory) async {
|
||||||
|
@ -140,7 +140,7 @@ This PR was generated by the automated
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _regenerateGradleLockfiles(Directory repoRoot) async {
|
Future<void> _regenerateGradleLockfiles(Directory repoRoot) async {
|
||||||
await framework.runDart(<String>[
|
await framework.streamDart(<String>[
|
||||||
'${repoRoot.path}/dev/tools/bin/generate_gradle_lockfiles.dart',
|
'${repoRoot.path}/dev/tools/bin/generate_gradle_lockfiles.dart',
|
||||||
'--no-gradle-generation',
|
'--no-gradle-generation',
|
||||||
'--no-exclusion',
|
'--no-exclusion',
|
||||||
@ -149,8 +149,10 @@ This PR was generated by the automated
|
|||||||
// If the git checkout is clean, we did not update any lockfiles and we do
|
// If the git checkout is clean, we did not update any lockfiles and we do
|
||||||
// not need an additional commit.
|
// not need an additional commit.
|
||||||
case NoDiff():
|
case NoDiff():
|
||||||
|
stdio.printTrace('No diff after calling generate_gradle_lockfiles.dart');
|
||||||
return;
|
return;
|
||||||
case OnlyLockfileChanges():
|
case OnlyLockfileChanges():
|
||||||
|
stdio.printTrace('Committing Gradle lockfile changes...');
|
||||||
await framework.commit(
|
await framework.commit(
|
||||||
'Re-generate Gradle lockfiles',
|
'Re-generate Gradle lockfiles',
|
||||||
addFirst: true,
|
addFirst: true,
|
||||||
|
@ -380,7 +380,7 @@ abstract class Repository {
|
|||||||
|
|
||||||
/// Determines if one ref is an ancestor for another.
|
/// Determines if one ref is an ancestor for another.
|
||||||
Future<bool> isAncestor(String possibleAncestor, String possibleDescendant) async {
|
Future<bool> isAncestor(String possibleAncestor, String possibleDescendant) async {
|
||||||
final int exitcode = await git.run(
|
final io.ProcessResult result = await git.run(
|
||||||
<String>[
|
<String>[
|
||||||
'merge-base',
|
'merge-base',
|
||||||
'--is-ancestor',
|
'--is-ancestor',
|
||||||
@ -391,18 +391,18 @@ abstract class Repository {
|
|||||||
allowNonZeroExitCode: true,
|
allowNonZeroExitCode: true,
|
||||||
workingDirectory: (await checkoutDirectory).path,
|
workingDirectory: (await checkoutDirectory).path,
|
||||||
);
|
);
|
||||||
return exitcode == 0;
|
return result.exitCode == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determines if a given commit has a tag.
|
/// Determines if a given commit has a tag.
|
||||||
Future<bool> isCommitTagged(String commit) async {
|
Future<bool> isCommitTagged(String commit) async {
|
||||||
final int exitcode = await git.run(
|
final io.ProcessResult result = await git.run(
|
||||||
<String>['describe', '--exact-match', '--tags', commit],
|
<String>['describe', '--exact-match', '--tags', commit],
|
||||||
'verify $commit is already tagged',
|
'verify $commit is already tagged',
|
||||||
allowNonZeroExitCode: true,
|
allowNonZeroExitCode: true,
|
||||||
workingDirectory: (await checkoutDirectory).path,
|
workingDirectory: (await checkoutDirectory).path,
|
||||||
);
|
);
|
||||||
return exitcode == 0;
|
return result.exitCode == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets repository HEAD to [ref].
|
/// Resets repository HEAD to [ref].
|
||||||
@ -480,16 +480,27 @@ abstract class Repository {
|
|||||||
}
|
}
|
||||||
authorArg = '--author="$author"';
|
authorArg = '--author="$author"';
|
||||||
}
|
}
|
||||||
await git.run(
|
final List<String> commitCmd = <String>[
|
||||||
<String>[
|
'commit',
|
||||||
'commit',
|
'--message',
|
||||||
'--message',
|
message,
|
||||||
message,
|
if (authorArg != null) authorArg,
|
||||||
if (authorArg != null) authorArg,
|
];
|
||||||
],
|
stdio.printTrace('Executing git $commitCmd...');
|
||||||
|
final io.ProcessResult commitResult = await git.run(
|
||||||
|
commitCmd,
|
||||||
'commit changes',
|
'commit changes',
|
||||||
workingDirectory: (await checkoutDirectory).path,
|
workingDirectory: (await checkoutDirectory).path,
|
||||||
);
|
);
|
||||||
|
final String stdout = commitResult.stdout as String;
|
||||||
|
if (stdout.isNotEmpty) {
|
||||||
|
stdio.printTrace(stdout);
|
||||||
|
}
|
||||||
|
final String stderr = commitResult.stderr as String;
|
||||||
|
if (stderr.isNotEmpty) {
|
||||||
|
stdio.printTrace(stderr);
|
||||||
|
}
|
||||||
|
|
||||||
return reverseParse('HEAD');
|
return reverseParse('HEAD');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,19 +619,31 @@ 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 {
|
Future<io.ProcessResult> runFlutter(List<String> args) async {
|
||||||
await _ensureToolReady();
|
await _ensureToolReady();
|
||||||
return processManager.run(<String>[
|
final String workingDirectory = (await checkoutDirectory).path;
|
||||||
fileSystem.path.join((await checkoutDirectory).path, 'bin', 'flutter'),
|
return processManager.run(
|
||||||
...args,
|
<String>[
|
||||||
]);
|
fileSystem.path.join(workingDirectory, 'bin', 'flutter'),
|
||||||
|
...args,
|
||||||
|
],
|
||||||
|
workingDirectory: workingDirectory,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> streamDart(
|
||||||
|
List<String> args, {
|
||||||
|
String? workingDirectory,
|
||||||
|
}) async {
|
||||||
|
final String repoWorkingDirectory = (await checkoutDirectory).path;
|
||||||
|
|
||||||
|
await _streamProcess(
|
||||||
|
<String>[
|
||||||
|
fileSystem.path.join(repoWorkingDirectory, 'bin', 'dart'),
|
||||||
|
...args,
|
||||||
|
],
|
||||||
|
workingDirectory: workingDirectory ?? repoWorkingDirectory,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<io.Process> streamFlutter(
|
Future<io.Process> streamFlutter(
|
||||||
@ -628,11 +651,28 @@ class FrameworkRepository extends Repository {
|
|||||||
void Function(String)? stdoutCallback,
|
void Function(String)? stdoutCallback,
|
||||||
void Function(String)? stderrCallback,
|
void Function(String)? stderrCallback,
|
||||||
}) async {
|
}) async {
|
||||||
await _ensureToolReady();
|
final String workingDirectory = (await checkoutDirectory).path;
|
||||||
final io.Process process = await processManager.start(<String>[
|
|
||||||
fileSystem.path.join((await checkoutDirectory).path, 'bin', 'flutter'),
|
return _streamProcess(
|
||||||
...args,
|
<String>[
|
||||||
]);
|
fileSystem.path.join(workingDirectory, 'bin', 'flutter'),
|
||||||
|
...args,
|
||||||
|
],
|
||||||
|
workingDirectory: workingDirectory,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<io.Process> _streamProcess(
|
||||||
|
List<String> cmd, {
|
||||||
|
void Function(String)? stdoutCallback,
|
||||||
|
void Function(String)? stderrCallback,
|
||||||
|
String? workingDirectory,
|
||||||
|
}) async {
|
||||||
|
stdio.printTrace('Executing $cmd...');
|
||||||
|
final io.Process process = await processManager.start(
|
||||||
|
cmd,
|
||||||
|
workingDirectory: workingDirectory,
|
||||||
|
);
|
||||||
process
|
process
|
||||||
.stdout
|
.stdout
|
||||||
.transform(utf8.decoder)
|
.transform(utf8.decoder)
|
||||||
@ -643,6 +683,15 @@ class FrameworkRepository extends Repository {
|
|||||||
.transform(utf8.decoder)
|
.transform(utf8.decoder)
|
||||||
.transform(const LineSplitter())
|
.transform(const LineSplitter())
|
||||||
.listen(stderrCallback ?? stdio.printError);
|
.listen(stderrCallback ?? stdio.printError);
|
||||||
|
final int exitCode = await process.exitCode;
|
||||||
|
if (exitCode != 0) {
|
||||||
|
throw io.ProcessException(
|
||||||
|
cmd.first,
|
||||||
|
cmd.sublist(1),
|
||||||
|
'Process failed',
|
||||||
|
exitCode,
|
||||||
|
);
|
||||||
|
}
|
||||||
return process;
|
return process;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ sealed class CheckoutStatePostGradleRegeneration {
|
|||||||
return const NoDiff();
|
return const NoDiff();
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> changes = gitStatusOutput.trim().split('\n');
|
final List<String> changes = gitStatusOutput.split('\n');
|
||||||
final List<String> changedPaths = <String>[];
|
final List<String> changedPaths = <String>[];
|
||||||
for (final String line in changes) {
|
for (final String line in changes) {
|
||||||
final RegExpMatch? match = pattern.firstMatch(line);
|
final RegExpMatch? match = pattern.firstMatch(line);
|
||||||
|
@ -293,10 +293,6 @@ void main() {
|
|||||||
'-b',
|
'-b',
|
||||||
'packages-autoroller-branch-1',
|
'packages-autoroller-branch-1',
|
||||||
]),
|
]),
|
||||||
const FakeCommand(command: <String>[
|
|
||||||
'$checkoutsParentDirectory/flutter_conductor_checkouts/framework/bin/flutter',
|
|
||||||
'help',
|
|
||||||
]),
|
|
||||||
const FakeCommand(command: <String>[
|
const FakeCommand(command: <String>[
|
||||||
'$checkoutsParentDirectory/flutter_conductor_checkouts/framework/bin/flutter',
|
'$checkoutsParentDirectory/flutter_conductor_checkouts/framework/bin/flutter',
|
||||||
'--verbose',
|
'--verbose',
|
||||||
@ -389,10 +385,6 @@ void main() {
|
|||||||
'-b',
|
'-b',
|
||||||
'packages-autoroller-branch-1',
|
'packages-autoroller-branch-1',
|
||||||
]),
|
]),
|
||||||
const FakeCommand(command: <String>[
|
|
||||||
'$checkoutsParentDirectory/flutter_conductor_checkouts/framework/bin/flutter',
|
|
||||||
'help',
|
|
||||||
]),
|
|
||||||
const FakeCommand(command: <String>[
|
const FakeCommand(command: <String>[
|
||||||
'$checkoutsParentDirectory/flutter_conductor_checkouts/framework/bin/flutter',
|
'$checkoutsParentDirectory/flutter_conductor_checkouts/framework/bin/flutter',
|
||||||
'--verbose',
|
'--verbose',
|
||||||
|
@ -28,7 +28,6 @@ const Map<String, String> kManuallyPinnedDependencies = <String, String>{
|
|||||||
'leak_tracker': '10.0.7', // https://github.com/flutter/devtools/issues/3951
|
'leak_tracker': '10.0.7', // https://github.com/flutter/devtools/issues/3951
|
||||||
'leak_tracker_testing': '3.0.1', // https://github.com/flutter/devtools/issues/3951
|
'leak_tracker_testing': '3.0.1', // https://github.com/flutter/devtools/issues/3951
|
||||||
'leak_tracker_flutter_testing': '3.0.8', // https://github.com/flutter/devtools/issues/3951
|
'leak_tracker_flutter_testing': '3.0.8', // https://github.com/flutter/devtools/issues/3951
|
||||||
'path_provider_android': '2.2.1', // https://github.com/flutter/flutter/issues/140796
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// These are packages that are explicitly excluded from appearing in the list
|
/// These are packages that are explicitly excluded from appearing in the list
|
||||||
|
Loading…
x
Reference in New Issue
Block a user