forked from firka/flutter
Download and use the goma client from cipd (flutter/engine#41488)
In https://github.com/flutter/flutter/issues/125361 we discovered that a new version of clang can require updating goma in order for goma to work properly. This PR adds a dependency on CIPD goma to the DEPS file so that we can update it for use in local builds when needed. Since CI does its own management of the goma client and the compiler proxy, and since goma can only be used by Googlers, the DEPS file download is guarded behind the `use_cipd_goma` gclient var. To use it one would update the engine `.gclient` file to be something like: ``` ~/flutter/engine/src $ cat ../.gclient solutions = [ { "managed": False, "name": "src/flutter", "url": "git@github.com:zanderso/engine.git", "custom_deps": {}, "custom_vars": { "use_cipd_goma": True, }, "deps_file": "DEPS", "safesync_url": "", }, ] ``` I'll update the wiki with these instructions after this PR lands.
This commit is contained in:
@@ -199,12 +199,32 @@ def get_target_cpu(args):
|
||||
return 'x64'
|
||||
|
||||
|
||||
def buildtools_dir():
|
||||
host_os = get_host_os()
|
||||
host_cpu = get_host_cpu()
|
||||
if host_os == 'win':
|
||||
host_os = 'windows'
|
||||
if host_os == 'mac' and host_cpu == 'arm64':
|
||||
host_cpu = 'x64'
|
||||
return '%s-%s' % (host_os, host_cpu)
|
||||
|
||||
|
||||
def setup_goma(args):
|
||||
goma_gn_args = {}
|
||||
|
||||
goma_dir = os.environ.get('GOMA_DIR')
|
||||
goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma')
|
||||
# When running in CI, the recipes use their own goma install, and take
|
||||
# care of starting and stopping the compiler proxy.
|
||||
running_on_luci = os.environ.get('LUCI_CONTEXT') is not None
|
||||
|
||||
# Prefer the goma fetched by gclient if it exists.
|
||||
cipd_goma_dir = os.path.join(SRC_ROOT, 'buildtools', buildtools_dir(), 'goma')
|
||||
|
||||
# Next, if GOMA_DIR is set, use that install.
|
||||
goma_dir = os.environ.get('GOMA_DIR')
|
||||
|
||||
# Finally, look for goma in the install location recommended in our
|
||||
# documentation.
|
||||
goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma')
|
||||
# GOMA has a different default (home) path on gWindows.
|
||||
if not os.path.exists(goma_home_dir) and sys.platform.startswith(
|
||||
('cygwin', 'win')):
|
||||
@@ -214,6 +234,9 @@ def setup_goma(args):
|
||||
goma_gn_args['use_goma'] = False
|
||||
goma_gn_args['goma_dir'] = None
|
||||
print('Disabling GOMA for wasm builds, it is not supported yet.')
|
||||
elif args.goma and not running_on_luci and os.path.exists(cipd_goma_dir):
|
||||
goma_gn_args['use_goma'] = True
|
||||
goma_gn_args['goma_dir'] = cipd_goma_dir
|
||||
elif args.goma and goma_dir and os.path.exists(goma_dir):
|
||||
goma_gn_args['use_goma'] = True
|
||||
goma_gn_args['goma_dir'] = goma_dir
|
||||
@@ -233,7 +256,7 @@ def setup_goma(args):
|
||||
goma_gn_args['goma_dir'] = None
|
||||
|
||||
if goma_gn_args['use_goma'] and sys.platform == 'darwin':
|
||||
if (os.environ.get('LUCI_CONTEXT') is None or args.xcode_symlinks or
|
||||
if (not running_on_luci or args.xcode_symlinks or
|
||||
os.getenv('FLUTTER_GOMA_CREATE_XCODE_SYMLINKS', '0') == '1'):
|
||||
goma_gn_args['create_xcode_symlinks'] = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user