Introduction to Bazel
@mt165
mt165.co.ukMatt Turner
Bazel is a build system 💤
🔍 Focus on your sources and their
dependencies, not build instructions
☁ High-level language for declaratively
describing builds in terms of inputs and
desired outputs
🕳 Low-level language (Starlark) for
encoding the knowledge of compilers
⛱ Everything happens in a hermetic
sandbox
♊ Byte-for-byte reproducible builds
✅ Correct (re)builds
🏎 Fast
🚉 Great cross-platform support
💻 A minimal example
Labels
@repo//path/to/pkg:target
Labels
@repo//path/to/pkg:target
Labels
@repo//path/to/pkg:target
Labels
@repo//path/to/pkg:target
Packages
./BUILD
./hello.go
./img/logo.png
./tests/BUILD
./tests/hello_test.go
./tests/testdata/input.txt
./tests/testdata/correct_output.txt
Labels
@repo//path/to/pkg:target
Labels
@helloworld//tests:hello_test.go
Labels
@helloworld//tests:test_data/input.txt
Labels
@helloworld//tests:helloworld_binary
💻 A minimal example
⬆ Upgrade golang
Thanks!
@mt165
Slides
Videos
Demo code
mt165.co.uk