Commit 12adf147 authored by machenbach's avatar machenbach Committed by Commit bot

Revert of Reland Auto-generate v8 version based on tags. (patchset #1 id:1 of...

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}
parent d3d6e38b
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
.project .project
.pydevproject .pydevproject
.settings .settings
.version.cc
.*.sw? .*.sw?
bsuite bsuite
d8 d8
......
...@@ -314,25 +314,6 @@ action("run_mksnapshot") { ...@@ -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) # Source Sets (aka static libraries)
# #
...@@ -417,7 +398,6 @@ source_set("v8_base") { ...@@ -417,7 +398,6 @@ source_set("v8_base") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [ sources = [
"$target_gen_dir/version.cc",
"src/accessors.cc", "src/accessors.cc",
"src/accessors.h", "src/accessors.h",
"src/allocation.cc", "src/allocation.cc",
...@@ -954,6 +934,7 @@ source_set("v8_base") { ...@@ -954,6 +934,7 @@ source_set("v8_base") {
"src/v8threads.h", "src/v8threads.h",
"src/variables.cc", "src/variables.cc",
"src/variables.h", "src/variables.h",
"src/version.cc",
"src/version.h", "src/version.h",
"src/vm-state-inl.h", "src/vm-state-inl.h",
"src/vm-state.h", "src/vm-state.h",
...@@ -1231,7 +1212,6 @@ source_set("v8_base") { ...@@ -1231,7 +1212,6 @@ source_set("v8_base") {
defines = [] defines = []
deps = [ deps = [
":v8_libbase", ":v8_libbase",
":generate_v8_version",
] ]
if (is_win) { if (is_win) {
......
...@@ -87,13 +87,6 @@ hooks = [ ...@@ -87,13 +87,6 @@ hooks = [
'pattern': '.', 'pattern': '.',
'action': ['python', 'v8/tools/clang/scripts/update.py', '--if-needed'], '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. # A change to a .gyp, .gypi, or to GYP itself should run the generator.
"pattern": ".", "pattern": ".",
......
...@@ -335,34 +335,6 @@ ...@@ -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', 'target_name': 'v8_base',
'type': 'static_library', 'type': 'static_library',
...@@ -376,7 +348,6 @@ ...@@ -376,7 +348,6 @@
'../..', '../..',
], ],
'sources': [ ### gcmole(all) ### 'sources': [ ### gcmole(all) ###
'<(SHARED_INTERMEDIATE_DIR)/version.cc',
'../../src/accessors.cc', '../../src/accessors.cc',
'../../src/accessors.h', '../../src/accessors.h',
'../../src/allocation.cc', '../../src/allocation.cc',
...@@ -916,6 +887,7 @@ ...@@ -916,6 +887,7 @@
'../../src/variables.cc', '../../src/variables.cc',
'../../src/variables.h', '../../src/variables.h',
'../../src/vector.h', '../../src/vector.h',
'../../src/version.cc',
'../../src/version.h', '../../src/version.h',
'../../src/vm-state-inl.h', '../../src/vm-state-inl.h',
'../../src/vm-state.h', '../../src/vm-state.h',
...@@ -927,14 +899,8 @@ ...@@ -927,14 +899,8 @@
], ],
'conditions': [ 'conditions': [
['want_separate_host_toolset==1', { ['want_separate_host_toolset==1', {
'dependencies': [
'v8_version#host',
],
'toolsets': ['host', 'target'], 'toolsets': ['host', 'target'],
}, { }, {
'dependencies': [
'v8_version',
],
'toolsets': ['target'], 'toolsets': ['target'],
}], }],
['v8_target_arch=="arm"', { ['v8_target_arch=="arm"', {
......
...@@ -5,23 +5,9 @@ ...@@ -5,23 +5,9 @@
""" """
Script to set v8's version file to the version given by the latest tag. 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 os
import re import re
import subprocess import subprocess
...@@ -31,10 +17,8 @@ import sys ...@@ -31,10 +17,8 @@ import sys
CWD = os.path.abspath( CWD = os.path.abspath(
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
VERSION_CC = os.path.join(CWD, "src", "version.cc") VERSION_CC = os.path.join(CWD, "src", "version.cc")
TMP_VERSION_CC = os.path.join(CWD, ".version.cc")
def main():
def generate_version_file():
tag = subprocess.check_output( tag = subprocess.check_output(
"git describe --tags", "git describe --tags",
shell=True, shell=True,
...@@ -66,68 +50,28 @@ def generate_version_file(): ...@@ -66,68 +50,28 @@ def generate_version_file():
patch = "0" patch = "0"
# Modify version.cc with the new values. # Modify version.cc with the new values.
output = []
with open(VERSION_CC, "r") as f: with open(VERSION_CC, "r") as f:
for line in f: text = f.read()
for definition, substitute in ( output = []
("MAJOR_VERSION", major), for line in text.split("\n"):
("MINOR_VERSION", minor), for definition, substitute in (
("BUILD_NUMBER", build), ("MAJOR_VERSION", major),
("PATCH_LEVEL", patch), ("MINOR_VERSION", minor),
("IS_CANDIDATE_VERSION", candidate)): ("BUILD_NUMBER", build),
if line.startswith("#define %s" % definition): ("PATCH_LEVEL", patch),
line = re.sub("\d+$", substitute, line) ("IS_CANDIDATE_VERSION", candidate)):
output.append(line) if line.startswith("#define %s" % definition):
# Log what was calculated. 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 "" candidate_txt = " (candidate)" if candidate == "1" else ""
patch_txt = ".%s" % patch if patch != "0" else "" patch_txt = ".%s" % patch if patch != "0" else ""
version_txt = ("%s.%s.%s%s%s" % version_txt = ("%s.%s.%s%s%s" %
(major, minor, build, patch_txt, candidate_txt)) (major, minor, build, patch_txt, candidate_txt))
print "Modifying version.cc. Set V8 version to %s" % version_txt print "Modified 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)
return 0 return 0
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment