Builder Overview

Bit's Builder is responsible for component build pipelines. It executes build tasks in sequence, according to their dependency on other tasks. Builder runs the build-pipeline for each component in an isolated component environment called 'capsule' to validate a component is completely independent from the workspace.

The build pipeline executes a set of tasks according to their dependency on each other. These tasks run as part of the following flows:

bit build # run the build pipeline of a component to validate if it's buildable.
bit snap  # create a component snapshot.
bit tag   # create a semantic version for a component.
CopiedCopy

A single workspace may have multiple components, each with different build pipelines and running a different set of build tasks. The build pipeline will run for modified or affected components using a single command. It makes it much easier to integrate Bit to your automation flow, as you only need to run a single Bit command.

Extendible build pipelines

Often the set of tasks are determined by the env. You can control the build pipeline as defined by the env through customizing it.
In some cases, different aspects may apply their own build tasks and register them to the component's build pipeline.

Isolated builds

Bit components are independent from each other and the workspace. To ensure that, the build process starts by creating a component capsule. A capsule is an isolated environment for the component, generated in a temporary directory. In the capsule Bit installs all dependencies and runs the build tasks.
Running the build in an isolated environment validates that a component is not coupled to the workspace, making sure it's 100% reusable in any consuming environment.

Build task

An example of a build-task is compile, it's written in the compiler aspect and is running on each one of the capsules created by the build process. build-tasks in many cases generate artifacts, in this case, the compiler generates dists files and write them on the isolated capsules. There artifacts files are used later for example when creating packages.

Artifacts

The build pipeline may generate various artifacts which are then able to be used for various tasks. For example, the tester aspect generates a junit.xml format output file.