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)
|
# Source Sets (aka static libraries)
|
||||||
#
|
#
|
||||||
@ -398,6 +417,7 @@ 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",
|
||||||
@ -933,7 +953,6 @@ 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",
|
||||||
@ -1211,6 +1230,7 @@ source_set("v8_base") {
|
|||||||
defines = []
|
defines = []
|
||||||
deps = [
|
deps = [
|
||||||
":v8_libbase",
|
":v8_libbase",
|
||||||
|
":generate_v8_version",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (is_win) {
|
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',
|
'target_name': 'v8_base',
|
||||||
'type': 'static_library',
|
'type': 'static_library',
|
||||||
@ -348,6 +376,7 @@
|
|||||||
'../..',
|
'../..',
|
||||||
],
|
],
|
||||||
'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',
|
||||||
@ -886,7 +915,6 @@
|
|||||||
'../../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',
|
||||||
@ -898,8 +926,14 @@
|
|||||||
],
|
],
|
||||||
'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"', {
|
||||||
|
@ -19,6 +19,12 @@ CWD = os.path.abspath(
|
|||||||
VERSION_CC = os.path.join(CWD, "src", "version.cc")
|
VERSION_CC = os.path.join(CWD, "src", "version.cc")
|
||||||
|
|
||||||
def main():
|
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(
|
tag = subprocess.check_output(
|
||||||
"git describe --tags",
|
"git describe --tags",
|
||||||
shell=True,
|
shell=True,
|
||||||
@ -50,21 +56,20 @@ def main():
|
|||||||
patch = "0"
|
patch = "0"
|
||||||
|
|
||||||
# Modify version.cc with the new values.
|
# Modify version.cc with the new values.
|
||||||
with open(VERSION_CC, "r") as f:
|
|
||||||
text = f.read()
|
|
||||||
output = []
|
output = []
|
||||||
for line in text.split("\n"):
|
with open(VERSION_CC, "r") as f:
|
||||||
for definition, substitute in (
|
for line in f:
|
||||||
("MAJOR_VERSION", major),
|
for definition, substitute in (
|
||||||
("MINOR_VERSION", minor),
|
("MAJOR_VERSION", major),
|
||||||
("BUILD_NUMBER", build),
|
("MINOR_VERSION", minor),
|
||||||
("PATCH_LEVEL", patch),
|
("BUILD_NUMBER", build),
|
||||||
("IS_CANDIDATE_VERSION", candidate)):
|
("PATCH_LEVEL", patch),
|
||||||
if line.startswith("#define %s" % definition):
|
("IS_CANDIDATE_VERSION", candidate)):
|
||||||
line = re.sub("\d+$", substitute, line)
|
if line.startswith("#define %s" % definition):
|
||||||
output.append(line)
|
line = re.sub("\d+$", substitute, line)
|
||||||
with open(VERSION_CC, "w") as f:
|
output.append(line)
|
||||||
f.write("\n".join(output))
|
with open(version_out, "w") as f:
|
||||||
|
f.write("".join(output))
|
||||||
|
|
||||||
# Log what was done.
|
# Log what was done.
|
||||||
candidate_txt = " (candidate)" if candidate == "1" else ""
|
candidate_txt = " (candidate)" if candidate == "1" else ""
|
||||||
|
Loading…
Reference in New Issue
Block a user