Skip to content

Commit 5ea86b4

Browse files
committed
[CI] Re-add generated files consistency check
1 parent 00a450f commit 5ea86b4

File tree

2 files changed

+35
-17
lines changed

2 files changed

+35
-17
lines changed

.github/workflows/static_checks.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ jobs:
3232
uses: pre-commit/action@v3.0.1
3333
with:
3434
extra_args: --verbose --hook-stage manual --files ${{ env.CHANGED_FILES }}
35+
36+
- name: Check generated files consistency
37+
run:
38+
python misc/scripts/check_get_file_list.py

misc/scripts/check_get_file_list.py

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,40 @@
66

77
sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", ".."))
88

9-
from binding_generator import generate_bindings, get_file_list
9+
from binding_generator import _generate_bindings, _get_file_list
10+
from build_profile import generate_trimmed_api
1011

1112
api_filepath = "gdextension/extension_api.json"
1213
bits = "64"
1314
precision = "single"
1415
output_dir = "self_test"
1516

16-
generate_bindings(api_filepath, use_template_get_node=False, bits=bits, precision=precision, output_dir=output_dir)
17-
flist = get_file_list(api_filepath, output_dir, headers=True, sources=True)
18-
19-
p = Path(output_dir) / "gen"
20-
allfiles = [str(f.as_posix()) for f in p.glob("**/*.*")]
21-
missing = list(filter((lambda f: f not in flist), allfiles))
22-
extras = list(filter((lambda f: f not in allfiles), flist))
23-
if len(missing) > 0 or len(extras) > 0:
24-
print("Error!")
25-
for f in missing:
26-
print("MISSING: " + str(f))
27-
for f in extras:
28-
print("EXTRA: " + str(f))
29-
sys.exit(1)
30-
else:
31-
print("OK!")
17+
18+
def test(profile_filepath=""):
19+
api = generate_trimmed_api(api_filepath, profile_filepath)
20+
_generate_bindings(
21+
api,
22+
use_template_get_node=False,
23+
bits=bits,
24+
precision=precision,
25+
output_dir=output_dir,
26+
)
27+
flist = _get_file_list(api, output_dir, headers=True, sources=True)
28+
29+
p = Path(output_dir) / "gen"
30+
allfiles = [str(f.as_posix()) for f in p.glob("**/*.*")]
31+
missing = list(filter((lambda f: f not in flist), allfiles))
32+
extras = list(filter((lambda f: f not in allfiles), flist))
33+
if len(missing) > 0 or len(extras) > 0:
34+
print("Error!")
35+
for f in missing:
36+
print("MISSING: " + str(f))
37+
for f in extras:
38+
print("EXTRA: " + str(f))
39+
sys.exit(1)
40+
else:
41+
print("OK!")
42+
43+
44+
test()
45+
test("test/build_profile.json")

0 commit comments

Comments
 (0)