Documentation ¶
Overview ¶
Package buildsys implements a minimal build system based on Starlark for the task specification and mvdan.cc/sh for the shell runtime. The goal is to create a fairly simple and portable system that is nonetheless flexible enough to support multi-language projects.
Index ¶
- func RunTask(ctx context.Context, projectRoot, task string, tasks TaskList, ...) error
- func WithLogger(ctx context.Context, logger *zerolog.Logger) context.Context
- func WriteCache(file string, options map[string]string, list TaskList, scriptFiles []string) error
- type ScriptOption
- type StarlarkPath
- func (p StarlarkPath) CompareSameType(op starsyntax.Token, rawY starlark.Value, depth int) (bool, error)
- func (p StarlarkPath) Freeze()
- func (p StarlarkPath) Hash() (uint32, error)
- func (p StarlarkPath) Index(i int) starlark.Value
- func (p StarlarkPath) Len() int
- func (p StarlarkPath) Slice(start, end, step int) starlark.Value
- func (p StarlarkPath) String() string
- func (p StarlarkPath) Truth() starlark.Bool
- func (p StarlarkPath) Type() string
- type StarlarkShellArgs
- func (a StarlarkShellArgs) CompareSameType(op starsyntax.Token, y starlark.Value, depth int) (bool, error)
- func (a StarlarkShellArgs) Freeze()
- func (a StarlarkShellArgs) Hash() (uint32, error)
- func (a StarlarkShellArgs) Index(i int) starlark.Value
- func (a StarlarkShellArgs) Iterate() starlark.Iterator
- func (a StarlarkShellArgs) Len() int
- func (a StarlarkShellArgs) String() string
- func (a StarlarkShellArgs) Truth() starlark.Bool
- func (a StarlarkShellArgs) Type() string
- type StarlarkShellArgsIterator
- type Task
- type TaskCmd
- type TaskCmdScript
- type TaskCmdTaskRef
- type TaskList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunTask ¶
func RunTask(ctx context.Context, projectRoot, task string, tasks TaskList, dryRun, force bool) error
RunTask executes the given task
func WithLogger ¶
WithLogger attaches the given logger to the context
Types ¶
type ScriptOption ¶
func (ScriptOption) Default ¶
func (o ScriptOption) Default() string
type StarlarkPath ¶
type StarlarkPath string
func (StarlarkPath) CompareSameType ¶
func (p StarlarkPath) CompareSameType(op starsyntax.Token, rawY starlark.Value, depth int) (bool, error)
func (StarlarkPath) Freeze ¶
func (p StarlarkPath) Freeze()
func (StarlarkPath) Hash ¶
func (p StarlarkPath) Hash() (uint32, error)
func (StarlarkPath) Len ¶
func (p StarlarkPath) Len() int
func (StarlarkPath) String ¶
func (p StarlarkPath) String() string
func (StarlarkPath) Truth ¶
func (p StarlarkPath) Truth() starlark.Bool
func (StarlarkPath) Type ¶
func (p StarlarkPath) Type() string
type StarlarkShellArgs ¶
func (StarlarkShellArgs) CompareSameType ¶
func (a StarlarkShellArgs) CompareSameType(op starsyntax.Token, y starlark.Value, depth int) (bool, error)
Comparable
func (StarlarkShellArgs) Freeze ¶
func (a StarlarkShellArgs) Freeze()
func (StarlarkShellArgs) Hash ¶
func (a StarlarkShellArgs) Hash() (uint32, error)
func (StarlarkShellArgs) Iterate ¶
func (a StarlarkShellArgs) Iterate() starlark.Iterator
func (StarlarkShellArgs) String ¶
func (a StarlarkShellArgs) String() string
func (StarlarkShellArgs) Truth ¶
func (a StarlarkShellArgs) Truth() starlark.Bool
func (StarlarkShellArgs) Type ¶
func (a StarlarkShellArgs) Type() string
type StarlarkShellArgsIterator ¶
type StarlarkShellArgsIterator struct {
// contains filtered or unexported fields
}
Iterable
func (StarlarkShellArgsIterator) Done ¶
func (it StarlarkShellArgsIterator) Done()
type Task ¶
type Task struct { Env map[string]string Short string Desc string Base string Inputs []string Deps []string SkipIfExists []string Outputs []string Cmds []TaskCmd IgnoreExit bool Hidden bool }
Task contains the processed values passed to task() by the task script
func (*Task) Freeze ¶
func (t *Task) Freeze()
Freeze doesn't do anything since tasks are immutable anyway
func (*Task) Hash ¶
Hash always returns an error since task is not hashable It could be but I don't think implementing a hash over all contained values is worth it considering that the hash is only used by Starlake's dict type.
type TaskCmdScript ¶
func (TaskCmdScript) ToShellStmts ¶
func (TaskCmdScript) ToTask ¶
func (s TaskCmdScript) ToTask() (*Task, error)
type TaskCmdTaskRef ¶
type TaskCmdTaskRef struct {
Task *Task
}
func (TaskCmdTaskRef) ToShellStmts ¶
func (TaskCmdTaskRef) ToTask ¶
func (t TaskCmdTaskRef) ToTask() (*Task, error)
type TaskList ¶
TaskList maps short names to each relevant task
func RunScript ¶
func RunScript(ctx context.Context, filename, projectRoot string, options map[string]string, doConfigure bool) (TaskList, map[string]ScriptOption, []string, error)
RunScript executes a starlake scripts and returns the declared options. If doConfigure is true, the script's configure function is called and the declared tasks are collected and returned.