mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add CEF API hash and version info retrieval functions (issue #914).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1160 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
from date_util import *
|
||||
from file_util import *
|
||||
from optparse import OptionParser
|
||||
from cef_api_hash import cef_api_hash
|
||||
import svn_util as svn
|
||||
import git_util as git
|
||||
import sys
|
||||
@ -27,17 +28,19 @@ parser.add_option('--cef_version', dest='cef_version', metavar='FILE',
|
||||
help='input CEF version config file [required]')
|
||||
parser.add_option('--chrome_version', dest='chrome_version', metavar='FILE',
|
||||
help='input Chrome version config file [required]')
|
||||
parser.add_option('--cpp_header_dir', dest='cpp_header_dir', metavar='DIR',
|
||||
help='input directory for C++ header files [required]')
|
||||
parser.add_option('-q', '--quiet',
|
||||
action='store_true', dest='quiet', default=False,
|
||||
help='do not output detailed status information')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# the header option is required
|
||||
if options.header is None or options.cef_version is None or options.chrome_version is None:
|
||||
if options.header is None or options.cef_version is None or options.chrome_version is None or options.cpp_header_dir is None:
|
||||
parser.print_help(sys.stdout)
|
||||
sys.exit()
|
||||
|
||||
def write_svn_header(header, chrome_version, cef_version):
|
||||
def write_svn_header(header, chrome_version, cef_version, cpp_header_dir):
|
||||
""" Creates the header file for the current revision and Chrome version information
|
||||
if the information has changed or if the file doesn't already exist. """
|
||||
|
||||
@ -62,6 +65,10 @@ def write_svn_header(header, chrome_version, cef_version):
|
||||
except:
|
||||
revision = git.get_svn_revision()
|
||||
|
||||
# calculate api hashes
|
||||
api_hash_calculator = cef_api_hash(cpp_header_dir, verbose = False)
|
||||
api_hashes = api_hash_calculator.calculate()
|
||||
|
||||
newcontents = '// Copyright (c) '+year+' Marshall A. Greenblatt. All rights reserved.\n'+\
|
||||
'//\n'+\
|
||||
'// Redistribution and use in source and binary forms, with or without\n'+\
|
||||
@ -111,10 +118,43 @@ def write_svn_header(header, chrome_version, cef_version):
|
||||
'extern "C" {\n'+\
|
||||
'#endif\n\n'+\
|
||||
'#include "internal/cef_export.h"\n\n'+\
|
||||
'// The API hash is created by analyzing CEF header files for C API type\n'+\
|
||||
'// definitions. The hash value will change when header files are modified\n'+\
|
||||
'// in a way that may cause binary incompatibility with other builds. The\n'+\
|
||||
'// universal hash value will change if any platform is affected whereas the\n'+\
|
||||
'// platform hash values will change only if that particular platform is\n'+\
|
||||
'// affected.\n'+\
|
||||
'#define CEF_API_HASH_UNIVERSAL "' + api_hashes['universal'] + '"\n'+\
|
||||
'#if defined(OS_WIN)\n'+\
|
||||
'#define CEF_API_HASH_PLATFORM "' + api_hashes['windows'] + '"\n'+\
|
||||
'#elif defined(OS_MACOSX)\n'+\
|
||||
'#define CEF_API_HASH_PLATFORM "' + api_hashes['macosx'] + '"\n'+\
|
||||
'#elif defined(OS_LINUX)\n'+\
|
||||
'#define CEF_API_HASH_PLATFORM "' + api_hashes['linux'] + '"\n'+\
|
||||
'#endif\n\n'+\
|
||||
'///\n'+\
|
||||
'// Returns the CEF build revision of the libcef library.\n'+\
|
||||
'// Returns the CEF build revision for the libcef library.\n'+\
|
||||
'///\n'+\
|
||||
'CEF_EXPORT int cef_build_revision();\n\n'+\
|
||||
'///\n'+\
|
||||
'// Returns CEF version information for the libcef library. The |entry|\n'+\
|
||||
'// parameter describes which version component will be returned:\n'+\
|
||||
'// 0 - CEF_VERSION_MAJOR\n'+\
|
||||
'// 1 - CEF_REVISION\n'+\
|
||||
'// 2 - CHROME_VERSION_MAJOR\n'+\
|
||||
'// 3 - CHROME_VERSION_MINOR\n'+\
|
||||
'// 4 - CHROME_VERSION_BUILD\n'+\
|
||||
'// 5 - CHROME_VERSION_PATCH\n'+\
|
||||
'///\n'+\
|
||||
'CEF_EXPORT int cef_version_info(int entry);\n\n'+\
|
||||
'///\n'+\
|
||||
'// Returns CEF API hashes for the libcef library. The returned string is owned\n'+\
|
||||
'// by the library and should not be freed. The |entry| parameter describes which\n'+\
|
||||
'// hash value will be returned:\n'+\
|
||||
'// 0 - CEF_API_HASH_PLATFORM\n'+\
|
||||
'// 1 - CEF_API_HASH_UNIVERSAL\n'+\
|
||||
'///\n'+\
|
||||
'CEF_EXPORT const char* cef_api_hash(int entry);\n\n'+\
|
||||
'#ifdef __cplusplus\n'+\
|
||||
'}\n'+\
|
||||
'#endif\n\n'+\
|
||||
@ -126,7 +166,7 @@ def write_svn_header(header, chrome_version, cef_version):
|
||||
|
||||
return False
|
||||
|
||||
written = write_svn_header(options.header, options.chrome_version, options.cef_version)
|
||||
written = write_svn_header(options.header, options.chrome_version, options.cef_version, options.cpp_header_dir)
|
||||
if not options.quiet:
|
||||
if written:
|
||||
sys.stdout.write('File '+options.header+' updated.\n')
|
||||
|
Reference in New Issue
Block a user