Revert of Reland Auto-generate v8 version based on tags. (patchset #1 id:1 of https://codereview.chromium.org/843913009/)
Reason for revert: The gclient hook of v8 is not executed on this builder: http://build.chromium.org/p/tryserver.chromium.linux/builders/android_aosp/builds/49765 Original issue's description: > Reland Auto-generate v8 version based on tags. > > This relands the CL > https://codereview.chromium.org/797503007/. > > It runs the version generation two times. First during > runhooks as a fallback for recipes that loose git context > (e.g. android_aosp). Second during compilation like in the > original CL. In case of failures, the result from the > runhooks call will be reused. > > BUG=chromium:446166 > LOG=n > > Committed: https://crrev.com/d3d6e38b2cba73b52bd5ed00f4441a7db3284a19 > Cr-Commit-Position: refs/heads/master@{#26120} TBR=jochen@chromium.org,jkummerow@chromium.org,tandrii@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=chromium:446166 Review URL: https://codereview.chromium.org/855263002 Cr-Commit-Position: refs/heads/master@{#26121}
This commit is contained in:
parent
d3d6e38b2c
commit
12adf1474d
1
.gitignore
vendored
1
.gitignore
vendored
@ -27,7 +27,6 @@
|
||||
.project
|
||||
.pydevproject
|
||||
.settings
|
||||
.version.cc
|
||||
.*.sw?
|
||||
bsuite
|
||||
d8
|
||||
|
22
BUILD.gn
22
BUILD.gn
@ -314,25 +314,6 @@ action("run_mksnapshot") {
|
||||
}
|
||||
}
|
||||
|
||||
action("generate_v8_version") {
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
|
||||
script = "tools/push-to-trunk/generate_version.py"
|
||||
|
||||
sources = [
|
||||
"src/version.cc",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
"$target_gen_dir/version.cc"
|
||||
]
|
||||
|
||||
args = [
|
||||
rebase_path("$target_gen_dir/version.cc", root_build_dir),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Source Sets (aka static libraries)
|
||||
#
|
||||
@ -417,7 +398,6 @@ source_set("v8_base") {
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
|
||||
sources = [
|
||||
"$target_gen_dir/version.cc",
|
||||
"src/accessors.cc",
|
||||
"src/accessors.h",
|
||||
"src/allocation.cc",
|
||||
@ -954,6 +934,7 @@ source_set("v8_base") {
|
||||
"src/v8threads.h",
|
||||
"src/variables.cc",
|
||||
"src/variables.h",
|
||||
"src/version.cc",
|
||||
"src/version.h",
|
||||
"src/vm-state-inl.h",
|
||||
"src/vm-state.h",
|
||||
@ -1231,7 +1212,6 @@ source_set("v8_base") {
|
||||
defines = []
|
||||
deps = [
|
||||
":v8_libbase",
|
||||
":generate_v8_version",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
|
7
DEPS
7
DEPS
@ -87,13 +87,6 @@ hooks = [
|
||||
'pattern': '.',
|
||||
'action': ['python', 'v8/tools/clang/scripts/update.py', '--if-needed'],
|
||||
},
|
||||
{
|
||||
# Generate v8 version based on the last git tag.
|
||||
"pattern": ".",
|
||||
"action": ["python",
|
||||
"v8/tools/push-to-trunk/generate_version.py",
|
||||
"--hook"],
|
||||
},
|
||||
{
|
||||
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
|
||||
"pattern": ".",
|
||||
|
@ -335,34 +335,6 @@
|
||||
}],
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'v8_version',
|
||||
'type': 'none',
|
||||
'conditions': [
|
||||
['want_separate_host_toolset==1', {
|
||||
'toolsets': ['host'],
|
||||
}, {
|
||||
'toolsets': ['target'],
|
||||
}],
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'generate_v8_version',
|
||||
'inputs': [
|
||||
'../../tools/push-to-trunk/generate_version.py',
|
||||
'../../src/version.cc',
|
||||
],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/version.cc',
|
||||
],
|
||||
'action': [
|
||||
'python',
|
||||
'../../tools/push-to-trunk/generate_version.py',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/version.cc',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'v8_base',
|
||||
'type': 'static_library',
|
||||
@ -376,7 +348,6 @@
|
||||
'../..',
|
||||
],
|
||||
'sources': [ ### gcmole(all) ###
|
||||
'<(SHARED_INTERMEDIATE_DIR)/version.cc',
|
||||
'../../src/accessors.cc',
|
||||
'../../src/accessors.h',
|
||||
'../../src/allocation.cc',
|
||||
@ -916,6 +887,7 @@
|
||||
'../../src/variables.cc',
|
||||
'../../src/variables.h',
|
||||
'../../src/vector.h',
|
||||
'../../src/version.cc',
|
||||
'../../src/version.h',
|
||||
'../../src/vm-state-inl.h',
|
||||
'../../src/vm-state.h',
|
||||
@ -927,14 +899,8 @@
|
||||
],
|
||||
'conditions': [
|
||||
['want_separate_host_toolset==1', {
|
||||
'dependencies': [
|
||||
'v8_version#host',
|
||||
],
|
||||
'toolsets': ['host', 'target'],
|
||||
}, {
|
||||
'dependencies': [
|
||||
'v8_version',
|
||||
],
|
||||
'toolsets': ['target'],
|
||||
}],
|
||||
['v8_target_arch=="arm"', {
|
||||
|
@ -5,23 +5,9 @@
|
||||
|
||||
"""
|
||||
Script to set v8's version file to the version given by the latest tag.
|
||||
|
||||
The script can be run in two modes:
|
||||
1) As a gclient hook with the option --hook.
|
||||
The script will write a temporary version file into the checkout.
|
||||
2) During compilation as an action.
|
||||
The script will write version.cc in the output folder based on the
|
||||
tag info. In case of a failure it will fall back to the temporary file
|
||||
from the hook call.
|
||||
|
||||
In most cases, 2) will succeed and the temporary information from 1) won't
|
||||
be used. In case the checkout is copied somewhere and the git context is
|
||||
lost (e.g. on the android_aosp builder), the temporary file from 1) is
|
||||
required.
|
||||
"""
|
||||
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
@ -31,10 +17,8 @@ import sys
|
||||
CWD = os.path.abspath(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||
VERSION_CC = os.path.join(CWD, "src", "version.cc")
|
||||
TMP_VERSION_CC = os.path.join(CWD, ".version.cc")
|
||||
|
||||
|
||||
def generate_version_file():
|
||||
def main():
|
||||
tag = subprocess.check_output(
|
||||
"git describe --tags",
|
||||
shell=True,
|
||||
@ -66,68 +50,28 @@ def generate_version_file():
|
||||
patch = "0"
|
||||
|
||||
# Modify version.cc with the new values.
|
||||
output = []
|
||||
with open(VERSION_CC, "r") as f:
|
||||
for line in f:
|
||||
for definition, substitute in (
|
||||
("MAJOR_VERSION", major),
|
||||
("MINOR_VERSION", minor),
|
||||
("BUILD_NUMBER", build),
|
||||
("PATCH_LEVEL", patch),
|
||||
("IS_CANDIDATE_VERSION", candidate)):
|
||||
if line.startswith("#define %s" % definition):
|
||||
line = re.sub("\d+$", substitute, line)
|
||||
output.append(line)
|
||||
# Log what was calculated.
|
||||
text = f.read()
|
||||
output = []
|
||||
for line in text.split("\n"):
|
||||
for definition, substitute in (
|
||||
("MAJOR_VERSION", major),
|
||||
("MINOR_VERSION", minor),
|
||||
("BUILD_NUMBER", build),
|
||||
("PATCH_LEVEL", patch),
|
||||
("IS_CANDIDATE_VERSION", candidate)):
|
||||
if line.startswith("#define %s" % definition):
|
||||
line = re.sub("\d+$", substitute, line)
|
||||
output.append(line)
|
||||
with open(VERSION_CC, "w") as f:
|
||||
f.write("\n".join(output))
|
||||
|
||||
# Log what was done.
|
||||
candidate_txt = " (candidate)" if candidate == "1" else ""
|
||||
patch_txt = ".%s" % patch if patch != "0" else ""
|
||||
version_txt = ("%s.%s.%s%s%s" %
|
||||
(major, minor, build, patch_txt, candidate_txt))
|
||||
print "Modifying version.cc. Set V8 version to %s" % version_txt
|
||||
return "".join(output)
|
||||
|
||||
|
||||
def delete_tmp_version_file():
|
||||
# Make sure a subsequent call to this script doesn't use an outdated
|
||||
# version file.
|
||||
if os.path.exists(TMP_VERSION_CC):
|
||||
os.remove(TMP_VERSION_CC)
|
||||
|
||||
|
||||
def main():
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option("--hook",
|
||||
help="Run as a gclient hook",
|
||||
default=False, action="store_true")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if options.hook:
|
||||
version_out = TMP_VERSION_CC
|
||||
else:
|
||||
if len(args) != 1:
|
||||
print "Error: Specify the output file path for version.cc"
|
||||
return 1
|
||||
version_out = args[0]
|
||||
|
||||
assert os.path.exists(os.path.dirname(version_out))
|
||||
|
||||
try:
|
||||
version_file_content = generate_version_file()
|
||||
except Exception as e:
|
||||
# Allow exceptions when run during compilation. E.g. there might be no git
|
||||
# context availabe. When run as a gclient hook, generation must succeed.
|
||||
if options.hook:
|
||||
delete_tmp_version_file()
|
||||
raise e
|
||||
# Assume the script already ran as a hook.
|
||||
print "No git context available. Using V8 version from hook."
|
||||
assert os.path.exists(TMP_VERSION_CC)
|
||||
with open(TMP_VERSION_CC, "r") as f:
|
||||
version_file_content = f.read()
|
||||
|
||||
delete_tmp_version_file()
|
||||
with open(version_out, "w") as f:
|
||||
f.write(version_file_content)
|
||||
print "Modified version.cc. Set V8 version to %s" % version_txt
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user