Bazel Build for C++ Software Application
Bazel Tool is developed by google to automate the build process. Now It's an open source and it can be used by anyone. Many companies are using it for their day-to-day build automation. It is very helpful to integrate with CI/CD pipeline. GoogleTest framework can be integrated easily for the Unit Testing of an application.
Features of Bazel
Advantages from bazel in the modern build process
2. Easy to integrate with Docker and Kubernetes. If you have mono repo and multiple microservices, then It can build each container and host it for the test environment. Further, it can provide incremental build and perform deployment by using any orchestration tools like AWS and Kubernetes.
3. Bazel can handle large projects. Bazel provides a uniform interface for building and testing across projects and programming languages, which is beneficial to CI/CD Process.
4. Bazel used an internal caching mechanism. It caches the builds and rebuilds the content only when the developer made the changes. It compares the previous build which is cached and newly built content and produces the final binary. This caching technique speed up the build process.
Bazel Build Structure:
Labels:
All targets belong to exactly one package. The name of a target is called its label. Every label uniquely identifies a target. A typical label in canonical form looks like this:
@myrepo//my/app/main:app_binary
Dependencies:
A target A depends upon a target B if B is needed by A at build or execution time. The depends upon relation induces a Directed Acyclic Graph (DAG) over targets, and it is called a dependency graph.
code and compilation process will be updated soon.