mirror of
https://github.com/aphrody-labs/cef.git
synced 2026-10-14 05:09:23 +00:00
Introduce a hash of Chromium sandbox interface files to detect incompatibilities between bootstrap.exe and libcef.dll at runtime, allowing the strict version check to be skipped when interfaces match. Core implementation: - Add sandbox_compat_hash.py to calculate SHA-256 of interface files (chrome_elf_main.h, sandbox.h, sandbox_types.h, sandbox.mojom) - Update make_version_header.py to generate CEF_SANDBOX_COMPAT_HASH - Add sandbox_compat_hash field to cef_version_info_t struct - Add entry 3 to cef_api_hash() for retrieving the hash - Compare hashes in cef_scoped_library_loader_win.cc during load Version management: - Include sandbox_compat in cef_api_versions.json and cef_api_untracked.json - Compare sandbox_compat for untracked versions (NEXT, EXPERIMENTAL) - Trigger version bumps when sandbox interface files change Build automation: - Update cefbuilds JSON builder to include sandbox_compat in version records - Run version_manager.py -a after Chromium updates on release branches to auto-detect hash changes and add new API versions
100 lines
3.0 KiB
Python
100 lines
3.0 KiB
Python
# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
|
# reserved. Use of this source code is governed by a BSD-style license that
|
|
# can be found in the LICENSE file.
|
|
|
|
from __future__ import absolute_import
|
|
from cef_parser import get_copyright
|
|
from cef_version import VersionFormatter
|
|
from date_util import *
|
|
from file_util import *
|
|
from sandbox_compat_hash import calculate_sandbox_compat_hash
|
|
import git_util as git
|
|
import sys
|
|
|
|
|
|
def make_version_header(header, sandbox_files=None):
|
|
result = get_copyright(full=True, translator=False) + \
|
|
"""//
|
|
// ---------------------------------------------------------------------------
|
|
//
|
|
// This file was generated by the make_version_header.py tool.
|
|
//
|
|
|
|
#ifndef CEF_INCLUDE_CEF_VERSION_H_
|
|
#define CEF_INCLUDE_CEF_VERSION_H_
|
|
|
|
#define CEF_VERSION "$VERSION$"
|
|
#define CEF_VERSION_MAJOR $VERSION_MAJOR$
|
|
#define CEF_VERSION_MINOR $VERSION_MINOR$
|
|
#define CEF_VERSION_PATCH $VERSION_PATCH$
|
|
#define CEF_COMMIT_NUMBER $COMMIT_NUMBER$
|
|
#define CEF_COMMIT_HASH "$COMMIT_HASH$"
|
|
#define COPYRIGHT_YEAR $YEAR$
|
|
|
|
#define CHROME_VERSION_MAJOR $CHROME_MAJOR$
|
|
#define CHROME_VERSION_MINOR $CHROME_MINOR$
|
|
#define CHROME_VERSION_BUILD $CHROME_BUILD$
|
|
#define CHROME_VERSION_PATCH $CHROME_PATCH$
|
|
|
|
#define CEF_SANDBOX_COMPAT_HASH "$SANDBOX_COMPAT_HASH$"
|
|
|
|
#define DO_MAKE_STRING(p) #p
|
|
#define MAKE_STRING(p) DO_MAKE_STRING(p)
|
|
|
|
#endif // CEF_INCLUDE_CEF_VERSION_H_
|
|
"""
|
|
|
|
formatter = VersionFormatter()
|
|
|
|
# Substitute hash values for placeholders.
|
|
result = result.replace('$YEAR$', get_year())
|
|
result = result.replace('$VERSION$', formatter.get_version_string())
|
|
|
|
commit_components = formatter.get_cef_commit_components()
|
|
for key in ('HASH', 'NUMBER'):
|
|
result = result.replace('$COMMIT_%s$' % key, str(commit_components[key]))
|
|
|
|
version_parts = formatter.get_version_parts()
|
|
for key in ('MAJOR', 'MINOR', 'PATCH'):
|
|
result = result.replace('$VERSION_%s$' % key, str(version_parts[key]))
|
|
|
|
chrome_version_components = formatter.get_chrome_version_components()
|
|
for key in ('MAJOR', 'MINOR', 'BUILD', 'PATCH'):
|
|
result = result.replace('$CHROME_%s$' % key,
|
|
str(chrome_version_components[key]))
|
|
|
|
# Calculate sandbox compat hash (Windows only, empty on other platforms)
|
|
if sandbox_files:
|
|
sandbox_hash = calculate_sandbox_compat_hash(sandbox_files)
|
|
else:
|
|
sandbox_hash = ""
|
|
result = result.replace('$SANDBOX_COMPAT_HASH$', sandbox_hash)
|
|
|
|
return result
|
|
|
|
|
|
def write_version_header(output, sandbox_files=None):
|
|
result = make_version_header(output, sandbox_files)
|
|
return write_file_if_changed(output, result)
|
|
|
|
|
|
def main(argv):
|
|
if len(argv) < 2:
|
|
print((
|
|
"Usage:\n %s <output_filename> [--sandbox-files file1 ...]" % argv[0]))
|
|
sys.exit(-1)
|
|
|
|
output = argv[1]
|
|
sandbox_files = []
|
|
|
|
# Check for --sandbox-files flag
|
|
if '--sandbox-files' in argv:
|
|
idx = argv.index('--sandbox-files')
|
|
sandbox_files = argv[idx + 1:]
|
|
|
|
write_version_header(output, sandbox_files)
|
|
|
|
|
|
if '__main__' == __name__:
|
|
main(sys.argv)
|