auto gen hashes on make

This commit is contained in:
PabstMirror 2024-08-17 13:22:01 -05:00
parent 8a69cf2efc
commit 247495ed2c
5 changed files with 34 additions and 37 deletions

View File

@ -0,0 +1,6 @@
class ACE_ExtensionsHashes {
class ace {
dll = "b2e646f865f48811192bde4877a210a85f05b473";
dll_x64 = "6b32d7f9a3aaa027af2bc6cb0b7c61371bdf6706";
};
};

View File

@ -76,25 +76,4 @@ class ACE_Tests {
cfgPatches = QPATHTOF(dev\test_cfgPatches.sqf);
};
class ACE_ExtensionsHashes {
class ace_advanced_ballistics {
dll = "bbfbd04bced4e4766298903944ff2d0e3da7586a";
dll_x64 = "95bdf812ebb52d4e87c4b1b980dfa785d4f980a7";
};
class ace_artillerytables {
dll = "f6db1088a08e1c98f3718159a653df3ba11df773";
dll_x64 = "d3f76b3b95ffe9c6ab6ded137ae41edcab81a9f0";
};
class ace_break_line {
dll = "c1f0b83ced1f36849c8aaf23f27c889d7d7e1344";
dll_x64 = "8622873962f4c4d3bbe05891242f21ba69845d11";
};
class ace_clipboard {
dll = "cde2eceb8bac3a119c53a957e332f1a2f9cd8dcb";
dll_x64 = "d5e8660018b9c9e870a0d4e6005a65afe48b00d3";
};
class ace_fcs {
dll = "58b36db51209f61f2b63fc2469b1c74efd581012";
dll_x64 = "4db527f03bbe71d5004647ad6b12d0263b0c3af9";
};
};
#include "ACE_ExtensionsHashes.hpp"

View File

@ -55,5 +55,13 @@ dependencies = ["build_x32_release"]
[tasks.debug]
dependencies = ["move_x32_debug", "move_x64_debug"]
[tasks.release]
[tasks.updateSigs]
script_runner = "python"
script_extension = "py"
script_runner_args = ["../tools/getExtensionHash.py"]
script = '''
'''
dependencies = ["move_x32_release", "move_x64_release"]
[tasks.release]
dependencies = ["updateSigs"]

View File

@ -117,9 +117,9 @@
"kind": "build",
"isDefault": true
}
}
},
{
"label": "Extension: x64",
"label": "Extension: make move_x64_release",
"command": "cargo",
"options": {
"cwd": "${workspaceFolder}"
@ -131,9 +131,9 @@
"group": {
"kind": "build"
}
}
},
{
"label": "Extension: Release",
"label": "Extension: make release",
"command": "cargo",
"options": {
"cwd": "${workspaceFolder}"

View File

@ -7,15 +7,15 @@ addon_base_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
extensions = {}
for file in os.listdir(addon_base_path):
path = pathlib.Path(file)
path = pathlib.Path(addon_base_path, file)
extension_type = "dll"
if path.suffix == ".dll":
key = path.stem
if key.endswith("_x64"):
key = key.removesuffix("_x64")
extension_type += "_x64"
with open(file, 'rb') as file_read:
print(f"looking at {path}")
with open(path, 'rb') as file_read:
sha1 = hashlib.sha1()
data = file_read.read()
sha1.update(data)
@ -23,10 +23,14 @@ for file in os.listdir(addon_base_path):
arr[extension_type] = sha1.hexdigest()
extensions[key] = arr
print(f"class ACE_ExtensionsHashes {{")
for key, values in extensions.items():
print(f" class {key} {{")
file_out = pathlib.Path(addon_base_path, "addons", "common", "ACE_ExtensionsHashes.hpp")
with open(file_out, 'w') as file_write:
print(f"class ACE_ExtensionsHashes {{", file=file_write)
for key, values in extensions.items():
print(f" class {key} {{", file=file_write)
for type, hash in values.items():
print(f" {type} = \"{hash}\";")
print(f" }};")
print(f"}};")
print(f" {type} = \"{hash}\";", file=file_write)
print(f" }};", file=file_write)
print(f"}};", file=file_write)
print(f"Wrote {len(extensions)} to {file_out}")