Documentation
¶
Overview ¶
Package toolchain provisions the build tools each chip needs: manifest assets (SHA-256 pinned, from a signed or built-in manifest), pinned SDK clones and vendor installers. It is chip-agnostic — each chip family registers a factory describing its Components; the drivers here check, install and repair any of them the same way.
Index ¶
- func BinDirs(h *Host, keys []string) []string
- func CacheRoot() string
- func Chips() []string
- func ExtractTarGz(archive, dest string) error
- func Platform() string
- func Root() string
- func SdkRoot() string
- func SettingInt(key string) int
- func Tilde(p string) string
- type Asset
- type Component
- type ComponentStatus
- type Emitter
- type Event
- type Host
- type IDF
- type Manifest
- type Status
- type Toolchain
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTarGz ¶
ExtractTarGz unpacks a .tar.gz into dest with extract's safety checks: entries must land in dest and links must point inside it.
func Platform ¶
func Platform() string
Platform is the manifest's platform key for this machine, or "" when toolchains are not provided for it.
func Root ¶
func Root() string
Root is where Volt-managed toolchains live. Repair never deletes outside it.
func SettingInt ¶
SettingInt reads a number from ~/.volt/settings.json (0 when unset).
Types ¶
type Asset ¶
type Asset struct {
Filename string `json:"filename"`
URL string `json:"url"`
Mirrors []string `json:"mirrors"`
Upstream string `json:"upstream"`
SHA256 string `json:"sha256"`
SizeBytes int64 `json:"size_bytes"`
Extract struct {
Format string `json:"format"`
StripComponents int `json:"strip_components"`
} `json:"extract"`
InstallTo string `json:"install_to"`
Exposes map[string]string `json:"exposes"`
Kind string `json:"kind"`
Version string `json:"version"`
}
Asset is one downloadable toolchain archive.
type Component ¶
Component is one installable piece of a toolchain. Install is nil when Volt cannot provide it; Check's Detail then says what the user must do.
type ComponentStatus ¶
ComponentStatus pairs a component with its state, for reporting.
type Emitter ¶
type Emitter struct {
// contains filtered or unexported fields
}
Emitter reports install progress as JSON lines or for a terminal. Log lines from tools (git, idf_tools.py, apt) are scanned for progress, as the IDE did.
func NewEmitter ¶
NewEmitter returns an Emitter writing to stdout.
func (*Emitter) StageError ¶
StageError ends the current stage with a failure.
func (*Emitter) StageStart ¶
StageStart begins stage id (a component), shown as name.
type Event ¶
type Event struct {
Type string `json:"type"` // stage_start, stage_done, stage_error, stage_progress, log, complete
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Message string `json:"message,omitempty"`
Percent *int `json:"percent,omitempty"`
Detail string `json:"detail,omitempty"`
Success *bool `json:"success,omitempty"`
}
Event is one install event. With --json each is printed as a line; the shapes match the IDE's toolchain:event IPC messages.
type IDF ¶
type IDF struct {
Path, ToolsPath string
Managed bool // Volt's own clone under Root()
Source string // where Path came from, for messages
}
IDF locates the ESP-IDF in use and where its tools live.
type Manifest ¶
type Manifest struct {
SchemaVersion int `json:"schema_version"`
ManifestVersion int64 `json:"manifest_version"`
Assets map[string]Asset `json:"assets"`
ChipRequirements map[string]map[string][]string `json:"chip_requirements"`
Signature string `json:"signature"`
}
Manifest lists the assets and which of them each chip needs per platform.
func LoadManifest ¶
LoadManifest returns the manifest and where it came from: a fresh verified cache, the network (only when online), a stale verified cache, or the embedded fallback, whichever is newest. Anything not embedded must carry a valid signature and be at or above the rollback floor.
func (*Manifest) Asset ¶
Asset looks key up, falling back to the embedded manifest for assets a published manifest predates.
func (*Manifest) Requirements ¶
Requirements returns the asset keys chip needs on platform.
type Status ¶
type Status struct {
OK bool `json:"ok"`
Detail string `json:"detail"` // version when OK, else what is wrong
Path string `json:"path,omitempty"`
}
Status is a component's current state.
type Toolchain ¶
type Toolchain struct {
Chip string
Name string // e.g. "ESP32"
Components []Component
// Managed lists what repair deletes. Every entry is under Root(); user
// provided installs are never listed.
Managed []string
// Notes are shown by status and repair (e.g. "using your ESP-IDF at …").
Notes []string
// BuildEnv returns the environment overrides the chip's build tools run
// with. Call it only once Status reports the toolchain ready.
BuildEnv func() ([]string, error)
}
Toolchain is everything needed to build for one chip on this host.
func For ¶
For returns chip's toolchain. online allows fetching a newer manifest (install does; status stays offline and fast).
func ForIDF ¶
ForIDF is the full ESP-IDF toolchain `volt sdk build` makes SDK packs with: an ESP-IDF tree and its tools (install.sh), with CMake, Ninja and Python from Volt's earlier managed installs or PATH. Users never need it. The IDF target equals the chip name.
func (*Toolchain) Install ¶
Install brings every component up to date, in order, stopping at the first failure. Each component is a stage in the event stream.
func (*Toolchain) Repair ¶
Repair deletes the managed state so the next install starts clean. It returns what it removed.
func (*Toolchain) Status ¶
func (t *Toolchain) Status() (all []ComponentStatus, ready bool)
Status checks every component.