summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-31 10:53:39 +0000
committermnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-31 10:53:39 +0000
commitb0abfb679a836ccb7d6da8d6f3c9c942a9295c9a (patch)
tree88c3760c6c71f344d2810d1e3d1d8e400c8ac0ec
parentb5ded6e76b0f0a95c17de3a1b59ab279369c1ee0 (diff)
downloadchromium_src-b0abfb679a836ccb7d6da8d6f3c9c942a9295c9a.zip
chromium_src-b0abfb679a836ccb7d6da8d6f3c9c942a9295c9a.tar.gz
chromium_src-b0abfb679a836ccb7d6da8d6f3c9c942a9295c9a.tar.bz2
Generate and use LASTCHANGE for blink
The main reason for making this change is the fact that when pulling Chromium and Blink code into Android, we have to make automatic changes to the repository (for example, for generating *.mk files), and the Blink commit we have as HEAD doesn't match any public commit in the main Blink repo. While via the LASTCHANGE file we could report a publicly visible revision. Also, the way webkit_version.h header is generated now appears to be silly. First, it doesn't leverage enough existing tools. Second, as it is noted in webkit_user_agent.gypi, it is broken for incremental builds. Review URL: https://chromiumcodereview.appspot.com/14973005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203387 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--.gitignore2
-rw-r--r--DEPS8
-rwxr-xr-xbuild/util/lastchange.py2
-rwxr-xr-xtools/export_tarball/export_tarball.py8
-rw-r--r--webkit/build/webkit_version.h.in9
-rwxr-xr-xwebkit/build/webkit_version.py72
-rw-r--r--webkit/common/user_agent/webkit_user_agent.gypi18
7 files changed, 37 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore
index fa3c269..5b92c0f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,7 +49,7 @@ v8.log
/build/Release_x64
/build/gomacc.lock
/build/ipch/
-/build/util/LASTCHANGE
+/build/util/LASTCHANGE*
/build/util/support
/build/x64/
# The Chrome OS build creates a /c symlink due to http://crbug.com/54866.
diff --git a/DEPS b/DEPS
index 526becf..ebd26de 100644
--- a/DEPS
+++ b/DEPS
@@ -662,6 +662,14 @@ hooks = [
"-o", "src/build/util/LASTCHANGE"],
},
{
+ # Update LASTCHANGE.blink. This is also run by export_tarball.py in
+ # src/tools/export_tarball - please keep them in sync.
+ "pattern": ".",
+ "action": ["python", "src/build/util/lastchange.py",
+ "-s", "src/third_party/WebKit",
+ "-o", "src/build/util/LASTCHANGE.blink"],
+ },
+ {
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
"pattern": ".",
"action": ["python", "src/build/gyp_chromium"],
diff --git a/build/util/lastchange.py b/build/util/lastchange.py
index dba8e54..3c1ce28 100755
--- a/build/util/lastchange.py
+++ b/build/util/lastchange.py
@@ -149,7 +149,7 @@ def FetchGitSVNRevision(directory, svn_url_regex):
def FetchVersionInfo(default_lastchange, directory=None,
- directory_regex_prior_to_src_url='chrome|svn'):
+ directory_regex_prior_to_src_url='chrome|blink|svn'):
"""
Returns the last change (in the form of a branch, revision tuple),
from some appropriate revision control system.
diff --git a/tools/export_tarball/export_tarball.py b/tools/export_tarball/export_tarball.py
index 148162b..ec0785c 100755
--- a/tools/export_tarball/export_tarball.py
+++ b/tools/export_tarball/export_tarball.py
@@ -134,11 +134,17 @@ def main(argv):
print 'Cannot find the src directory ' + GetSourceDirectory()
return 1
- # This command is from src/DEPS; please keep them in sync.
+ # These two commands are from src/DEPS; please keep them in sync.
if subprocess.call(['python', 'build/util/lastchange.py', '-o',
'build/util/LASTCHANGE'], cwd=GetSourceDirectory()) != 0:
print 'Could not run build/util/lastchange.py to update LASTCHANGE.'
return 1
+ if subprocess.call(['python', 'build/util/lastchange.py', '-s',
+ 'src/third_party/WebKit', '-o',
+ 'src/build/util/LASTCHANGE.blink'],
+ cwd=GetSourceDirectory()) != 0:
+ print 'Could not run build/util/lastchange.py to update LASTCHANGE.blink.'
+ return 1
output_fullname = args[0] + '.tar'
output_basename = options.basename or os.path.basename(args[0])
diff --git a/webkit/build/webkit_version.h.in b/webkit/build/webkit_version.h.in
new file mode 100644
index 0000000..8d61e47
--- /dev/null
+++ b/webkit/build/webkit_version.h.in
@@ -0,0 +1,9 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// webkit_version.h is generated from webkit_version.h.in. Edit the source!
+
+#define WEBKIT_VERSION_MAJOR 537
+#define WEBKIT_VERSION_MINOR 36
+#define WEBKIT_SVN_REVISION "@@LASTCHANGE@"
diff --git a/webkit/build/webkit_version.py b/webkit/build/webkit_version.py
deleted file mode 100755
index 93def61..0000000
--- a/webkit/build/webkit_version.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-'''Emits a webkit_version.h header file with
-WEBKIT_MAJOR_VERSION and WEBKIT_MINOR_VERSION macros.
-'''
-
-import os
-import re
-import sys
-
-# Get the full path of the current script which would be something like
-# src/webkit/build/webkit_version.py and navigate backwards twice to strip the
-# last two path components to get to the srcroot.
-# This is to ensure that the script can load the lastchange module by updating
-# the sys.path variable with the desired location.
-path = os.path.dirname(os.path.realpath(__file__))
-path = os.path.dirname(os.path.dirname(path))
-path = os.path.join(path, 'build', 'util')
-
-sys.path.insert(0, path)
-import lastchange
-
-
-def GetWebKitRevision(webkit_src_dir):
- """Get the WebKit revision, in the form 'trunk@1234'."""
-
- version_info = lastchange.FetchVersionInfo(
- default_lastchange=None,
- directory=webkit_src_dir,
- directory_regex_prior_to_src_url='webkit')
-
- if version_info.url == None:
- version_info.url = 'Unknown URL'
- version_info.url = version_info.url.strip('/')
-
- if version_info.revision == None:
- version_info.revision = '0'
-
- return "%s@%s" % (version_info.url, version_info.revision)
-
-
-def EmitVersionHeader(webkit_src_dir, output_dir):
- '''Emit a header file that we can use from within webkit_glue.cc.'''
-
- # These are hard-coded from when we forked Blink. Presumably these
- # would be better in a header somewhere.
- major, minor = (537, 36)
- webkit_revision = GetWebKitRevision(webkit_src_dir)
-
- fname = os.path.join(output_dir, "webkit_version.h")
- f = open(fname, 'wb')
- template = """// webkit_version.h
-// generated from %s
-
-#define WEBKIT_VERSION_MAJOR %d
-#define WEBKIT_VERSION_MINOR %d
-#define WEBKIT_SVN_REVISION "%s"
-""" % (webkit_src_dir, major, minor, webkit_revision)
- f.write(template)
- f.close()
- return 0
-
-
-def main():
- return EmitVersionHeader(*sys.argv[1:])
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/webkit/common/user_agent/webkit_user_agent.gypi b/webkit/common/user_agent/webkit_user_agent.gypi
index 61e88ea..3065825 100644
--- a/webkit/common/user_agent/webkit_user_agent.gypi
+++ b/webkit/common/user_agent/webkit_user_agent.gypi
@@ -50,18 +50,22 @@
'action_name': 'webkit_version',
'inputs': [
'<(script)',
- '../../../build/util/lastchange.py', # Used by the script.
- # This depends on the svn revision of third_party/WebKit but does
- # not list it as a dependency. Incremental builds will have
- # the wrong WEBKIT_SVN_REVISION.
+ '<(lastchange)',
+ '<(template)',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/webkit_version.h',
],
- 'action': ['python', '<(script)', '../../../third_party/WebKit/Source',
- '<(SHARED_INTERMEDIATE_DIR)'],
+ 'action': ['python',
+ '<(script)',
+ '-f', '<(lastchange)',
+ '<(template)',
+ '<@(_outputs)',
+ ],
'variables': {
- 'script': '../build/webkit_version.py',
+ 'script': '<(DEPTH)/chrome/tools/build/version.py',
+ 'lastchange': '<(DEPTH)/build/util/LASTCHANGE.blink',
+ 'template': '<(DEPTH)/webkit/build/webkit_version.h.in',
},
},
],