Skip to main content

Creating a new Bazel workspace

To learn Bazel concepts, many students find that having a hands-on example on their computer improves the experience. For this purpose, we'll create a small playground where we can use Bazel to accomplish some basic tasks.

By the end of this section, you should have an idea of what code is in the new repository, and be able to write code that Bazel can build and test.

Create the repository

Aspect CLI only

Run bazel init to create a new Bazel workspace.

The command will prompt you for which languages and features you'd like to try out.

Pick languages you already code in regularly. Our goal is to learn Bazel, not a new programming language!

If you don't want to install Aspect CLI, you can still continue using scaffold like so:

% brew tap hay-kot/scaffold-tap
% brew install scaffold
% scaffold new https://github.com/aspect-build/aspect-workflows-template.git

Let's take a quick look around.

Files

The files in the root folder are needed for any Bazel workspace. The instructor will walk you through key files and their meanings.