Skip to main content

Module dist

Module dist 

Source
Expand description

The deterministic cargo-dist config generator (issue release-engine-dist-config-generator).

Renders a downstream project’s dist-workspace.toml from the contract’s Distribution block — the deterministic half of ossctl dist generate. The ossctl-cli handler writes the rendered text to the repo root and then invokes dist generate (the cargo-dist tool) to produce the tag-triggered .github/workflows/release.yml from it; this module never shells out and never touches the filesystem, so it is a pure, fully unit-testable function.

§What maps where (the contract → cargo-dist mapping)

The mapping is the binding cross-platform default documented in the /oss-release skill and AGENTS.md (“Cross-platform is a hard requirement — macOS AND Linux”):

  • distribution.platforms[dist] targets. Copied verbatim (Rust target-triple syntax). The normalizer guarantees the set is non-empty and defaults an omitted platforms to the cross-platform macOS + Linux-musl set (DEFAULT_CROSS_PLATFORM_TARGETS), so a repo that never thinks about platforms still ships Linux binaries. This generator NEVER narrows the set — a macOS-only matrix is a release gap.
  • distribution.installers[dist] installers. Mapped through, with two deliberate rules that mirror ossctl’s own dist-workspace.toml:
    1. shell is always ensured, so the generated curl-installer covers the Unix side (macOS AND Linux) even when the contract omitted it; and
    2. homebrew is EXCLUDED from cargo-dist’s installer set — ossctl publishes the Homebrew formula through its own tap adapter (post-tag, needing the tarball sha256 that only exists after the release), exactly as the reference config does (“Homebrew auto-publish is deliberately NOT enabled here”). The tap itself is threaded elsewhere (distribution.homebrew_tap in crate::release::plan).

The rest of the [dist] table is the fixed reference shape: a pinned PINNED_CARGO_DIST_VERSION, ci = "github", hosting = "github", github-attestations = true, and pr-run-mode = "skip" (tag-triggered only). The personal [dist.github-custom-runners] override in ossctl’s own config is repo-local infra and is deliberately NOT emitted for downstream projects.

Determinism: the output is a pure function of the Distribution — no clock, no environment, no map iteration — so the same block always renders the same bytes (proven in tests).

Structs§

GeneratedDistConfig
The result of rendering a dist-workspace.toml from a Distribution.

Constants§

PINNED_CARGO_DIST_VERSION
The cargo-dist version pinned into every generated dist-workspace.toml, so a regenerated workflow and a locally-installed dist stay in lockstep. Kept in step with ossctl’s own reference dist-workspace.toml at the repo root.

Functions§

generate
Render a dist-workspace.toml from a normalized Distribution block.