Xvc for Software Development
Xvc pipelines can be used as a content-aware make replacement. Instead of
comparing file timestamps, Xvc decides whether a step needs to run by comparing
the content of its dependencies against the last recorded run. This removes the
false rebuilds that timestamps cause — touching a file without changing it does
not invalidate a step.
This guide builds a small two-step pipeline. See Create a Data
Pipeline for a longer, end-to-end example,
and the xvc pipeline reference for every command.
Initialize a repository
$ git init
$ xvc init
A default pipeline named default is available immediately; you don't have to
create one.
Add a step
A step is a named command. Create one with xvc pipeline step new:
$ xvc pipeline step new --step-name compile --command 'cc -c src/main.c -o build/main.o'
Declare dependencies and outputs
A step re-runs when any of its dependencies change. Attach dependencies with
xvc pipeline step dependency. You can
depend on a single file, a glob, other steps, parameter values, URLs, and more:
$ xvc pipeline step dependency --step-name compile --file src/main.c
$ xvc pipeline step dependency --step-name compile --glob 'src/*.h'
Record what the step produces with xvc pipeline step output so that later steps can depend on
it:
$ xvc pipeline step output --step-name compile --output-file build/main.o
Chain steps
Add a second step that links the object file, and make it depend on the first step so the two always run in order:
$ xvc pipeline step new --step-name link --command 'cc build/main.o -o build/app'
$ xvc pipeline step dependency --step-name link --step compile
Steps that don't depend on each other run in parallel; you can cap the
concurrency with the pipeline.process_pool_size configuration value.
Run the pipeline
$ xvc pipeline run
On the first run, both steps execute. On later runs, Xvc runs a step only if the
content of one of its dependencies changed. Inspect the dependency graph at any
time with xvc pipeline dag:
$ xvc pipeline dag --format mermaid
Next steps
- Create a Data Pipeline walks through a realistic multi-stage pipeline.
xvc pipeline step dependencylists every dependency type, including line-range, regex, parameter, URL, and SQLite dependencies.