sdkfiles

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sdkfiles ships the device library and framework inside the volt binary, so a plain install can build without the IDE. sdk/ is a copy of volt/devices and volt/framework, refreshed by scripts/release.sh.

~/.volt/sdk is the one live library everything reads and writes. A shipped SDK (this binary's, the IDE's, or the repo's via `volt sdk sync`) only updates it, and only on a new version or an explicit sync: a shipped library is added when missing and replaced only while the live copy is still what was last shipped. A library changed locally is reported, never overwritten, until the user takes the update or keeps theirs.

Index

Constants

View Source
const Record = ".shipped.json"

Record is <dir>/.shipped.json: each unit's digest as last shipped ("devices/<name>", "framework", "examples/devices"), "kept:<unit>" for a shipped version the user chose not to take, and "_owner" / "_version_<owner>": who keeps the library up to date and the version that last synced it.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b string) int

Compare orders release versions: -1, 0 or 1 (non-releases sort first).

func FS

func FS() fs.FS

FS is the built-in SDK tree (devices/, framework/).

func IsRelease

func IsRelease(v string) bool

isRelease reports whether v is a release version like v1.2.3 (not "dev").

func ReadRecord

func ReadRecord(dir string) map[string]string

ReadRecord loads dir's record (empty if none).

func Short

func Short(keys []string) string

Short drops the devices/ prefix from unit names, for messages.

func UnitName

func UnitName(s string) string

UnitName turns "hc05" into "devices/hc05" and "examples" into "examples/devices"; a unit's name is its path under the live library.

Types

type Options

type Options struct {
	Owner, Version string
	Take, Keep     []string
	DryRun         bool
}

Options steer a Sync. Take and Keep name units ("hc05" = "devices/hc05").

type Result

type Result struct {
	Added   []string `json:"added"`
	Updated []string `json:"updated"`
	Kept    []string `json:"kept"`
	Backup  string   `json:"backup,omitempty"`
	NewerBy string   `json:"newer_by,omitempty"` // a newer release keeps the library
}

Result is what a Sync did; Kept are units changed locally that it left.

func Ensure

func Ensure(dir, version string) (Result, error)

Ensure is the CLI's own upgrade path: when this binary's SDK is new and the library is the CLI's to keep (not a developer's), it syncs the embedded SDK. A release never downgrades: if a newer release already synced the library, an older volt leaves it (Result.NewerBy names that release). It never deletes anything; locally changed libraries come back in Kept.

func Sync

func Sync(src Source, dir string, o Options) (Result, error)

Sync brings dir up to date with src.

type Source

type Source struct {
	FS                           fs.FS
	Devices, Framework, Examples string
}

Source is a shipped SDK: the devices, framework and examples trees in FS.

func Embedded

func Embedded() Source

Embedded is this binary's SDK.

func FromDir

func FromDir(dir string) Source

FromDir reads a shipped SDK from disk, e.g. the repo's volt/ folder.

Jump to

Keyboard shortcuts

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