Auto-generate v8 version based on tags.
BUG=chromium:446166 LOG=y Review URL: https://codereview.chromium.org/797503007 Cr-Commit-Position: refs/heads/master@{#26062}
This commit is contained in:
parent
fe82e03bb6
commit
b301b85be8
22
BUILD.gn
22
BUILD.gn
@ -314,6 +314,25 @@ 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)
|
||||
#
|
||||
@ -398,6 +417,7 @@ 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",
|
||||
@ -933,7 +953,6 @@ 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",
|
||||
@ -1211,6 +1230,7 @@ source_set("v8_base") {
|
||||
defines = []
|
||||
deps = [
|
||||
":v8_libbase",
|
||||
":generate_v8_version",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
|
@ -335,6 +335,34 @@
|
||||
}],
|
||||
],
|
||||
},
|
||||
{
|
||||
'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',
|
||||
@ -348,6 +376,7 @@
|
||||
'../..',
|
||||
],
|
||||
'sources': [ ### gcmole(all) ###
|
||||
'<(SHARED_INTERMEDIATE_DIR)/version.cc',
|
||||
'../../src/accessors.cc',
|
||||
'../../src/accessors.h',
|
||||
'../../src/allocation.cc',
|
||||
@ -886,7 +915,6 @@
|
||||
'../../src/variables.cc',
|
||||
'../../src/variables.h',
|
||||
'../../src/vector.h',
|
||||
'../../src/version.cc',
|
||||
'../../src/version.h',
|
||||
'../../src/vm-state-inl.h',
|
||||
'../../src/vm-state.h',
|
||||
@ -898,8 +926,14 @@
|
||||
],
|
||||
'conditions': [
|
||||
['want_separate_host_toolset==1', {
|
||||
'dependencies': [
|
||||
'v8_version#host',
|
||||
],
|
||||
'toolsets': ['host', 'target'],
|
||||
}, {
|
||||
'dependencies': [
|
||||
'v8_version',
|
||||
],
|
||||
'toolsets': ['target'],
|
||||
}],
|
||||
['v8_target_arch=="arm"', {
|
||||
|
@ -19,6 +19,12 @@ CWD = os.path.abspath(
|
||||
VERSION_CC = os.path.join(CWD, "src", "version.cc")
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print "Error: Specify the output file path for version.cc"
|
||||
return 1
|
||||
version_out = sys.argv[1]
|
||||
assert os.path.exists(os.path.dirname(version_out))
|
||||
|
||||
tag = subprocess.check_output(
|
||||
"git describe --tags",
|
||||
shell=True,
|
||||
@ -50,21 +56,20 @@ def main():
|
||||
patch = "0"
|
||||
|
||||
# Modify version.cc with the new values.
|
||||
with open(VERSION_CC, "r") as f:
|
||||
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))
|
||||
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)
|
||||
with open(version_out, "w") as f:
|
||||
f.write("".join(output))
|
||||
|
||||
# Log what was done.
|
||||
candidate_txt = " (candidate)" if candidate == "1" else ""
|
||||
|
Loading…
Reference in New Issue
Block a user