Set the product version string using make_version_header.py and the chrome/VERSION file (issue #383).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@323 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-10-18 17:56:10 +00:00
parent 719886c232
commit 6dee882cf2
6 changed files with 47 additions and 21 deletions

View File

@ -1,3 +1,2 @@
@echo off
CALL tools\make_version_header.bat
..\third_party\python_26\python.exe tools\gclient_hook.py

View File

@ -7,6 +7,7 @@
#include "browser_webkit_glue.h"
#include "browser_webkit_init.h"
#include "cef_context.h"
#include "../version.h"
#include "base/bind.h"
#include "base/command_line.h"
@ -14,6 +15,7 @@
#include "base/metrics/stats_table.h"
#include "base/rand_util.h"
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
#include "build/build_config.h"
#include "net/base/net_module.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifier.h"
@ -142,9 +144,9 @@ void CefProcessUIThread::Init() {
if (settings.product_version.length > 0) {
product_version = CefString(&settings.product_version).ToString();
} else {
// Keep synchronized with the newest Dev Channel release announced at
// http://googlechromereleases.blogspot.com/
product_version = "Chrome/16.0.904.0";
product_version = base::StringPrintf("Chrome/%d.%d.%d.%d",
CHROME_VERSION_MAJOR, CHROME_VERSION_MINOR, CHROME_VERSION_BUILD,
CHROME_VERSION_PATCH);
}
webkit_glue::SetUserAgent(

View File

@ -10,7 +10,7 @@
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#include "version.h"
#include "../version.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@ -59,8 +59,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,SVN_REVISION,0
PRODUCTVERSION 1,0,SVN_REVISION,0
FILEVERSION 1,0,CEF_REVISION,0
PRODUCTVERSION 1,0,CEF_REVISION,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -76,12 +76,12 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Chromium Embedded Framework (CEF) Dynamic Link Library"
VALUE "FileVersion", "1.0." MAKE_STRING(SVN_REVISION)
VALUE "FileVersion", "1.0." MAKE_STRING(CEF_REVISION)
VALUE "InternalName", "libcef"
VALUE "LegalCopyright", "Copyright (C) " MAKE_STRING(COPYRIGHT_YEAR) " The Chromium Embedded Framework Authors"
VALUE "OriginalFilename", "libcef.dll"
VALUE "ProductName", "Chromium Embedded Framework (CEF) Dynamic Link Library"
VALUE "ProductVersion", "1.0." MAKE_STRING(SVN_REVISION)
VALUE "ProductVersion", "1.0." MAKE_STRING(CEF_REVISION)
END
END
BLOCK "VarFileInfo"

View File

@ -9,12 +9,18 @@ import os, sys
# The CEF root directory is the parent directory of _this_ script.
cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
print "\nGenerating CEF version header file..."
gyper = [ 'python', 'tools/make_version_header.py',
'--header', 'version.h',
'--version', '../chrome/VERSION' ]
RunAction(cef_dir, gyper)
print "\nPatching build configuration and source files for CEF..."
patcher = [ 'python', 'tools/patcher.py',
'--patch-config', 'patch/patch.cfg' ];
RunAction(cef_dir, patcher);
RunAction(cef_dir, patcher)
print "\nGenerating CEF project files..."
os.environ['CEF_DIRECTORY'] = os.path.basename(cef_dir);
gyper = [ 'python', 'tools/gyp_cef', 'cef.gyp', '-I', 'cef.gypi' ]
RunAction(cef_dir, gyper);
RunAction(cef_dir, gyper)

View File

@ -1,2 +1,2 @@
@echo off
..\third_party\python_26\python.exe tools\make_version_header.py --header libcef_dll\version.h
..\third_party\python_26\python.exe tools\make_version_header.py --header version.h --version ../chrome/VERSION

View File

@ -22,21 +22,35 @@ This utility creates the version header file.
parser = OptionParser(description=disc)
parser.add_option('--header', dest='header', metavar='FILE',
help='output version header file [required]')
parser.add_option('--version', dest='version', metavar='FILE',
help='input Chrome version config file [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:
if options.header is None or options.version is None:
parser.print_help(sys.stdout)
sys.exit()
def write_svn_header(file):
""" Creates the header file for the current revision if the revision has
changed or if the file doesn't already exist. """
if path_exists(file):
oldcontents = read_file(file)
def write_svn_header(header, version):
""" 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. """
if not path_exists(version):
raise Exception('Version file '+version+' does not exist.')
# Read and parse the version file (key=value pairs, one per line)
chrome = {}
lines = read_file(version).split("\n")
for line in lines:
parts = line.split('=', 1)
if len(parts) == 2:
chrome[parts[0]] = parts[1]
if path_exists(header):
oldcontents = read_file(header)
else:
oldcontents = ''
@ -44,20 +58,25 @@ def write_svn_header(file):
'#ifndef _VERSION_H\n'+\
'#define _VERSION_H\n'+\
'\n'+\
'#define SVN_REVISION ' + get_revision() + '\n'+\
'#define CEF_REVISION ' + get_revision() + '\n'+\
'#define COPYRIGHT_YEAR ' + get_year() + '\n'+\
'\n'+\
'#define CHROME_VERSION_MAJOR ' + chrome['MAJOR'] + '\n'+\
'#define CHROME_VERSION_MINOR ' + chrome['MINOR'] + '\n'+\
'#define CHROME_VERSION_BUILD ' + chrome['BUILD'] + '\n'+\
'#define CHROME_VERSION_PATCH ' + chrome['PATCH'] + '\n'+\
'\n'+\
'#define DO_MAKE_STRING(p) #p\n'+\
'#define MAKE_STRING(p) DO_MAKE_STRING(p)\n'+\
'\n'+\
'#endif\n'
if newcontents != oldcontents:
write_file(file, newcontents)
write_file(header, newcontents)
return True
return False
written = write_svn_header(options.header)
written = write_svn_header(options.header, options.version)
if not options.quiet:
if written:
sys.stdout.write('File '+options.header+' updated.\n')