b0, occasionally

The quick hints if you need to use the b0 tool occasionally.

Basic

How do I build ?

b0

What gets build ?

b0 --what

What can I build ?

b0 list

How do I run tests ?

b0 list --tests  # List tests
b0 test          # Run all tests
b0 test -l       # Run all tests, including the long ones
b0 test --what   # Show what will run
b0 test -u this -u that  # Only run the 'this' and 'that' tests
b0 test --seed 123 # Run random tests with seed 123
b0 test --correct  # Correct failed snapshot tests

Since tests are executable you can also run them directly. See How do I run build artefacts ?. In particular certain tests may offer specific options, consult them by invoking the test directly.

b0 -- this_test --help

How do I run build artefacts ?

b0 list       # Spot the unit name u you are interested in
b0 -- u …     # Build u and run with arguments.
b0 -b -- u …  # Back to build only
b0 -- lib     # If lib is a library gets you in a REPL

How do I benchmark an executable ?

The following forms can be used in order to have up-to-date artefacts but avoiding timing the build.

time $(b0 --path -- u) …
hyperfine "$(b0 --path -- u) …"

How do I open build artefacts in a browser ?

b0 -- .show-url u
b0 -- .show-url --help   # See the different modes of operation

How do I get information about a unit ?

b0 show u

How can I use the build anywhere ?

eval $(b0 lock)
cd /any/where/
b0 -- u …

How can I add a new source to the project ?

b0 init src > module.ml       # Default has OCaml syntax
b0 init src unit.h unit.c     # Uses extensions for syntax
b0 init src -x > example.ml   # Uses CC0-1.0 license
b0 init src --help

More on builds

How do I build specific parts ?

b0 list            # Spot units names or packs you are interested in
b0 -u lib -p pack  # Build unit 'lib' and pack 'pack'

How do I clear the build ?

b0 delete
b0 delete -a   # Clean

How do I see build steps ?

b0 log
b0 log -l

Which build steps take time ?

b0 log -d

Which build steps failed ?

b0 log -e

Which build steps did really execute ?

b0 log -u