Files
Heimdall/scripts/ci/build-plan.py
T

34 lines
1.0 KiB
Python
Raw Normal View History

2026-11-09 16:16:41 +01:00
#!/usr/bin/env python3
"""Build only the projects selected by test-plan.py after solution restore."""
import json
from pathlib import Path
import subprocess
ROOT = Path(__file__).resolve().parents[2]
PLAN = ROOT / "artifacts" / "tests" / "plan.json"
def main() -> None:
plan = json.loads(PLAN.read_text())
targets = plan.get("build_projects")
if not isinstance(targets, list) or any(not isinstance(target, str) for target in targets):
raise SystemExit("Test plan has an invalid build_projects list")
if not targets:
print("No .NET build targets selected")
return
for target in targets:
path = ROOT / target
if not path.is_file():
raise SystemExit(f"Build target does not exist: {target}")
print(f"Building affected target: {target}", flush=True)
subprocess.run(
["dotnet", "build", target, "-c", "Release", "--no-restore", "-m:2"],
cwd=ROOT,
check=True,
)
if __name__ == "__main__":
main()