Repository navigation
Support guest toolchain selection - #83
simongdavies wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-platform toolchain switching needs human validation, with unresolved executable-selection and credential-exposure issues.
2 open issues
What changed in this PR
Adds explicit guest Rust toolchain selection for library callers, allowing host and guest builds to use different compilers.
Changes:
- Parses toolchain files and applies selected compiler executables.
- Requires preinstalled guest toolchains and Rust sources.
- Adds documentation, tests, and cross-platform CI coverage.
| File | Description |
|---|---|
| tests/toolchain_file.rs | Tests selection errors and cross-version builds. |
| src/toolchain.rs | Uses effective Cargo for preparation. |
| src/sysroot.rs | Uses selected tools and checks Rust sources. |
| src/lib.rs | Controls source installation during preparation. |
| src/command.rs | Adds the toolchain selection API. |
| src/cli.rs | Uses effective Cargo for configuration queries. |
| src/cargo_cmd.rs | Parses toolchain files and resolves executables. |
| README.md | Documents guest toolchain selection. |
| Cargo.toml | Adds TOML parsing dependency. |
| Cargo.lock | Locks new dependencies. |
| .github/workflows/ci.yml | Adds Linux and Windows toolchain-selection tests. |
Review effort: Balanced
8f4696d to
ecd1f48
Compare
Select installed Cargo and Rust tools consistently for guest preparation and compilation without changing the host process environment or installing components. Document the API and cover newer-host/older-guest builds. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 63d06f38-d356-4418-aa31-2473e0f87584 Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 63d06f38-d356-4418-aa31-2473e0f87584 Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Use the same Cargo executable for preparation and the guest command, with explicit toolchain selection taking precedence over CARGO overrides. Keep inherited credentials out of printable command overrides while preserving environment inheritance and clearing behavior. Add regression tests for executable selection and credential-free debug and failure diagnostics. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 63d06f38-d356-4418-aa31-2473e0f87584 Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
ecd1f48 to
d153d07
Compare
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
ludfjig
left a comment
There was a problem hiding this comment.
lgtm but AI found this, up to you if you want to address
-
rust_src_install_commandcopies the full environment into command overrides. On failure,checked_outputprints those values, including registry tokens. Report the program, arguments, status, and stderr without environment values. Add a failing-install test with a dummy inherited token. -
GuestToolchain::from_fileuses the parent environment except forRUSTUP_AUTO_INSTALL. A builder-selectedRUSTUP_HOMEorPATHtherefore has no effect on selection. Pass the resolved environment into this helper, use its PATH to find Rustup, and apply it to every Rustup subprocess. -
get_programlooks up uppercaseCARGOonly, so.env("cargo", guest_cargo)selects the wrong executable on Windows. Useenv_keys_equalfor lookup and replacement. Useget_env_valuefor the Cargo andRUSTUP_TOOLCHAINreads in preparation too. -
toolchain_filerunsrustup toolchain installeven for installed toolchains. This can update moving channels and Rustup itself during a build. Add--no-updateand--no-self-update. SetRUSTUP_AUTO_INSTALL=0before selection in the credential-diagnostic test.

This pull request introduces support for selecting and using an explicit guest Rust toolchain (via a
rust-toolchain.tomlfile) when running cargo-hyperlight as a library, allowing the guest build to use a different toolchain than the host. This is required for hyperlight-js to be able to build a guest runtime with a different rust version that the host,