The JIT that runs makepad apps from source: lexer, front end, type checker, lazy borrow checker (Gandalf; `--check-first` opts in), codegen, session and warm/cold caches keyed by compiler stamp, provided crates bound late, startup images, live patching. User-facing name is `makepad run` (binary `makepad`, MAKEPAD_RUN_* env, ~/.makepad-run); libs/relax stays the internal library name. `makepad check` reports rustc-style diagnostics with rustc error codes and checks a whole workspace (`--workspace`). Runs on macOS, Linux, Windows and Android. makepad-remote: one tool schema for apps and the WM (app/1): grabs, captures, traces, frame profiles and tweaks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
38 lines
1.7 KiB
Python
38 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Compare included proc-macro spans with rustc: run.py --makepad /path/to/makepad.
|
|
|
|
Only local fixture crates are built. Cargo inherits the caller's target directory.
|
|
"""
|
|
import argparse
|
|
import os
|
|
from pathlib import Path
|
|
import subprocess
|
|
import tempfile
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--makepad", required=True)
|
|
args = parser.parse_args()
|
|
here = Path(__file__).resolve().parent
|
|
relax = str(Path(args.makepad).resolve())
|
|
env = dict(os.environ, CARGO_NET_OFFLINE="true", CARGO_INCREMENTAL="0", MAKEPAD_RUN_OFFLINE="1",
|
|
MAKEPAD_RUN_CACHE="off", MAKEPAD_RUN_STD=str(here.parent.parent / "std"))
|
|
|
|
def run(command, **kwargs):
|
|
result = subprocess.run(command, cwd=here, env=env, text=True, capture_output=True, **kwargs)
|
|
if result.returncode:
|
|
raise RuntimeError(f"{command}: exit {result.returncode}\n{result.stdout}\n{result.stderr}")
|
|
return result.stdout
|
|
|
|
with tempfile.TemporaryDirectory(prefix="include-spans-") as tmp:
|
|
env["MAKEPAD_RUN_HOME"] = tmp + "/home"
|
|
env["MAKEPAD_RUN_CACHE_DIR"] = tmp + "/cache"
|
|
env.setdefault("CARGO_TARGET_DIR", tmp + "/target")
|
|
run(["nice", "-n", "10", "cargo", "build", "--release", "--offline", "-j", "4", "-p", "include-spans-app"])
|
|
expected = run([str(Path(env["CARGO_TARGET_DIR"]) / "release" / "include-spans-app")])
|
|
for mode in ["uncached", "cold", "warm"]:
|
|
env["MAKEPAD_RUN_CACHE"] = "off" if mode == "uncached" else "on"
|
|
actual = run(["nice", "-n", "10", relax, "run", "--quiet", "include-spans-app"])
|
|
if actual != expected:
|
|
raise AssertionError(f"{mode}: rustc:\n{expected}\nRelax:\n{actual}")
|
|
print(f"include_spans: {mode} matches rustc")
|
|
print(actual, end="")
|