runner

package
v0.1.6-alpha Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package runner is the single entrypoint for executing a compile through hpcc. Both invocation paths — the cobra subcommand `hpcc wrap` and the symlink-as-compiler shim in main — call into Run, so the cache loop, dispatch logic, and error handling live in exactly one place.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadStores

func LoadStores() ([]store.Store, error)

LoadStores loads the config and returns the configured cache stores. Unlike NewContext, this does not require a compiler name — it is used by cache-management commands (stats, clean) that operate on stores directly.

func NewContext

func NewContext(compilerName string) (*compiler.Context, error)

NewContext detects the requested compiler, loads the config (from the path in HPCC_CONFIG, or the default user-config-dir location), wires up the configured cache stores behind a CompileCache facade, and returns a ready-to-use Context.

A missing config file is fine — defaults apply. A malformed one is surfaced as an error so a typo isn't silently ignored.

This lives in the runner package, not compiler, because constructing a cache.CompileCache requires importing the cache package, which itself depends on compiler types — putting NewContext in compiler would form an import cycle.

func Run

func Run(ctx *compiler.Context, args []string) error

Run executes a single compiler invocation. The args here are the compiler-side argv (without the compiler name itself) — what the user would have passed to gcc/clang/cl directly.

If a daemon is running, the request is forwarded to it: the daemon owns the cache loop and the actual compiler invocation, and we just relay stdout/stderr/exit. Otherwise we fall back to running the cache lookup and the compiler in-process.

One exception: invocations that read source from stdin (`-` or `/dev/stdin` as an input) must run in-process even when the daemon is up. The compile protocol carries argv but not stdin bytes, so a daemon-dispatched stdin compile would silently see EOF. The most common caller is the Linux kernel's scripts/cc-version.sh probe.

Types

This section is empty.

Jump to

Keyboard shortcuts

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