Skip to main content
Version: 0.4.0

Build

info

A tasks defined under the build: directive is refered to as build task

A build task can invoke one or many build/cli tools to build a part of a project. Build tasks are composable and can depend on each other with a preserving build order. By monitoring and hashing the inputs of a task bob assures that a task is only executed if needed.

Take a look at this task which builds an arbitrary go project

build:
build:
inputs: |-
main1.go
cmd: |-
go build -o run
target: run

A task can be executed using the bob cli

bob build taskname

as build is the default taskname the task above can also be executed by typing bob build

The main components of a task are

  • inputs - define whether or not a task needs a rebuild. By default the entire directory is considered (*). For performance reasons it's recommend to keep the number of inputs as small as possible.
  • cmd - cmds to execute when an input file changes. It's possible to run multiple cmds sequentially for a task.
  • target - defines the output of a task. Can be a single file, entire directory or even a docker image.

Pipelines

Often tasks need to be executed in a certain order. It's easy to create a pipline by using the dependsOn keyword.

build:
build:
...
dependsOn:
- codegen
codegen:
...

Cache

By default bob stores targets in a local cache and loads them if required. A remote cache is WIP. Whenever you change branches back and forth the cache saves you from unnecessary rebuilds by taking the targets from the cache.

Always Rebuild

By default build tasks only execute when any of their inputs or the task description changes. To make a build task execute always use the rebuild keyword. It accepts the values [always, on-change], defaults to on-change.

build:
build:
...
rebuild: always

You can also use the cli flag bob build taskname --no-cache to set rebuild: always for an entire pipeline. Additionaly it also stops loading & saving targets from the cache.

Look into the api reference for more details of how to use build tasks.