(dir: Path, bytecode_classes: list[BytecodeClass])
| 690 | |
| 691 | |
| 692 | def update_bytecode_version_header(dir: Path, bytecode_classes: list[BytecodeClass]) -> None: |
| 693 | file_path = dir / "bytecode_versions.h" |
| 694 | with open(file_path, "r") as f: |
| 695 | code = f.read() |
| 696 | |
| 697 | # split into lines, find `static constexpr int LATEST_GDSCRIPT_COMMIT`, replace the line with `static constexpr int LATEST_GDSCRIPT_COMMIT = 0x` + the bytecode_rev of the first bytecode_class |
| 698 | lines = code.split("\n") |
| 699 | for i, line in enumerate(lines): |
| 700 | if "static constexpr int LATEST_GDSCRIPT_COMMIT" in line: |
| 701 | lines[i] = line.split("=")[0] + "= 0x" + str(bytecode_classes[0].bytecode_rev) + ";" |
| 702 | break |
| 703 | code = "\n".join(lines) |
| 704 | with open(file_path, "w") as f: |
| 705 | f.write(code) |
| 706 | |
| 707 | |
| 708 | def generate_bytecode_versions_cpp(dir: Path, bytecode_classes: list[BytecodeClass]) -> None: |
no test coverage detected