Bazel
Jump to navigation
Jump to search
Bazel is a tool that automates software builds and tests. Supported build tasks include running compilers and linkers to produce executable programs and libraries, and assembling deployable packages for Android, iOS and other target environments[1]
Install specific version of bazel
Bazel install page describes multiple way to install bazel, following is our preferred method for automated build scripts that uses various version of bazel depending on the projects.
#example version 6.3.2
$export _version=6.3.2
$ wget https://github.com/bazelbuild/bazel/releases/download/$_version/bazel-$_version-installer-linux-x86_64.sh
$chmod +x bazel-$_version-installer-linux-x86_64.sh
# to install user only
$./bazel-$_version-installer-linux-x86_64.sh --user
# to install system-wide
$./bazel-$_version-installer-linux-x86_64.sh
Tips and tricks
- How to override the use of output when building with Bazel
- The default output path is /tmp but depending on the version or default .bazelrc can be different output path, to override output path set
--output_base
or --output_user_root to put all output in a non-default directory bazel --output_base=/dir/path/you/want/to build //<whatever>
bazel --output_user_root=/dir/path/you/want/to build //<whatever>
- The default output path is /tmp but depending on the version or default .bazelrc can be different output path, to override output path set