build

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package build orchestrates the pinned Rust, Binaryen, and wasm2go toolchain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportSet

func ExportSet(m *manifest.Manifest) map[string]wasmbin.Type

ExportSet derives the exact ABI export signatures from a validated manifest.

func Features

func Features() []string

Features enables the supported synchronous Rust instruction subset.

func FindModule

func FindModule(directory string) (string, error)

FindModule locates the Go module that declares the pinned translator tool.

func RustcWrapper

func RustcWrapper(ctx context.Context, args []string, stdout, stderr io.Writer) error

RustcWrapper executes Cargo's compiler with location-independent crate IDs. Cargo hashes absolute paths for crates outside the workspace, even when rustc remaps source paths. Keep its output filenames, but normalize symbol metadata.

func Verify

func Verify(m *manifest.Manifest, data []byte) (*wasmbin.Module, error)

Verify checks imports, exports, exact signatures, memory policy, and feature metadata. It complements Binaryen's instruction and initializer validation.

Types

type ExecRunner

type ExecRunner struct{ Environment []string }

ExecRunner executes trusted tool names with bounded output and no shell expansion.

func (ExecRunner) Run

func (r ExecRunner) Run(ctx context.Context, directory, program string, args ...string) ([]byte, error)

Run invokes a tool in a specific directory and retains at most one MiB of diagnostics.

type Lock

type Lock struct {
	Tools        ToolVersions `json:"tools"`
	Schema       string       `json:"schema_sha256"`
	Manifest     string       `json:"manifest_sha256"`
	Cargo        string       `json:"cargo_lock_sha256"`
	Rust         string       `json:"shim_sha256"`
	Wasm         string       `json:"wasm_sha256"`
	Go           string       `json:"go_sha256"`
	Facade       string       `json:"facade_sha256"`
	Adapter      string       `json:"adapter_sha256"`
	Contracts    string       `json:"contract_tests_sha256"`
	Differential string       `json:"differential_tests_sha256"`
	Bulk         string       `json:"bulk_tests_sha256"`
	Sources      []SourceHash `json:"sources"`
}

Lock records deterministic tool, source, and artifact identities.

func Project

func Project(ctx context.Context, directory string, m *manifest.Manifest) (*Lock, error)

Project builds a locked shim, validates and translates it, and records provenance.

type Runner

type Runner interface {
	Run(ctx context.Context, directory, program string, args ...string) ([]byte, error)
}

Runner is injectable so toolchain checks can be tested without launching tools.

type SourceHash

type SourceHash struct {
	Name     string `json:"name"`
	Revision string `json:"revision,omitempty"`
	SHA256   string `json:"sha256"`
}

SourceHash identifies a local source tree without leaking build-machine paths.

type ToolVersions

type ToolVersions struct {
	BinaryenDigests  map[string]string `json:"binaryen_executable_sha256,omitempty"`
	CompilerMetadata string            `json:"compiler_metadata_sha256"`
	Rust             string            `json:"rust"`
	Binaryen         string            `json:"binaryen"`
	Wasm2Go          string            `json:"wasm2go"`
}

ToolVersions records checked version identities without absolute paths or timestamps.

func Doctor

func Doctor(ctx context.Context, runner Runner, directory string, pins manifest.Toolchain) (ToolVersions, error)

Doctor verifies every pinned executable and the required Rust target components.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL