win: Add bootstrap[c].exe for sandbox integration (see #3824)

Replace cef_sandbox.lib usage with bootstrap executables.
See the SandboxSetup Wiki page for details.
This commit is contained in:
Marshall Greenblatt
2025-05-08 18:33:07 -04:00
parent 7581264dbb
commit adcac2c37c
28 changed files with 1116 additions and 447 deletions

View File

@ -16,13 +16,11 @@ import sys
import tempfile
import zipfile
is_python2 = sys.version_info.major == 2
if sys.version_info.major != 3:
sys.stderr.write('Python3 is required!')
sys.exit(1)
if is_python2:
from urllib import FancyURLopener
from urllib2 import urlopen
else:
from urllib.request import FancyURLopener, urlopen
from urllib.request import FancyURLopener, urlopen
##
# Default URLs.
@ -218,19 +216,12 @@ def read_file(path):
raise Exception("Path does not exist: %s" % (path))
def write_fp(fp, data):
if is_python2:
fp.write(data.decode('utf-8'))
else:
fp.write(data)
def write_file(path, data):
""" Write a file. """
msg('Writing %s' % path)
if not options.dryrun:
with open(path, 'w', encoding='utf-8') as fp:
write_fp(fp, data)
fp.write(data)
def read_config_file(path):
@ -446,21 +437,20 @@ def check_pattern_matches(output_file=None):
if not skip:
if write_msg:
if has_output:
write_fp(fp, '\n')
write_fp(fp,
'!!!! WARNING: FOUND PATTERN: %s\n' % entry['pattern'])
fp.write('\n')
fp.write('!!!! WARNING: FOUND PATTERN: %s\n' % entry['pattern'])
if 'message' in entry:
write_fp(fp, entry['message'] + '\n')
write_fp(fp, '\n')
fp.write(entry['message'] + '\n')
fp.write('\n')
write_msg = False
write_fp(fp, line + '\n')
fp.write(line + '\n')
has_output = True
if not output_file is None:
if has_output:
msg('ERROR Matches found. See %s for output.' % out_file)
else:
write_fp(fp, 'Good news! No matches.\n')
fp.write('Good news! No matches.\n')
fp.close()
if has_output:
@ -901,27 +891,13 @@ if not branch_is_master:
sys.exit(1)
# Verify the minimum supported branch number.
if int(cef_branch) < 3071:
if int(cef_branch) < 5060:
print('The requested branch (%s) is too old to build using this tool. ' +
'The minimum supported branch is 3071.' % cef_branch)
sys.exit(1)
# True if the requested branch is 3538 or newer.
branch_is_3538_or_newer = (branch_is_master or int(cef_branch) >= 3538)
# True if the requested branch is 3945 or newer.
branch_is_3945_or_newer = (branch_is_master or int(cef_branch) >= 3945)
# Enable Python 3 usage in Chromium for branches 3945 and newer.
if branch_is_3945_or_newer and not is_python2 and \
not 'GCLIENT_PY3' in os.environ.keys():
os.environ['GCLIENT_PY3'] = '1'
if not branch_is_3945_or_newer and \
(not is_python2 or bool(int(os.environ.get('GCLIENT_PY3', '0')))):
print('Python 3 is not supported with branch 3904 and older ' +
'(set GCLIENT_PY3=0 and run with Python 2 executable).')
sys.exit(1)
# True if the requested branch is 7151 or older.
branch_is_7151_or_older = not branch_is_master and int(cef_branch) <= 7151
if options.armbuild:
if platform != 'linux':
@ -936,9 +912,9 @@ if platform == 'mac' and not (options.x64build or options.arm64build):
sys.exit(1)
# Platforms that build a cef_sandbox library.
sandbox_lib_platforms = ['windows']
if branch_is_3538_or_newer:
sandbox_lib_platforms.append('mac')
sandbox_lib_platforms = ['mac']
if branch_is_7151_or_older:
sandbox_lib_platforms.append('win')
if not platform in sandbox_lib_platforms and (options.sandboxdistrib or
options.sandboxdistribonly):
@ -1023,7 +999,7 @@ if platform == 'windows':
# Force use of the system installed Git version.
git_exe = 'git.exe'
# Force use of the Python version bundled with depot_tools.
python_bat = 'python.bat' if is_python2 else 'python3.bat'
python_bat = 'python3.bat'
python_exe = os.path.join(depot_tools_dir, python_bat)
if options.dryrun and not os.path.exists(python_exe):
sys.stdout.write("WARNING: --dry-run assumes that depot_tools" \
@ -1180,7 +1156,7 @@ if not os.path.exists(gclient_file) or options.forceconfig:
msg('Writing %s' % gclient_file)
if not options.dryrun:
with open(gclient_file, 'w', encoding='utf-8') as fp:
write_fp(fp, gclient_spec)
fp.write(gclient_spec)
# Initial Chromium checkout.
if not options.nochromiumupdate and not os.path.exists(chromium_src_dir):
@ -1366,6 +1342,8 @@ if not options.nobuild and (chromium_checkout_changed or \
target += ' ' + options.testtarget
if platform == 'linux':
target += ' chrome_sandbox'
if platform == 'windows' and not branch_is_7151_or_older:
target += ' bootstrap bootstrapc'
# Make a CEF Debug build.
if not options.nodebugbuild: