Skip to content

feat(rust-sdk): auto-install rustup targets on target=; update hm init template + docstrings#146

Merged
markovejnovic merged 6 commits into
mainfrom
feat/rust-cross-compile-and-docs
Jun 12, 2026
Merged

feat(rust-sdk): auto-install rustup targets on target=; update hm init template + docstrings#146
markovejnovic merged 6 commits into
mainfrom
feat/rust-cross-compile-and-docs

Conversation

@markovejnovic

Copy link
Copy Markdown
Contributor

Cross-compile, made trivial

Passing target=<triple> to any compiling method (build/test/doctest/clippy/doc) now auto-prepends rustup target add <triple> && to the emitted command, so cross builds work without the manual rustup dance:

project = hm.rust.project(path=".")
return (project.build(), project.build(target="wasm32-unknown-unknown"), project.test(), project.clippy(), project.fmt())

build(target="wasm32-unknown-unknown") emits … && rustup target add wasm32-unknown-unknown && cargo build --target wasm32-unknown-unknown --locked. Opt out with add_target=False (TS: addTarget: false) for runner images that pre-bake targets.

The install lands in the compiling leaf (idempotent) because steps fork from the warmup snapshot, which only has the host target — so the target must be present at/above the consuming step. fmt is untouched (it doesn't compile and takes no target=). Target values are shell-quoted. Python + TS at parity; golden parity test updated.

Neglected follow-ups from #143

  • hm init Rust template now scaffolds rust.project().ci() (not the legacy toolchain() + explicit steps). Init test strengthened to assert the new API.
  • Docstrings added to every RustToolchain/RustProject action method, so the auto-generated pipeline-SDK reference docs describe the real surface (incl. the new target= auto-install).
  • CLAUDE.md now states the doctrine: a toolchain change must update the hm init template and regenerate the docs in the same change.

The regenerated rust.mdx lives in the simci (parent) repo and is committed there with the gitlink bump.

Tests

  • Python: 554 passed, ruff + mypy clean. New: per-method auto-install + opt-out + quoting + nextest/doctest paths; parity golden updated.
  • TypeScript: 411 passed, tsc + build clean. Mirror tests + parity golden.
  • Rust: 24 cmd_init tests pass (incl. roundtrip render of the new template).

@markovejnovic markovejnovic merged commit 5eb3b30 into main Jun 12, 2026
16 of 17 checks passed
@markovejnovic markovejnovic deleted the feat/rust-cross-compile-and-docs branch June 12, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant