Commit 44f518b5 by Clemen Deng Committed by Commit Bot

Have run_code_generation only call vpython when needed

gen_builtin_symbols.py uses a vpython module to generate a perfect hash function Also seeded the perfect hash function to make it deterministic Bug: angleproject:3747 Change-Id: I660fe71bd6b2213be9d4ccc2f68641637a49a047 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1738747 Commit-Queue: Clemen Deng <clemendeng@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 483ee3fa
{
"src/compiler/translator/ImmutableString_autogen.cpp":
"325dc410635436401990388b73531c11",
"e7c9b98db7d7b435f57ff26fc265efb3",
"src/compiler/translator/ParseContext_autogen.h":
"58786d2f352ee1a58d529fb7572c86a4",
"src/compiler/translator/SymbolTable_autogen.cpp":
......@@ -12,7 +12,7 @@
"src/compiler/translator/builtin_variables.json":
"04f763459cfbd47831bec22299287e82",
"src/compiler/translator/gen_builtin_symbols.py":
"5fca8cb433dcbbd956ec27dc583ccee8",
"466747c0158bab9d4792f066b70bf5ed",
"src/compiler/translator/tree_util/BuiltIn_autogen.h":
"69268b2f3bda048ba8aaabe60c9b9912",
"src/tests/compiler_tests/ImmutableString_test_autogen.cpp":
......
......@@ -38,12 +38,18 @@ def rebase_script_path(script_path, relative_path):
return os.path.relpath(os.path.join(os.path.dirname(script_path), relative_path), root_dir)
def get_executable_name():
return 'vpython.bat' if platform.system() == 'Windows' else 'vpython'
# Check if we need a module from vpython
def get_executable_name(first_line):
if 'vpython' in first_line:
return 'vpython.bat' if platform.system() == 'Windows' else 'vpython'
return 'python'
def grab_from_script(script, param):
res = subprocess.check_output([get_executable_name(), script, param]).strip()
res = ''
f = open(os.path.basename(script), "r")
res = subprocess.check_output([get_executable_name(f.readline()), script, param]).strip()
f.close()
if res == '':
return []
return [clean_path_slashes(rebase_script_path(script, name)) for name in res.split(',')]
......@@ -190,8 +196,12 @@ def main():
os.chdir(get_child_script_dirname(script))
print('Running ' + name + ' code generator')
if subprocess.call([get_executable_name(), os.path.basename(script)]) != 0:
f = open(os.path.basename(script), "r")
if subprocess.call([get_executable_name(f.readline()),
os.path.basename(script)]) != 0:
sys.exit(1)
f.close()
# Update the hash dictionary.
all_new_hashes[fname] = new_hashes
......
......@@ -23,6 +23,7 @@ import json
import re
import os
import sys
import random
template_immutablestring_cpp = """// GENERATED FILE - DO NOT EDIT.
// Generated by {script_name} using data from {variable_data_source_name} and
......@@ -1248,7 +1249,7 @@ def process_variable_group(parent_condition, group_name, group, builtin_id_decla
def main():
random.seed(0)
set_working_dir()
parser = argparse.ArgumentParser()
......
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