Remove ability to use_goma via autoninja.

Doesn't run a build if use_goma is true, point to reclient docs.  Turns
off use_goma for linux and mac builds.  Windows will follow in 2-3 weeks.

Bug: b/277197166
Change-Id: Icf000ee5e4bdfeba82cadbbf2e02e7cd728e89b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5272474
Reviewed-by: Ben Segall <bentekkie@google.com>
Reviewed-by: Ramy Medhat <abdelaal@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Michael Savigny <msavigny@google.com>
changes/74/5272474/6
Michael Savigny 1 year ago committed by LUCI CQ
parent f76550541c
commit 1592a89c9f

@ -332,6 +332,46 @@ def main(args):
use_goma = False
if use_goma:
# Display a warning that goma is being deprecated, every time a build
# is executed with 'use_goma.
# Further changes to encourage switching may follow.
if sys.platform.startswith("win"):
print(
"The gn arg use_goma=true will be removed on Feb 21st. "
"Please use `use_remoteexec=true` instead. See "
"https://chromium.googlesource.com/chromium/src/+/main/docs/"
"windows_build_instructions.md#use-reclient "
"for setup instructions.",
file=sys.stderr,
)
t = 5
while t > 0:
print(
f"The build will start in {t} seconds.",
file=sys.stderr,
)
time.sleep(1)
t = t - 1
elif sys.platform == "darwin":
print(
"The gn arg `use_goma=true` is no longer supported. "
"Please use `use_remoteexec=true` instead. "
"If you are a googler see http://go/building-chrome-mac"
"#using-remote-execution for setup instructions. ",
file=sys.stderr,
)
sys.exit(1)
else:
print(
"The gn arg `use_goma=true` is no longer supported. "
"Please use `use_remoteexec=true` instead. See "
"https://chromium.googlesource.com/chromium/src/+/main/docs/"
"linux/build_instructions.md#use-reclient for setup instructions.",
file=sys.stderr,
)
sys.exit(1)
gomacc_file = ("gomacc.exe"
if sys.platform.startswith("win") else "gomacc")
goma_dir = os.environ.get("GOMA_DIR",
@ -361,44 +401,7 @@ def main(args):
# script.
print("false")
sys.exit(1)
# Display a warning that goma is being deprecated, every time a build
# is executed with 'use_goma.
# Further changes to encourage switching may follow.
if sys.platform.startswith("win"):
print(
"The gn arg use_goma=true will be deprecated by EOY 2023. "
"Please use `use_remoteexec=true` instead. See "
"https://chromium.googlesource.com/chromium/src/+/main/docs/"
"windows_build_instructions.md#use-reclient "
"for setup instructions.",
file=sys.stderr,
)
elif sys.platform == "darwin":
print(
"The gn arg use_goma=true will be removed on Feb 7th 2024. "
"Please use `use_remoteexec=true` instead. "
"If you are a googler see http://go/building-chrome-mac"
"#using-remote-execution for setup instructions. ",
file=sys.stderr,
)
else:
print(
"The gn arg use_goma=true will be removed on Feb 7th 2024. "
"Please use `use_remoteexec=true` instead. See "
"https://chromium.googlesource.com/chromium/src/+/main/docs/"
"linux/build_instructions.md#use-reclient for setup instructions.",
file=sys.stderr,
)
if not sys.platform.startswith("win"):
# Artificial build delay is for linux/mac for now.
t = 5
while t > 0:
print(
f"The build will start in {t} seconds.",
file=sys.stderr,
)
time.sleep(1)
t = t - 1
# A large build (with or without goma) tends to hog all system resources.

@ -73,6 +73,55 @@ class AutoninjaTest(trial_dir.TestCase):
self.assertEqual(args[args.index('-C') + 1], out_dir)
self.assertIn('base', args)
@mock.patch('sys.platform', 'linux')
def test_autoninja_goma_not_supported_linux(self):
"""
Test that when specifying use_goma=true and on linux, the
message that goma is not supported is displayed.
"""
goma_dir = os.path.join(self.root_dir, 'goma_dir')
with mock.patch.dict(os.environ, {"GOMA_DIR": goma_dir}):
out_dir = os.path.join('out', 'dir')
write(os.path.join(out_dir, 'args.gn'), 'use_goma=true')
write(
os.path.join(
'goma_dir', 'gomacc.exe'
if sys.platform.startswith('win') else 'gomacc'), 'content')
with contextlib.redirect_stderr(io.StringIO()) as f:
with self.assertRaises(SystemExit):
self.assertEqual(
autoninja.main(['autoninja.py', '-C', out_dir]), 1)
self.maxDiff = None
print(f.getvalue())
self.assertIn(
"The gn arg `use_goma=true` is no longer supported.",
f.getvalue())
@mock.patch('sys.platform', 'darwin')
def test_autoninja_goma_not_supported_mac(self):
"""
Test that when specifying use_goma=true and on mac, the
message that goma is not supported is displayed.
"""
goma_dir = os.path.join(self.root_dir, 'goma_dir')
with mock.patch.dict(os.environ, {"GOMA_DIR": goma_dir}):
out_dir = os.path.join('out', 'dir')
write(os.path.join(out_dir, 'args.gn'), 'use_goma=true')
write(
os.path.join(
'goma_dir', 'gomacc.exe'
if sys.platform.startswith('win') else 'gomacc'), 'content')
with contextlib.redirect_stderr(io.StringIO()) as f:
with self.assertRaises(SystemExit):
self.assertEqual(
autoninja.main(['autoninja.py', '-C', out_dir]), 1)
self.maxDiff = None
print(f.getvalue())
self.assertIn(
"The gn arg `use_goma=true` is no longer supported.",
f.getvalue())
@mock.patch('sys.platform', 'win')
def test_autoninja_goma(self):
"""
Test that when specifying use_goma=true, autoninja verifies that Goma
@ -80,8 +129,8 @@ class AutoninjaTest(trial_dir.TestCase):
"""
goma_dir = os.path.join(self.root_dir, 'goma_dir')
with mock.patch('subprocess.call', return_value=0), \
mock.patch('ninja.main', return_value=0) as ninja_main, \
mock.patch.dict(os.environ, {"GOMA_DIR": goma_dir}):
mock.patch('ninja.main', return_value=0) as ninja_main, \
mock.patch.dict(os.environ, {"GOMA_DIR": goma_dir}):
out_dir = os.path.join('out', 'dir')
write(os.path.join(out_dir, 'args.gn'), 'use_goma=true')
write(

Loading…
Cancel
Save