Bazel: Difference between revisions

From HPCWIKI
Jump to navigation Jump to search
(Created page with "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<ref>https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwix_f67rJqCAxUErlYBHc29CNkQFnoECAkQAw&url=https%3A%2F%2Fbazel.build%2Fabout%2Ffaq&usg=AOvVaw2LTedC5jnCi-zPHaBwVp9D&opi=89978449</re...")
 
Line 19: Line 19:


* How to override the use of output when building with Bazel
* 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 <code>--output_base</code> to put all output in a non-default directory
** The default output path is /tmp but depending on the version or default .bazelrc can be different output path, to override output path set <code>--output_base</code> or --output_user_root to put all output in a non-default directory
** <code>bazel --output_base=/dir/path/you/want/to build //foo</code>
** <code>bazel --output_base=/dir/path/you/want/to build //<whatever></code>
** <code>bazel --output_user_root=/dir/path/you/want/to build //<whatever></code>


== References ==
== References ==
<references />
<references />

Revision as of 13:22, 29 October 2023

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>

References