yabs

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

README

yabs

GitHub Workflow Status Apache-2.0 license Go Report Card Releases

[y]et [a]nother [b]uild [s]ystem

a build system, configurable in risor, a go-like scripting language

Installation

go install github.com/jakegut/yabs/cmd/yabs@latest

Usage

Make a build.yb file at the root of your project with the logic for your builds

register('hello', [], func(bc) {
    sh("echo 'hello world!'")
})
> yabs hello
2023/08/11 20:22:12 running "hello"
hello world!

View examples

Design

Goals
  • Composable, write Go for targets, rules
  • Distribute yabs as a binary, not as a module
  • Build ~15 projects efficiently
  • Replace make
  • Run in CI and locally
Non-goals
  • Build millions+ LoC

Documentation

Index

Constants

View Source
const POOL_SIZE = 5

Variables

This section is empty.

Functions

func Fs

func Fs(y *Yabs, name string, globs []string, exclude []string) string

Types

type BuildCtx

type BuildCtx struct {
	// Run func(name string, args ...string) *RunConfig
	Out string
	Dep map[string]string
}

func NewBuildCtx

func NewBuildCtx(out string) BuildCtx

func (*BuildCtx) GetDep

func (bc *BuildCtx) GetDep(name string) string

func (BuildCtx) Run

func (BuildCtx) Run(name string, args ...string) *RunConfig

type BuildCtxFunc

type BuildCtxFunc func(BuildCtx)

type OutType

type OutType int
const (
	None OutType = iota
	File
	Dir
)

type RunConfig

type RunConfig struct {
	Cmd []string
	// contains filtered or unexported fields
}

func (*RunConfig) Exec

func (r *RunConfig) Exec() error

func (*RunConfig) StdoutToFile

func (r *RunConfig) StdoutToFile(file string) *RunConfig

func (*RunConfig) WithEnv

func (r *RunConfig) WithEnv(key, value string) *RunConfig

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

func NewScheduler

func NewScheduler() *Scheduler

func (*Scheduler) Schedule

func (s *Scheduler) Schedule(t *Task) chan *Task

func (*Scheduler) Start

func (s *Scheduler) Start()

type Task

type Task struct {
	Name     string
	Fn       BuildCtxFunc
	Dep      []string
	Out      string
	Checksum string
	Dirty    bool
	Time     int64
}

type TaskRecord

type TaskRecord struct {
	Name     string
	Checksum string
	Deps     []string
	Time     int64
}

type Yabs

type Yabs struct {
	// contains filtered or unexported fields
}

func New

func New() *Yabs

func (*Yabs) ExecWithDefault

func (y *Yabs) ExecWithDefault(def string) error

func (*Yabs) GetTaskNames

func (y *Yabs) GetTaskNames() []string

func (*Yabs) Prune

func (y *Yabs) Prune()

func (*Yabs) Register

func (y *Yabs) Register(name string, deps []string, fn BuildCtxFunc)

func (*Yabs) RestoreTasks

func (y *Yabs) RestoreTasks()

func (*Yabs) SaveTasks

func (y *Yabs) SaveTasks()

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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