Windows build: patches and the fork keep LF, packer rebuilt when the fork changes; install notes
build / mod (push) Successful in 3m52s
build / mod (push) Successful in 3m52s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+11
-5
@@ -71,7 +71,8 @@ def fork():
|
||||
stamp = fork_stamp(commit, patches)
|
||||
stamp_file = FORK / ".git" / "airdef-stamp"
|
||||
if not (FORK / ".git").exists():
|
||||
run(["git", "clone", "--filter=blob:none", UPSTREAM, FORK])
|
||||
# Без CRLF на Windows: патчи накладываются на файлы как в апстриме.
|
||||
run(["git", "clone", "-c", "core.autocrlf=false", "--filter=blob:none", UPSTREAM, FORK])
|
||||
branch = subprocess.run(["git", "-C", FORK, "branch", "--show-current"], capture_output=True, text=True).stdout.strip()
|
||||
if branch == "airdef" and stamp_file.exists() and stamp_file.read_text().strip() == stamp:
|
||||
print("horizon/: ветка airdef на нужных коммите и патчах")
|
||||
@@ -110,11 +111,16 @@ def built_game() -> Path:
|
||||
|
||||
def mod():
|
||||
tool = shutil.which("cargo-horizon-mod") or Path.home() / ".cargo" / "bin" / ("cargo-horizon-mod" + EXE)
|
||||
if not Path(tool).exists():
|
||||
if not (FORK / "Cargo.toml").exists():
|
||||
fork()
|
||||
if not (FORK / "Cargo.toml").exists():
|
||||
fork()
|
||||
# Упаковщик должен быть от этого форка: старый не знает новых уровней API.
|
||||
stamp_file = FORK / ".git" / "airdef-packer-stamp"
|
||||
commit = (ROOT / "HORIZON_COMMIT").read_text().strip()
|
||||
stamp = fork_stamp(commit, sorted((ROOT / "horizon-patches").glob("*.patch")))
|
||||
if not Path(tool).exists() or not stamp_file.exists() or stamp_file.read_text().strip() != stamp:
|
||||
# Without trial runs (wasmtime): building a mod needs only packing, a fraction of the compile.
|
||||
run([cargo(), "install", "--locked", "--no-default-features", "--path", FORK / "crates" / "cargo-horizon-mod"])
|
||||
run([cargo(), "install", "--locked", "--force", "--no-default-features", "--path", FORK / "crates" / "cargo-horizon-mod"])
|
||||
stamp_file.write_text(stamp + "\n")
|
||||
run([cargo(), "horizon-mod", "build"], cwd=ROOT / "airdef-mod")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user