buildsys

package
v0.0.0-...-94e6d93 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

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

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

func WithLogger(ctx context.Context, logger *zerolog.Logger) context.Context

WithLogger attaches the given logger to the context

func WriteCache

func WriteCache(file string, options map[string]string, list TaskList, scriptFiles []string) error

Types

type ScriptOption

type ScriptOption struct {
	DefaultValue starlark.String
	Help         string
}

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) Index

func (p StarlarkPath) Index(i int) starlark.Value

func (StarlarkPath) Len

func (p StarlarkPath) Len() int

func (StarlarkPath) Slice

func (p StarlarkPath) Slice(start, end, step int) starlark.Value

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

type StarlarkShellArgs []*syntax.Word

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) Index

func (a StarlarkShellArgs) Index(i int) starlark.Value

func (StarlarkShellArgs) Iterate

func (a StarlarkShellArgs) Iterate() starlark.Iterator

func (StarlarkShellArgs) Len

func (a StarlarkShellArgs) Len() int

Indexable

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()

func (*StarlarkShellArgsIterator) Next

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

func (t *Task) Hash() (uint32, error)

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.

func (*Task) String

func (t *Task) String() string

String returns a string representation of the task

func (*Task) Truth

func (t *Task) Truth() starlark.Bool

Truth always returns true since a task can't be nil or None

func (*Task) Type

func (t *Task) Type() string

Type always returns "task" to indicate this type

type TaskCmd

type TaskCmd interface {
	ToTask() (*Task, error)
	ToShellStmts(*syntax.Parser) ([]*syntax.Stmt, error)
}

type TaskCmdScript

type TaskCmdScript struct {
	TaskName string
	Content  string
	Index    int
}

func (TaskCmdScript) ToShellStmts

func (s TaskCmdScript) ToShellStmts(parser *syntax.Parser) ([]*syntax.Stmt, error)

func (TaskCmdScript) ToTask

func (s TaskCmdScript) ToTask() (*Task, error)

type TaskCmdTaskRef

type TaskCmdTaskRef struct {
	Task *Task
}

func (TaskCmdTaskRef) ToShellStmts

func (t TaskCmdTaskRef) ToShellStmts(*syntax.Parser) ([]*syntax.Stmt, error)

func (TaskCmdTaskRef) ToTask

func (t TaskCmdTaskRef) ToTask() (*Task, error)

type TaskList

type TaskList map[string]*Task

TaskList maps short names to each relevant task

func ReadCache

func ReadCache(file string) (map[string]string, TaskList, []string, error)

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.

Directories

Path Synopsis
Package main implements a simple CLI for the buildsys package
Package main implements a simple CLI for the buildsys package

Jump to

Keyboard shortcuts

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