[PR #3179] [MERGED] Launcher: a portable Rust toolchain of its own, for native mods #4833

Closed
opened 2026-11-03 05:08:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3179
Author: @ludovic111
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-rust-toolchain


📝 Commits (1)

  • d308df6 Launcher: a portable Rust toolchain of its own, for native mods

📊 Changes

5 files changed (+509 additions, -3 deletions)

View changed files

📝 docs/launcher-commands.md (+24 -0)
📝 launcher/src/backend.rs (+12 -3)
📝 launcher/src/cli.rs (+65 -0)
📝 launcher/src/lib.rs (+1 -0)
➕ launcher/src/rust_toolchain.rs (+407 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

First step of native mods in the launcher (levzzz5154, 2026-10-27/28: "the launcher needs to download a portable rust toolchain, we have to have many native mods per build"). Native mods are horizon-mixins bundles that change the game's source, so the player's computer compiles the game, and the launcher brings the compiler.

What it does

  • launcher/src/rust_toolchain.rs: Rust 1.99.1 (the stable release; CI builds the game on stable; horizon-mixins needs ≥ 1.95). For each platform the launcher ships on, only the official components a build needs: rustc, cargo, rust-std, and on Windows rust-mingw. Windows uses the x86_64-pc-windows-gnu host, which brings its own linker, so no Visual Studio is needed.
  • Every archive is pinned by the SHA-256 from channel-rust-1.99.1.toml and checked before unpacking. The archives go into <launcher data>/rust/1.99.1-<target>/ the way their installer lays them out, with an atomic rename at the end.
  • Toolchain::command runs cargo with RUSTC set to this toolchain, CARGO_HOME set to <launcher data>/cargo, and the bin folder first on PATH. It removes RUSTUP_TOOLCHAIN, the rustc wrappers and CARGO_TARGET_DIR. There is no rustup, nothing goes on the system, and the player's own Rust is never used or changed.
  • linker(): macOS needs the Command Line Tools. The check uses xcode-select -p and never runs cc, which would open Apple's install dialog. Linux needs cc. The launcher tells the player what to install and never installs it.
  • CLI: horizon-launcher rust status|install|remove (docs/launcher-commands.md regenerated).
  • backend::download takes the server's Content-Length when no size is known, for the progress.

The next PR (native builds) uses this toolchain to run horizon-mixins and compile the modded game.

Proof

  • Real run on the Mac mini with isolated HORIZON_HOME, HORIZON_LAUNCHER_HOME, XDG_DATA_HOME, XDG_CONFIG_HOME, HORIZON_LAUNCHER_NO_SELF_UPDATE=1, HORIZON_NO_AUDIO=1, HORIZON_LAUNCHER_TRASH and HORIZON_LAUNCHER_CLIPBOARD:
    • rust install: 58 s, 453 MB on disk;
    • rust status --json: rustc 1.99.1 (58cf8f9c3 2026-10-13), linker ok;
    • that cargo alone, with PATH reduced to /usr/bin:/bin, created a crate with a crates.io dependency, then built it, linked it and ran it.
  • Unit tests: the pins are complete and Windows is -gnu with rust-mingw; archive paths are mapped and .. or absolute paths are refused; a component archive unpacks as its installer would and keeps the executable bit; the command's environment is checked.
  • Linux and Windows: the archives are pinned the same way, but I could not run them on those systems here (Mac mini only). The Windows -gnu build of the game is still unproven.
pr_ready --quick

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 564162a0b, 2 min 18 s)

Check Result
Scope ✅ 5 files, +509 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 398 passed (54 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (58 s)
launcher tests ✅ 209 passed (24 s)
Parity ➖ 1 affected, to run in CI (--quick): lan_integration
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3179 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-rust-toolchain` --- ### 📝 Commits (1) - [`d308df6`](https://github.com/horizon-rust/horizon/commit/d308df616753fcc833069a57ba126cd0caf4a97c) Launcher: a portable Rust toolchain of its own, for native mods ### 📊 Changes **5 files changed** (+509 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/launcher-commands.md` (+24 -0) 📝 `launcher/src/backend.rs` (+12 -3) 📝 `launcher/src/cli.rs` (+65 -0) 📝 `launcher/src/lib.rs` (+1 -0) ➕ `launcher/src/rust_toolchain.rs` (+407 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. First step of native mods in the launcher (levzzz5154, 2026-10-27/28: "the launcher needs to download a portable rust toolchain, we have to have many native mods per build"). Native mods are horizon-mixins bundles that change the game's source, so the player's computer compiles the game, and the launcher brings the compiler. ## What it does - `launcher/src/rust_toolchain.rs`: Rust **1.99.1** (the stable release; CI builds the game on stable; horizon-mixins needs ≥ 1.95). For each platform the launcher ships on, only the official components a build needs: `rustc`, `cargo`, `rust-std`, and on Windows `rust-mingw`. Windows uses the `x86_64-pc-windows-gnu` host, which brings its own linker, so no Visual Studio is needed. - Every archive is pinned by the SHA-256 from `channel-rust-1.99.1.toml` and checked before unpacking. The archives go into `<launcher data>/rust/1.99.1-<target>/` the way their installer lays them out, with an atomic rename at the end. - `Toolchain::command` runs cargo with `RUSTC` set to this toolchain, `CARGO_HOME` set to `<launcher data>/cargo`, and the bin folder first on PATH. It removes `RUSTUP_TOOLCHAIN`, the rustc wrappers and `CARGO_TARGET_DIR`. There is no rustup, nothing goes on the system, and the player's own Rust is never used or changed. - `linker()`: macOS needs the Command Line Tools. The check uses `xcode-select -p` and never runs `cc`, which would open Apple's install dialog. Linux needs `cc`. The launcher tells the player what to install and never installs it. - CLI: `horizon-launcher rust status|install|remove` (docs/launcher-commands.md regenerated). - `backend::download` takes the server's Content-Length when no size is known, for the progress. The next PR (native builds) uses this toolchain to run horizon-mixins and compile the modded game. ## Proof - Real run on the Mac mini with isolated `HORIZON_HOME`, `HORIZON_LAUNCHER_HOME`, `XDG_DATA_HOME`, `XDG_CONFIG_HOME`, `HORIZON_LAUNCHER_NO_SELF_UPDATE=1`, `HORIZON_NO_AUDIO=1`, `HORIZON_LAUNCHER_TRASH` and `HORIZON_LAUNCHER_CLIPBOARD`: - `rust install`: 58 s, 453 MB on disk; - `rust status --json`: `rustc 1.99.1 (58cf8f9c3 2026-10-13)`, linker ok; - that cargo alone, with PATH reduced to `/usr/bin:/bin`, created a crate with a crates.io dependency, then built it, linked it and ran it. - Unit tests: the pins are complete and Windows is `-gnu` with `rust-mingw`; archive paths are mapped and `..` or absolute paths are refused; a component archive unpacks as its installer would and keeps the executable bit; the command's environment is checked. - Linux and Windows: the archives are pinned the same way, but I could not run them on those systems here (Mac mini only). The Windows `-gnu` build of the game is still unproven. <details><summary>pr_ready --quick</summary> **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 564162a0b, 2 min 18 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +509 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 398 passed (54 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (58 s) | | launcher tests | ✅ 209 passed (24 s) | | Parity | ➖ 1 affected, to run in CI (--quick): lan_integration | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:17 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4833
No description provided.