-DOWNLOAD_PGO_PROFILES="False"
-
-# Adapted from CEF's tools/gclient_hooks.py
-python do_gclient_config() {
- import os
- # Create gclient configuration file.
- gclient_file = os.path.join(d.expand('${BASE_DIR}'), '.gclient')
- # Exclude unnecessary directories. Intentionally written without newlines.
- gclient_spec = \
- "solutions = [{"+\
- "'managed': False,"+\
- "'name': 'src', "+\
- "'url': '" + d.expand('https://${CHROMIUM_URL}') + "', "+\
- "'custom_vars': {"+\
- d.expand("'checkout_pgo_profiles': '${DOWNLOAD_PGO_PROFILES}'") +\
- "}, "+\
- "'custom_deps': {"+\
- "'build': None, "+\
- "'build/scripts/command_wrapper/bin': None, "+\
- "'build/scripts/gsd_generate_index': None, "+\
- "'build/scripts/private/data/reliability': None, "+\
- "'build/scripts/tools/deps2git': None, "+\
- "'build/third_party/lighttpd': None, "+\
- "'commit-queue': None, "+\
- "'depot_tools': None, "+\
- "'src/chrome_frame/tools/test/reference_build/chrome': None, "+\
- "'src/chrome/tools/test/reference_build/chrome_linux': None, "+\
- "'src/chrome/tools/test/reference_build/chrome_mac': None, "+\
- "'src/chrome/tools/test/reference_build/chrome_win': None, "+\
- "}, "+\
- "'deps_file': 'DEPS', "+\
- "'safesync_url': ''"+\
- "}]"
-
- with open(gclient_file, 'w+', encoding='utf-8') as fp:
- fp.write(gclient_spec)
-}
-addtask do_gclient_config after do_unpack before do_configure
-
-# Mostly adapted from CEF's tools/automate/automate-git.py
-do_sync[network] = "1"
-python do_sync() {
- import os
- def cef_run(command_line, working_dir):
- import subprocess
- env = os.environ
- env['PATH'] = d.expand("${DEPOT_TOOLS_DIR}") + os.pathsep + env['PATH']
- env['DEPOT_TOOLS_UPDATE'] = "0"
- env['GCLIENT_PY3'] = "1"
-
- subprocess.check_output(command_line.split(),
- cwd=working_dir,
- env=env,
- shell=False,
- stderr=subprocess.STDOUT)
-
- def cef_apply_patch(name, patches_path=os.path.join(d.expand("${CEF_DIR}"), 'patch', 'patches')):
- patch_file = os.path.join(patches_path, name)
- if not os.path.exists(patch_file + ".patch"):
- # Attempt to apply the patch file.
- patch_tool = os.path.join(d.expand("${CEF_DIR}"), 'tools', 'patcher.py')
- cef_run('%s %s --patch-file "%s" --patch-dir "%s"' %
- ("python3", patch_tool, patch_file, d.expand("${CHROMIUM_DIR}")),
- d.expand("${CHROMIUM_DIR}"))
-
- def cef_apply_deps_patch():
- """ Patch the Chromium DEPS file before `gclient sync` if necessary. """
- deps_path = os.path.join(d.expand("${CHROMIUM_DIR}"), 'DEPS')
- if os.path.isfile(deps_path):
- cef_apply_patch('DEPS')
- else:
- raise Exception("Path does not exist: DEPS")
-
- def cef_apply_runhooks_patch():
- """ Patch the Chromium runhooks files before `gclient runhooks` if necessary. """
- cef_apply_patch('runhooks')
-
- # CEF automation script usually applies
- # applies patches before running sync and
- # runhooks. This is taken directly from the
- # automation script
- def cef_do_sync():
- cef_apply_deps_patch()
- cef_run("gclient sync --reset --nohooks --jobs 16", d.expand("${CHROMIUM_DIR}"))
- cef_apply_runhooks_patch()
- cef_run("gclient runhooks --jobs 16", d.expand("${CHROMIUM_DIR}"))
-
- cef_do_sync()
-}
-addtask do_sync after do_gclient_config before do_configure