diff options
| -rw-r--r-- | rola-devtools/scripts/build.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/rola-devtools/scripts/build.py b/rola-devtools/scripts/build.py index cd2ddf1..c63ca23 100644 --- a/rola-devtools/scripts/build.py +++ b/rola-devtools/scripts/build.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import shutil import subprocess import sys from pathlib import Path @@ -7,6 +8,14 @@ from pathlib import Path script_dir = Path(__file__).resolve().parent root_dir = script_dir.parent.parent + +def get_exe_names(): + """Return the list of executable file names to copy (with or without .exe suffix).""" + return [ + "rola", + ] + + steps = [ ("cargo check --workspace", [ "cargo", "check", "--workspace", @@ -35,4 +44,31 @@ for label, cmd in steps: break print(f" [SUCCESS] Passed", flush=True) +if ok: + print(f"\nSTEP - \"Copy executables to .temp/bin\": ", flush=True) + src_dir = root_dir / ".temp" / "target" / "release" + dst_dir = root_dir / ".temp" / "bin" + dst_dir.mkdir(parents=True, exist_ok=True) + all_ok = True + for exe_name in get_exe_names(): + candidates = [] + for suffix in ("", ".exe"): + p = src_dir / f"{exe_name}{suffix}" + if p.is_file(): + candidates.append(p) + if not candidates: + print(f" [FAILED] Executable '{exe_name}' not found in {src_dir}", flush=True) + all_ok = False + continue + for p in candidates: + dst_path = dst_dir / p.name + try: + shutil.copy2(p, dst_path) + print(f" [SUCCESS] Copied {p.name} -> {dst_path}", flush=True) + except Exception as e: + print(f" [FAILED] Failed to copy {p.name}: {e}", flush=True) + all_ok = False + if not all_ok: + ok = False + sys.exit(0 if ok else 1) |
