From 1e3d251560435b9fa72893ad9cf960ae61da8fc1 Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Fri, 4 Oct 2024 14:59:37 -0700 Subject: [PATCH] Add --rbe-force-local flag to force rbe task execution to happen on the local machine (flutter/engine#55635) `build`, `test`, and `run` commands all support the `--exec-strategy` flag ('auto', 'local', 'remote'). This flag controls the RBE task execution strategy (when RBE is enabled). Closes #150877 --- .../engine_tool/lib/src/build_utils.dart | 17 ++++++++++++ .../lib/src/commands/build_command.dart | 7 ++--- .../engine_tool/lib/src/commands/command.dart | 26 +++++++++++++++++++ .../engine_tool/lib/src/commands/flags.dart | 4 +++ .../lib/src/commands/run_command.dart | 9 +++---- .../lib/src/commands/test_command.dart | 10 +++---- .../engine_tool/test/build_utils_test.dart | 25 ++++++++++++++++++ 7 files changed, 81 insertions(+), 17 deletions(-) create mode 100644 engine/src/flutter/tools/engine_tool/test/build_utils_test.dart diff --git a/engine/src/flutter/tools/engine_tool/lib/src/build_utils.dart b/engine/src/flutter/tools/engine_tool/lib/src/build_utils.dart index b2a3faebf9..5a64342824 100644 --- a/engine/src/flutter/tools/engine_tool/lib/src/build_utils.dart +++ b/engine/src/flutter/tools/engine_tool/lib/src/build_utils.dart @@ -7,6 +7,7 @@ import 'dart:io' as io; import 'package:engine_build_configs/engine_build_configs.dart'; import 'package:path/path.dart' as p; +import 'commands/flags.dart'; import 'environment.dart'; import 'label.dart'; import 'logger.dart'; @@ -119,6 +120,20 @@ String demangleConfigName(Environment env, String name) { return _doNotMangle(env, name) ? name : '${_osPrefix(env)}$name'; } +/// Make an RbeConfig. +RbeConfig makeRbeConfig(String execStrategy) { + switch (execStrategy) { + case buildStrategyFlagValueAuto: + return const RbeConfig(); + case buildStrategyFlagValueLocal: + return const RbeConfig(execStrategy: RbeExecStrategy.local); + case buildStrategyFlagValueRemote: + return const RbeConfig(execStrategy: RbeExecStrategy.remote); + default: + throw FatalError('Unknown RBE execution strategy "$execStrategy"'); + } +} + /// Build the build target in the environment. Future runBuild( Environment environment, @@ -127,6 +142,7 @@ Future runBuild( List extraGnArgs = const [], List