Source code

Revision control

Copy as Markdown

Other Tools

# Copyright 2024 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Defines the configuration of Remote Build Execution (RBE).
import("//chromium/build/toolchain/remoteexec_defaults.gni")
import("//chromium/build/toolchain/siso.gni")
declare_args() {
# Deprecated: Please use reclient_bin_dir instead.
rbe_bin_dir = ""
# Deprecated: Please use reclient_cfg_dir instead.
rbe_cfg_dir = ""
# Deprecated: Please use reclient_cros_cc_wrapper instead.
rbe_cros_cc_wrapper = ""
# Execution root - this should be the root of the source tree.
# This is defined here instead of in the config file because
# this will vary depending on where the user has placed the
# chromium source on their system.
rbe_exec_root = rebase_path("//")
# Set to true to enable remote executions.
use_remoteexec = false
}
use_reclient_default = false
if (use_remoteexec) {
if (use_siso) {
use_reclient_default = use_reclient_on_siso
} else {
use_reclient_default = use_reclient_on_ninja
}
}
declare_args() {
# Set to true to use re-client.
# Set to false to use Siso's builtin RBE client.
use_reclient = use_reclient_default
# The directory where the re-client tooling binaries are.
if (rbe_bin_dir != "") {
if (current_toolchain == default_toolchain) {
print(
"WARNING: rbe_bin_dir is deprecated. Please use reclient_bin_dir instead.")
}
reclient_bin_dir = rbe_bin_dir
} else {
reclient_bin_dir = rebase_path("//buildtools/reclient", root_build_dir)
}
# The directory where the re-client configuration files are.
if (rbe_cfg_dir != "") {
if (current_toolchain == default_toolchain) {
print(
"WARNING: rbe_cfg_dir is deprecated. Please use reclient_cfg_dir instead.")
}
reclient_cfg_dir = rbe_cfg_dir
} else {
reclient_cfg_dir = "//buildtools/reclient_cfgs"
}
}
# Check if any unsupported combination is specified.
if (use_reclient) {
assert(use_remoteexec, "Can't enable Reclient when use_remoteexec is false")
}
if (use_remoteexec) {
rbe_logs = [ "use_remoteexec=true" ]
} else {
rbe_logs = [ "use_remoteexec=false" ]
}
if (use_reclient) {
rbe_logs += [ "use_reclient=true" ]
} else {
rbe_logs += [ "use_reclient=false" ]
}
# Siso native also uses rewrapper cfg file
# to get remote platform property.
use_reclient_cfgs =
use_reclient || (use_remoteexec && (host_os == "win" || host_os == "mac"))
declare_args() {
# Set to the path of the RBE reclient configuration files.
# Configuration file selection based on operating system.
if (!use_reclient_cfgs) {
reclient_cc_cfg_file = ""
reclient_py_cfg_file = ""
} else if (use_reclient && host_os == "linux") {
reclient_py_cfg_file = rebase_path(reclient_cfg_dir, root_build_dir) +
"/python/rewrapper_linux.cfg"
reclient_cc_cfg_file = rebase_path(reclient_cfg_dir, root_build_dir) +
"/chromium-browser-clang/rewrapper_linux.cfg"
} else if (host_os == "win") {
reclient_py_cfg_file = rebase_path(reclient_cfg_dir, root_build_dir) +
"/python/rewrapper_windows.cfg"
reclient_cc_cfg_file = rebase_path(reclient_cfg_dir, root_build_dir) +
"/chromium-browser-clang/rewrapper_windows.cfg"
} else if (host_os == "mac") {
reclient_py_cfg_file = rebase_path(reclient_cfg_dir, root_build_dir) +
"/python/rewrapper_mac.cfg"
reclient_cc_cfg_file = rebase_path(reclient_cfg_dir, root_build_dir) +
"/chromium-browser-clang/rewrapper_mac.cfg"
} else {
reclient_cc_cfg_file = ""
reclient_py_cfg_file = ""
}
if (use_reclient) {
# TODO: crbug.com/342270134 - Rename reclient_cros_cc_wrapper to reclient_cros_cc_wrapper.
# Note that reclient_cros_cc_wrapper is referenced by CrOS's chromite.
# Set to the path of the RBE recleint wrapper for ChromeOS.
if (rbe_cros_cc_wrapper != "") {
if (current_toolchain == default_toolchain) {
print(
"WARNING: rbe_cros_cc_wrapper is deprecated. Please use reclient_cros_cc_wrapper instead.")
}
reclient_cros_cc_wrapper = rbe_cros_cc_wrapper
} else {
reclient_cros_cc_wrapper = "${reclient_bin_dir}/rewrapper"
}
} else {
reclient_cros_cc_wrapper = ""
}
}
if (use_reclient_cfgs && current_toolchain == default_toolchain) {
# Check existence of reclient configs and show user friendly error message if
# it doesn't.
if (!path_exists(reclient_cc_cfg_file)) {
# Use exec_script() to show a good error message.
exec_script(rebase_path("//chromium/build/toolchain/check_rewrapper_cfg.py"),
[ reclient_cc_cfg_file ],
"",
[ rebase_path(reclient_cc_cfg_file, ".", root_build_dir) ])
}
}