@@ -76,18 +76,27 @@ final class RunnerProgress extends RunnerEvent {
7676
7777/// A [RunnerEvent] representing the result of a command.
7878final class RunnerResult extends RunnerEvent {
79- RunnerResult (super .name, super .command, super .timestamp, this .result);
79+ RunnerResult (
80+ super .name,
81+ super .command,
82+ super .timestamp,
83+ this .result, {
84+ this .okMessage = 'OK' ,
85+ });
8086
8187 /// The resuilt of running the command.
8288 final ProcessRunnerResult result;
8389
8490 /// Whether the command was successful.
8591 late final bool ok = result.exitCode == 0 ;
8692
93+ /// The message to print on a successful result. The default is 'OK'.
94+ final String okMessage;
95+
8796 @override
8897 String toString () {
8998 if (ok) {
90- return '[${_timestamp (timestamp )}][$name ]: OK ' ;
99+ return '[${_timestamp (timestamp )}][$name ]: $ okMessage ' ;
91100 }
92101 final StringBuffer buffer = StringBuffer ();
93102 buffer.writeln ('[$timestamp ][$name ]: FAILED' );
@@ -331,6 +340,38 @@ final class BuildRunner extends Runner {
331340 return p.join (engineSrcDir.path, 'flutter' , 'buildtools' , platformDir);
332341 }();
333342
343+ // Returns the second line of output from reproxystatus, which contains
344+ // RBE statistics, or null if something goes wrong.
345+ Future <String ?> _reproxystatus () async {
346+ final String reclientPath = p.join (_buildtoolsPath, 'reclient' );
347+ final String exe = platform.isWindows ? '.exe' : '' ;
348+ final String restatsPath = p.join (reclientPath, 'reproxystatus$exe ' );
349+ final ProcessRunnerResult restatsResult;
350+ if (dryRun) {
351+ restatsResult = ProcessRunnerResult (
352+ 0 , // exit code.
353+ utf8.encode ('OK\n OK\n ' ), // stdout.
354+ < int > [], // stderr.
355+ utf8.encode ('OK\n OK\n ' ), // combined,
356+ pid: 0 , // pid.
357+ );
358+ } else {
359+ restatsResult = await processRunner.runProcess (
360+ < String > [restatsPath, '-color' , 'off' ],
361+ failOk: true ,
362+ );
363+ }
364+ if (restatsResult.exitCode != 0 ) {
365+ return null ;
366+ }
367+ // The second line of output has the stats.
368+ final List <String > lines = restatsResult.stdout.split ('\n ' );
369+ if (lines.length < 2 ) {
370+ return null ;
371+ }
372+ return lines[1 ];
373+ }
374+
334375 Future <bool > _bootstrapRbe (
335376 RunnerEventHandler eventHandler, {
336377 bool shutdown = false ,
@@ -382,11 +423,16 @@ final class BuildRunner extends Runner {
382423 failOk: true ,
383424 );
384425 }
426+ String okMessage = bootstrapResult.stdout.trim ();
427+ if (shutdown) {
428+ okMessage = await _reproxystatus () ?? okMessage;
429+ }
385430 eventHandler (RunnerResult (
386431 '${build .name }: RBE ${shutdown ? 'shutdown' : 'startup' }' ,
387432 bootstrapCommand,
388433 DateTime .now (),
389434 bootstrapResult,
435+ okMessage: okMessage,
390436 ));
391437 return bootstrapResult.exitCode == 0 ;
392438 }
0 commit comments