mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- 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).
80 lines
2.3 KiB
Python
80 lines
2.3 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 *
|
|
import git_util as git
|
|
import sys
|
|
|
|
|
|
def make_version_header(header):
|
|
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 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]))
|
|
|
|
return result
|
|
|
|
|
|
def write_version_header(output):
|
|
result = make_version_header(output)
|
|
return write_file_if_changed(output, result)
|
|
|
|
|
|
def main(argv):
|
|
if len(argv) < 2:
|
|
print(("Usage:\n %s <output_filename>" % argv[0]))
|
|
sys.exit(-1)
|
|
write_version_header(argv[1])
|
|
|
|
|
|
if '__main__' == __name__:
|
|
main(sys.argv)
|