Mac OS/Linux |
---|
I find that Bazel is pretty handy for C++ programming and this repository contains some sample code about Bazel during the learning process.
It can be used as a template for later development.
Go to https://github.com/bazelbuild/bazel/releases and download a .sh
file for the corresponding platform.
For example,
wget https://github.com/bazelbuild/bazel/releases/download/0.20.0/bazel-0.20.0-installer-darwin-x86_64.sh
chmod +x bazel-0.20.0-installer-darwin-x86_64.sh
./bazel-0.20.0-installer-darwin-x86_64.sh --user
export PATH=$HOME/bin:${PATH}
To view the current version, run bazel version
.
When bazel is installed to $HOME/bin
, a file named
bazel-complete.bash
is installed to $HOME/.bazel/bin
simultaneously.
Add the following line to $HOME/.bash_profile
(macOS)
or to $HOME/.bashrc
(Linux):
source $HOME/.bazel/bin/bazel-complete.bash
Refer to https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md.
A quick guide is as follows:
go get github.com/bazelbuild/buildtools/buildifier
cd $HOME/go/src/github.com/bazelbuild/buildtools/buildifier
bazel build //buildifier
export PATH=$HOME/go/bin:${PATH}