Here is the codelabs repository: https://github.com/aspect-build/codelabs. This is 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 this repository, and be able to run the applications and tests.
Clone the repo
Clone the repo to your machine:
git clone https://github.com/aspect-build/codelabs.git
The default git branch, called
start has an existing monorepo layout but no Bazel yet.
In the 201 course, we learn how to setup Bazel from scratch.
For this course, you should just checkout the
final branch right now, where this is already done.
Tour of the logger application
Let's take a quick look around.
This repo contains a logging service, with code in lots of languages, communicating with gRPC. It's meant as a simulation of the kind of monorepo you likely work in.
Here are the components of the application:
schema/generates code for all languages to agree on the protocol, using protobuf and gRPC.
backend/has a server written in Go which stores messages.
client/is a sample of a program that wants to store log messages, written in Java.
frontend/is a web site written in TypeScript.
cli/is a terminal-based frontend for viewing the messages, written in Python.
ios/contains an iOS application that sends log messages to the backend server, written in Swift.
All of these components have some third-party dependencies, so we'll have to fetch those too!
Our end goal is to make a hypothetical large team of developers productive in this repository, by
writing a single integration test in
tests/integrationtest.sh which will detect if a developer breaks something in any of the components.
Without Bazel, it would be impossible to write an integration test across all these languages in a single build tool.
You won't have time to setup all four languages during this course. Hopefully you feel comfortable in at least one of these languages, and we suggest that you use that one throughout the course. If you have extra time, feel free to try expanding your Bazel setup to more of them!
Here is what the application looks like once you've got everything working.
First, we startup the Go backend server:
Then we launch the Java client which produces log messages and sends them to the backend:
Now we can run our Python CLI to see the messages so far:
Finally, we can run a TypeScript web frontend and see the messages there too:
Here's what the app looks like in the browser after loading some messages:
Or we can boot up the iOS app and send/recieve messages: