mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add initial support for API versioning (see #3836)
- Generated files are now created when running cef_create_projects or the new version_manager.py tool. These files are still created in the cef/ source tree (same location as before) but Git ignores them due to the generated .gitignore file. - API hashes are committed to Git as a new cef_api_versions.json file. This file is used for both code generation and CEF version calculation (replacing the previous usage of cef_api_hash.h for this purpose). It will be updated by the CEF admin before merging breaking API changes upstream. - As an added benefit to the above, contributor PRs will no longer contain generated code that is susceptible to frequent merge conflicts. - From a code generation perspective, the main difference is that we now use versioned structs (e.g. cef_browser_0_t instead of cef_browser_t) on the libcef (dll/framework) side. Most of the make_*.py tool changes are related to supporting this. - From the client perspective, you can now define CEF_API_VERSION in the project configuration (or get CEF_EXPERIMENTAL by default). This define will change the API exposed in CEF’s include/ and include/capi header files. All client-side targets including libcef_dll_wrapper will need be recompiled when changing this define. - Examples of the new API-related define usage are provided in cef_api_version_test.h, api_version_test_impl.cc and api_version_unittest.cc. To test: - Run `ceftests --gtest_filter=ApiVersionTest.*` - Add `cef_api_version=13300` to GN_DEFINES. Re-run configure, build and ceftests steps. - Repeat with 13301, 13302, 13303 (all supported test versions).
This commit is contained in:
@ -10,22 +10,66 @@ import sys
|
||||
|
||||
# Script directory.
|
||||
script_dir = os.path.dirname(__file__)
|
||||
root_dir = os.path.join(script_dir, os.pardir)
|
||||
cef_dir = os.path.join(script_dir, os.pardir)
|
||||
src_dir = os.path.abspath(os.path.join(cef_dir, os.pardir))
|
||||
llvm_bin_dir = os.path.join(src_dir,
|
||||
'third_party/llvm-build/Release+Asserts/bin')
|
||||
|
||||
if sys.platform == 'win32':
|
||||
# Force use of the clang-format version bundled with depot_tools.
|
||||
clang_format_exe = 'clang-format.bat'
|
||||
clang_exe = os.path.join(llvm_bin_dir, 'clang-cl.exe')
|
||||
else:
|
||||
clang_format_exe = 'clang-format'
|
||||
clang_exe = os.path.join(llvm_bin_dir, 'clang')
|
||||
|
||||
|
||||
def clang_format(file_name, file_contents):
|
||||
# -assume-filename is necessary to find the .clang-format file and determine
|
||||
# the language when specifying contents via stdin.
|
||||
result = exec_cmd("%s -assume-filename=%s" % (clang_format_exe, file_name), \
|
||||
root_dir, file_contents.encode('utf-8'))
|
||||
cef_dir, file_contents.encode('utf-8'))
|
||||
if result['err'] != '':
|
||||
print("clang-format error: %s" % result['err'])
|
||||
sys.stderr.write("clang-format error: %s\n" % result['err'])
|
||||
if result['out'] != '':
|
||||
output = result['out']
|
||||
if sys.platform == 'win32':
|
||||
# Convert to Unix line endings.
|
||||
output = output.replace("\r", "")
|
||||
return output
|
||||
return None
|
||||
|
||||
|
||||
def clang_format_inplace(file_name):
|
||||
result = exec_cmd("%s -i %s" % (clang_format_exe, file_name), cef_dir)
|
||||
if result['err'] != '':
|
||||
sys.stderr.write("clang-format error: %s\n" % result['err'])
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def clang_eval(file_name,
|
||||
file_contents,
|
||||
defines=[],
|
||||
includes=[],
|
||||
as_cpp=True,
|
||||
verbose=False):
|
||||
lang = 'c++' if as_cpp else 'c'
|
||||
if file_name.lower().endswith('.h'):
|
||||
lang += '-header'
|
||||
# The -P option removes unnecessary line markers and whitespace.
|
||||
format = '/EP' if sys.platform == 'win32' else '-E -P'
|
||||
cmd = "%s -x %s %s %s %s -" % (clang_exe, lang, format,
|
||||
' '.join(['-D' + v for v in defines]),
|
||||
' '.join(['-I' + v for v in includes]))
|
||||
if verbose:
|
||||
print('--- Running "%s" in "%s"' % (cmd, cef_dir))
|
||||
|
||||
result = exec_cmd(cmd, cef_dir, file_contents.encode('utf-8'))
|
||||
if result['err'] != '':
|
||||
err = result['err'].replace('<stdin>', file_name)
|
||||
sys.stderr.write("clang error: %s\n" % err)
|
||||
return None
|
||||
if result['out'] != '':
|
||||
output = result['out']
|
||||
if sys.platform == 'win32':
|
||||
|
Reference in New Issue
Block a user