EHLS.Build (Elixir HLS v0.1.0)

Copy Markdown View Source

A build that knows what changed: a target's steps (EHLS.Target.steps/1) run in order, each only when its inputs changed since it last ran, or an output is missing.

A step's inputs are files (globs, relative to the application's directory or absolute) and values (options it is built with); their hash is kept in build/.ehls/<step>.sha256 once the step succeeds. A later step's inputs are often an earlier one's outputs, so a change runs only what it reaches: a change of the CPU's code remakes the circuits' files the same as before, and the SoC after them does not run again.

Summary

Types

A step: its name, what it does (for the messages), its inputs (inputs: globs, exclude: regexes on their paths, values: any term), the files it makes (outputs:), the machine's settings it needs (needs:, checked before it runs) and the function that runs it.

Functions

Runs a command for a step, its output shown as it comes; raises when it fails. Options: cd:, env: (a list of {name, value}).

The hash of a step's inputs (files and values).

Why a step has to run, or nil when it is up to date.

Runs the steps that need it. Options: only: (step names: those alone), force: (run them whatever changed), dry_run: (say what would run, run nothing). Returns the names of the steps run (or that would run).

Types

step()

@type step() :: %{
  :name => atom(),
  :run => (-> any()),
  optional(:doc) => String.t(),
  optional(:inputs) => [String.t()],
  optional(:exclude) => [Regex.t()],
  optional(:values) => term(),
  optional(:outputs) => [Path.t()],
  optional(:needs) => [atom()]
}

A step: its name, what it does (for the messages), its inputs (inputs: globs, exclude: regexes on their paths, values: any term), the files it makes (outputs:), the machine's settings it needs (needs:, checked before it runs) and the function that runs it.

Functions

cmd!(command, args, opts \\ [])

Runs a command for a step, its output shown as it comes; raises when it fails. Options: cd:, env: (a list of {name, value}).

hash(project, s)

The hash of a step's inputs (files and values).

reason(project, s, opts \\ [])

Why a step has to run, or nil when it is up to date.

run(project, steps, opts \\ [])

Runs the steps that need it. Options: only: (step names: those alone), force: (run them whatever changed), dry_run: (say what would run, run nothing). Returns the names of the steps run (or that would run).