21 lines
1.2 KiB
Python
21 lines
1.2 KiB
Python
"""Portable core boundary check. Run independently of any engine tooling."""
|
|
import json
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
root=Path(__file__).resolve().parents[2]
|
|
core=root/"gameFramework"
|
|
forbidden=re.compile(r'\b(?:CoreMinimal|UObject|UCLASS|USTRUCT|UPROPERTY|FString|FVector|TArray|TMap|UnrealBuildTool)\b|\.generated\.h|\.uproject|\.Build\.cs|Engine/Source')
|
|
failures=[]
|
|
checked=[]
|
|
for path in core.rglob("*"):
|
|
if path.is_file() and path.suffix in (".cpp",".hpp",".h",".txt",".inc") and "third_party" not in path.parts:
|
|
checked.append(str(path.relative_to(root)).replace("\\","/"))
|
|
for index,line in enumerate(path.read_text(encoding="utf-8").splitlines(),1):
|
|
if forbidden.search(line):failures.append({"file":str(path),"line":index})
|
|
report={"passed":not failures,"filesChecked":checked,"violations":failures,"method":"Source and public boundary scan; independent build additionally required"}
|
|
dest=root/"Docs/QA/UE-Migration/core-boundary.json";dest.parent.mkdir(parents=True,exist_ok=True);dest.write_text(json.dumps(report,indent=2)+"\n",encoding="utf-8")
|
|
print(f"Boundary: {len(checked)} files, {len(failures)} violations")
|
|
sys.exit(bool(failures))
|