[infra] Remove Goma support.

Bug: b/296994239
Change-Id: Ic96571d2c16d7c252cb41673e8bdb16cdb4de754
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360507
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
This commit is contained in:
Jonas Termansen 2024-04-02 22:54:19 +00:00 committed by Commit Queue
parent c490c4bd4c
commit e445389862
11 changed files with 21 additions and 137 deletions

View file

@ -2,13 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("../../toolchain/goma.gni")
_toolchain_cpu = host_cpu
if (host_os == "mac" && use_goma) {
# Goma does not support ARM64.
_toolchain_cpu = "x64"
}
default_clang_prefix =
rebase_path("//buildtools/${host_os}-${_toolchain_cpu}/clang/bin",

View file

@ -921,12 +921,7 @@ config("optimize_speed") {
config("symbols") {
if (is_win) {
import("//build/toolchain/goma.gni")
if (use_goma) {
cflags = [ "/Z7" ] # No PDB file
} else {
cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
}
cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
ldflags = [ "/DEBUG" ]
} else {
cflags = [

View file

@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
declare_args() {
@ -18,7 +17,7 @@ declare_args() {
# mac_sdk_min is used.
mac_sdk_path = ""
mac_enable_relative_sdk_path = use_rbe || use_goma
mac_enable_relative_sdk_path = use_rbe
}
find_sdk_args = [
@ -26,7 +25,7 @@ find_sdk_args = [
mac_sdk_min,
]
if (use_rbe || use_goma) {
if (use_rbe) {
find_sdk_args += [
"--create_symlink_at",

View file

@ -5,7 +5,6 @@
import("//build/config/sysroot.gni") # Imports android/config.gni.
import("//build/toolchain/ccache.gni")
import("//build/toolchain/gcc_toolchain.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
# The Android GCC toolchains share most of the same parameters, so we have this
@ -20,12 +19,7 @@ import("//build/toolchain/rbe.gni")
# Same as gcc_toolchain
template("android_toolchain") {
gcc_toolchain(target_name) {
if (use_goma) {
assert(!use_ccache, "Goma and ccache can't be used together.")
assembler_prefix = "$goma_dir/gomacc "
compiler_prefix = "$goma_dir/gomacc "
link_prefix = "$goma_dir/gomacc "
} else if (use_rbe) {
if (use_rbe) {
compiler_args =
rewrapper_args + [ "--labels=type=compile,compiler=clang,lang=cpp" ]

View file

@ -5,15 +5,9 @@
import("//build/config/sysroot.gni")
import("//build/toolchain/ccache.gni")
import("//build/toolchain/gcc_toolchain.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
if (use_goma) {
assert(!use_ccache, "Goma and ccache can't be used together.")
assembler_prefix = "$goma_dir/gomacc "
compiler_prefix = "$goma_dir/gomacc "
link_prefix = "$goma_dir/gomacc "
} else if (use_ccache) {
if (use_ccache) {
assembler_prefix = "ccache "
compiler_prefix = "ccache "
link_prefix = "ccache "

View file

@ -1,22 +0,0 @@
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Defines the configuration of Goma.
#
# This is currently designed to match the GYP build exactly, so as not to break
# people during the transition.
declare_args() {
# Set to true to enable distributed compilation using Goma.
use_goma = false
# Set the default value based on the platform.
if (is_win) {
# Absolute directory containing the Goma source code.
goma_dir = "C:\goma\goma-win"
} else {
# Absolute directory containing the Goma source code.
goma_dir = getenv("HOME") + "/goma"
}
}

View file

@ -5,7 +5,6 @@
import("//build/config/sysroot.gni")
import("//build/toolchain/ccache.gni")
import("//build/toolchain/gcc_toolchain.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
declare_args() {
@ -17,13 +16,7 @@ declare_args() {
riscv64_toolchain_prefix = ""
}
if (use_goma) {
assert(!use_ccache, "Goma and ccache can't be used together.")
assembler_prefix = "$goma_dir/gomacc "
compiler_prefix = "$goma_dir/gomacc "
link_prefix = "$goma_dir/gomacc "
gcc_compiler_prefix = compiler_prefix
} else if (use_rbe) {
if (use_rbe) {
compiler_args =
rewrapper_args + [ "--labels=type=compile,compiler=clang,lang=cpp" ]

View file

@ -7,20 +7,14 @@
# Linux.
import("//build/config/mac/mac_sdk.gni")
import("../goma.gni")
assert(host_os == "mac")
import("//build/config/sysroot.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
import("//build/toolchain/signing.gni")
if (use_goma) {
assembler_prefix = "$goma_dir/gomacc "
compiler_prefix = "$goma_dir/gomacc "
link_prefix = "$goma_dir/gomacc "
} else if (use_rbe) {
if (use_rbe) {
compiler_args =
rewrapper_args + [ "--labels=type=compile,compiler=clang,lang=cpp" ]
if (rbe_os != host_os || rbe_cpu != host_cpu) {
@ -38,8 +32,7 @@ if (use_goma) {
link_prefix = ""
}
# Goma doesn't support the host-arm64 toolchain, so continue using Rosetta.
if (host_cpu == "arm64" && !use_goma) {
if (host_cpu == "arm64") {
rebased_clang_dir =
rebase_path("//buildtools/mac-arm64/clang/bin", root_build_dir)
} else {

View file

@ -8,7 +8,6 @@ declare_args() {
}
import("//build/config/win/visual_studio_version.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
# Should only be running on Windows.
@ -25,9 +24,7 @@ tool_wrapper_path = rebase_path("tool_wrapper.py", root_build_dir)
ninja_path = rebase_path("//buildtools/ninja/ninja")
if (use_goma) {
compiler_prefix = "$goma_dir/gomacc.exe "
} else if (use_rbe) {
if (use_rbe) {
compiler_args =
rewrapper_args + [ "--labels=type=compile,compiler=clang-cl,lang=cpp" ]
if (rbe_os != host_os || rbe_cpu != host_cpu) {

View file

@ -43,17 +43,12 @@ def BuildOptions():
other_group.add_argument("-j",
type=int,
help='Ninja -j option for Goma/RBE builds.',
help='Ninja -j option for RBE builds.',
default=200 if sys.platform == 'win32' else 1000)
other_group.add_argument("-l",
type=int,
help='Ninja -l option for Goma/RBE builds.',
help='Ninja -l option for RBE builds.',
default=64)
other_group.add_argument("--no-start-goma",
help="Don't try to start goma",
default=False,
dest='no_start_rbe',
action='store_true')
other_group.add_argument("--no-start-rbe",
help="Don't try to start rbe",
default=False,
@ -124,10 +119,6 @@ def NotifyBuildDone(build_config, success, start):
# Ignore return code, if this command fails, it doesn't matter.
os.system(command)
def UseGoma(out_dir):
args_gn = os.path.join(out_dir, 'args.gn')
return 'use_goma = true' in open(args_gn, 'r').read()
def UseRBE(out_dir):
args_gn = os.path.join(out_dir, 'args.gn')
@ -136,23 +127,20 @@ def UseRBE(out_dir):
# Try to start RBE, but don't bail out if we can't. Instead print an error
# message, and let the build fail with its own error messages as well.
rbe_started = None
rbe_started = False
bootstrap_path = None
def StartRBE(out_dir, use_goma, env):
def StartRBE(out_dir, env):
global rbe_started, bootstrap_path
rbe = 'goma' if use_goma else 'rbe'
rbe = 'rbe'
if rbe_started:
if rbe_started != rbe:
print(f'Cannot mix RBE and Goma')
return False
return True
args_gn_path = os.path.join(out_dir, 'args.gn')
rbe_dir = None if use_goma else 'buildtools/reclient'
rbe_dir = 'buildtools/reclient'
with open(args_gn_path, 'r') as fp:
for line in fp:
if ('goma_dir' if use_goma else 'rbe_dir') in line:
if 'rbe_dir' in line:
words = line.split()
rbe_dir = words[2][1:-1] # rbe_dir = "/path/to/rbe"
if not rbe_dir:
@ -161,23 +149,21 @@ def StartRBE(out_dir, use_goma, env):
if not os.path.exists(rbe_dir) or not os.path.isdir(rbe_dir):
print(f'Could not find {rbe} at {rbe_dir}')
return False
bootstrap = 'goma_ctl.py' if use_goma else 'bootstrap'
bootstrap = 'bootstrap'
bootstrap_path = os.path.join(rbe_dir, bootstrap)
bootstrap_command = [bootstrap_path]
if use_goma:
bootstrap_command = ['python3', bootstrap_path, 'ensure_start']
process = subprocess.Popen(bootstrap_command, env=env)
process.wait()
if process.returncode != 0:
print(f"Failed to start {rbe}")
return False
rbe_started = rbe
rbe_started = True
return True
def StopRBE(env):
global rbe_started, bootstrap_path
if rbe_started != 'rbe':
if not rbe_started:
return
bootstrap_command = [bootstrap_path, '--shutdown']
process = subprocess.Popen(bootstrap_command, env=env)
@ -192,10 +178,8 @@ def BuildOneConfig(options, targets, target_os, mode, arch, sanitizer, env):
command = ['buildtools/ninja/ninja', '-C', out_dir]
if options.verbose:
command += ['-v']
use_rbe = UseRBE(out_dir)
use_goma = UseGoma(out_dir)
if use_rbe or use_goma:
if options.no_start_rbe or StartRBE(out_dir, use_goma, env):
if UseRBE(out_dir):
if options.no_start_rbe or StartRBE(out_dir, env):
using_rbe = True
command += [('-j%s' % str(options.j))]
command += [('-l%s' % str(options.l))]

View file

@ -292,32 +292,6 @@ def ToGnArgs(args, mode, arch, target_os, sanitizer, verify_sdk_hash,
if prefix != None:
gn_args[arch + '_toolchain_prefix'] = prefix
goma_dir = os.environ.get('GOMA_DIR')
# Search for goma in depot_tools in path
goma_depot_tools_dir = None
for path in os.environ.get('PATH', '').split(os.pathsep):
if os.path.basename(path) == 'depot_tools':
cipd_bin = os.path.join(path, '.cipd_bin')
if os.path.isfile(os.path.join(cipd_bin, ExecutableName('gomacc'))):
goma_depot_tools_dir = cipd_bin
break
# Otherwise use goma from home directory.
# TODO(whesse): Remove support for goma installed in home directory.
# Goma will only be distributed through depot_tools.
goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma')
if args.goma and goma_dir:
gn_args['use_goma'] = True
gn_args['goma_dir'] = goma_dir
elif args.goma and goma_depot_tools_dir:
gn_args['use_goma'] = True
gn_args['goma_dir'] = goma_depot_tools_dir
elif args.goma and os.path.exists(goma_home_dir):
gn_args['use_goma'] = True
gn_args['goma_dir'] = goma_home_dir
else:
gn_args['use_goma'] = False
gn_args['goma_dir'] = None
gn_args['use_rbe'] = args.rbe
# Code coverage requires -O0 to be set.
@ -344,9 +318,6 @@ def ProcessOsOption(os_name):
def ProcessOptions(args):
if args.goma:
print('Warning: Goma will be discontinued in the near future')
args.rbe = False
if args.verify_sdk_hash == None:
args.verify_sdk_hash = not args.rbe
if args.git_version == None:
@ -422,8 +393,6 @@ def ProcessOptions(args):
(socket.getfqdn().endswith('.corp.google.com') or
socket.getfqdn().endswith('.c.googlers.com')):
print('You can speed up your build by following: go/dart-rbe')
if not args.goma:
print('Goma is no longer enabled by default since RBE is ready.')
old_rbe_cfg = 'win-intel.cfg' if HOST_OS == 'win32' else 'linux-intel.cfg'
new_rbe_cfg = 'windows.cfg' if HOST_OS == 'win32' else 'unix.cfg'
if os.environ.get('RBE_cfg') == os.path.join(os.getcwd(), 'build', 'rbe',
@ -450,12 +419,6 @@ def ide_switch(host_os):
def AddCommonGnOptionArgs(parser):
"""Adds arguments that will change the default GN arguments."""
parser.add_argument('--goma', help='Use goma', action='store_true')
parser.add_argument('--no-goma',
help='Disable goma',
dest='goma',
action='store_false')
parser.add_argument('--rbe', help='Use rbe', action='store_true')
parser.add_argument('--no-rbe',
help='Disable rbe',