Disable hashes for ANGLE features generator

Features autogen files are small, fast to regenerate.
Run the generator in --verify-only mode and check content every time,
instead of using hashes.

Bug: angleproject:8193
Change-Id: I3988ab50a6c33171b7b7252c03f34a74f09fcf18
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4604579
Commit-Queue: Roman Lavrov <romanl@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
This commit is contained in:
Roman Lavrov
2023-06-09 18:39:52 -04:00
committed by Angle LUCI CQ
parent f1e1987261
commit 1572f609c1
3 changed files with 51 additions and 42 deletions

View File

@@ -66,8 +66,6 @@ def auto_script(script):
generators = {
'ANGLE features':
'include/platform/gen_features.py',
'ANGLE format':
'src/libANGLE/renderer/gen_angle_format_table.py',
'ANGLE load functions table':
@@ -135,6 +133,12 @@ generators = {
}
# Fast and supports --verify-only without hashes.
hashless_generators = {
'ANGLE features': 'include/platform/gen_features.py',
}
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "r") as f:
@@ -252,8 +256,22 @@ def main():
if not runningSingleGenerator and any_old_hash_missing(all_new_hashes, all_old_hashes):
any_dirty = True
# Handle hashless_generators separately as these don't have hash maps.
hashless_generators_dirty = False
for name, script in sorted(hashless_generators.items()):
cmd = [get_executable_name(script), os.path.basename(script)]
rc = subprocess.call(cmd + ['--verify-only'], cwd=get_child_script_dirname(script))
if rc != 0:
print(name + ' generator dirty')
# Don't set any_dirty as we don't need git cl format in this case.
hashless_generators_dirty = True
if not args.verify_only:
print('Running ' + name + ' code generator')
subprocess.check_call(cmd, cwd=get_child_script_dirname(script))
if args.verify_only:
sys.exit(any_dirty)
return int(any_dirty or hashless_generators_dirty)
if any_dirty:
args = ['git.bat'] if os.name == 'nt' else ['git']
@@ -273,6 +291,8 @@ def main():
json.dump(new_hashes, f, indent=2, sort_keys=True, separators=(',', ':\n '))
f.write('\n') # json.dump doesn't end with newline
return 0
if __name__ == '__main__':
sys.exit(main())