https://github.com/tsukinoko-kun/yab
Cross-platform build tool with deterministic builds defined using Lua scripts.
https://github.com/tsukinoko-kun/yab
build build-tool golang lua
Last synced: about 2 months ago
JSON representation
Cross-platform build tool with deterministic builds defined using Lua scripts.
- Host: GitHub
- URL: https://github.com/tsukinoko-kun/yab
- Owner: tsukinoko-kun
- License: other
- Archived: true
- Created: 2024-01-21T00:40:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-20T15:38:33.000Z (almost 2 years ago)
- Last Synced: 2026-02-13T22:46:59.604Z (about 2 months ago)
- Topics: build, build-tool, golang, lua
- Language: Go
- Homepage: https://brew.frankmayer.dev/formula/yab/
- Size: 479 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yab
Yet another build tool :construction_worker: :construction:
[](#homebrew)
[](https://github.com/tsukinoko-kun/yab/releases/latest)
[](https://github.com/tsukinoko-kun/yab/actions/workflows/github-code-scanning/codeql)
Wouldn't it be great if you could use the same build tool for every project?
Regardless of operating system, programming language...
Yab is just that.
Use Lua scripts to define specific actions and execute them from the command line.
> [!CAUTION]
> This project is still in very early stages of development.
> Expect breaking changes.
> Stable API is guaranteed at v1.0.0
## Does that not already exist?
No!
Builtin support for many technologies
Smart incremental build
Easy to setup and extend
Imperative syntax (loops, functions, ...)
Parameters
No domain specific language
Cross-platform by default
Yab
:x: / :white_check_mark:
:white_check_mark:
:white_check_mark:
:white_check_mark:
:white_check_mark:
:white_check_mark:
:white_check_mark:
Bazel
:white_check_mark:
:white_check_mark:
:x:
:x:
:x:
:x:
:white_check_mark:
Gradle
:white_check_mark:
:grey_question:
:x:
:x:
:x:
:x:
:white_check_mark:
Make
:x:
:x:
:x:
:x:
:x:
:x:
:x:
### Explanation
#### Built-in support for many technologies
How many technologies are supported by the tool?
#### Smart incremental build
Skip tasks that are already done.
This should be done using file content hashes.
#### Easy to set up and extend
How difficult is it to get started with the tool?
#### Imperative syntax
Use the tool to describe how the build process should be done.
#### Parameters
Optionally parametrize build configurations.
#### No domain specific language
Use a language to describe the build that is popular outside the tool.
#### Cross-platform by default
It is easy to get the build working on different platforms.
---
Lua is a common and performant programming language.
Yab offers some useful functions in addition to the Lua standard library that might be useful when building configurations.
Looking for an example configuration?
Take a look at [this projects `.yab` folder](https://github.com/tsukinoko-kun/yab/tree/main/.yab).
## Docs
Documentation is in the [DOCS.md](https://github.com/tsukinoko-kun/yab/blob/main/DOCS.md) file.
## Usage
Run one or more configs:
```bash
yab run [configs ...]
```
Pass arguments to the scripts:
```bash
yab run [configs ...] -- [args ...]
```
A config is a lua file inside the config directory.
The following directories are used as configs (first found wins)
1. `./.yab/`
1. `$XDG_CONFIG_HOME/yab/`
1. `$APPDATA/yab/`
1. `$HOME/.config/yab/`
If you run `yab run` without any arguments, the default config (`init.lua`) is used.
## Lua definitions
You can use a Lua language server to get autocompletion and type checking.
Run `yab def` to create a definitions file in your **global** config directory.
Add it to your Lua language server configuration.
Global config is one of those directories:
1. `$XDG_CONFIG_HOME/yab/`
1. `$APPDATA/yab/`
1. `$HOME/.config/yab/`
## Example Code
```lua
local yab = require("yab")
-- use a specific Go version
yab.use("golang", "1.21.6")
-- os specific name
local bin_name = yab.os_type() == "windows" and "yab.exe" or "yab"
-- incremental build
yab.task(yab.find("**.go"), bin_name, function()
os.execute('go build -ldflags="-s -w" -o ' .. bin_name .. " ./cmd/yab/")
end)
```
## Attach external applications
I like to create an `env.lua` config where all shared tools are defined.
```lua
local yab = require("yab")
yab.use("golang", "1.21.6")
yab.use("nodejs", "20.11.1")
```
I now can start a shell using the specified environment using `yab run env --attach sh` or start neovim using `yab run env --attach nvim`.
## Installation
### Homebrew
```sh
brew tap tsukinoko-kun/tap
brew install tsukinoko-kun/tap/yab
```
### Go install
```bash
go install github.com/tsukinoko-kun/yab@latest
```
### Binary from release
[Latest release](https://github.com/tsukinoko-kun/yab/releases/latest)
## GitHub Actions
```yaml
- name: Use Yab
uses: tsukinoko-kun/use-yab@v1
```
You can specify a version using the `version` input. The default is `latest`.
```yaml
- name: Use Yab
uses: tsukinoko-kun/use-yab@v1
with:
version: 0.3.0
```
## Badge
Use the badge to show that your project uses Yab.
This helps to spread the word about Yab and makes it easier for others to work on your project.
This is just a suggestion.
You don't have to use it.
[](https://github.com/tsukinoko-kun/yab)
```markdown
[](https://github.com/tsukinoko-kun/yab)
```