Angular’s Bazel now available as an opt-in preview in CLI

Source : SD Times

Angular is continuing its efforts to improve and increase developer productivity with the introduction of Bazel as an opt-in preview in Angular CLI 8. 

Bazel is an open-source software tool that allows for the automation of building and testing of software. Google has been using Bazel for the last 12 years to build its massive applications such as Gmail, Google Drive and Google Cloud Console; and the Angular team has been working to offer it as a developer option for the past two years. As of Angular 6, the framework itself has been built with Bazel. Offering it as an option to developers in the CLI will , enable them to use the same workflow, but make their builds faster, the team explained. Featuresof the opt-in preview include production and development builds, hidden BUILD.bzel files for small projects, unt testing with Karma, Jasmine and Protractor.

“Bazel helps you scale your organization, codebase and Continuous Integration system. It handles codebases of any size, in multiple repositories or a huge monorepo,” the Bazel website states. 

This opt-in option comes as Google is expanding its CLI Builders API, which it released 2 months ago for Angular CLI. According to the company, the CLI Builders API allows for changes in the implementation of some of the built in Angular CLI commands and the creation of new ones such as ‘ng build,’ ‘ng serve’ and ‘ng test’ commands through ‘@angular/bazel.’ 

Bazel aims to simplify the process by determining the user’s build graph and executing multiple tasks in parallel. It even lets users run the build in the cloud. Another prominent feature in Bazel is build caching. 

According to the Angular team, the main goal behind the latest release was to decrease the size of Bazel’s binary to improve its integration with the external Node.js ecosystem. This also allows for incremental changes, which means that small changes to apps will require a proportionally small amount of rebuild and retest work. 

“Because of its hermetism, Bazel provides reliable caching which lets it rebuild only the assets that have changed. The caching can be either local, or remote,” Minko Gechev, senior developer programs engineer at Google, wrote in a blog post. “The power of the remote caching comes when we share it across your entire organization and CI. Once we build given artifact, our colleagues (or CI), can directly reuse it from the remote cache unless it has changed.”

Google software engineer Alex Eagle added that Bazel shows varying results for different application sizes at last month’s ng-conf.

“The most important thing we want to do for small apps is stability. There’s no observable difference either bad or good. Bazel will at best do the same thing you have already. However, when we get to medium scale based on some benchmarks we’ve been running we think we can get a faster build and test,” Eagle said. 

Going forward, Angular will continue to improve Bazel’s feature set in the CLI. The team is currently already working on supporting the completely set of Angular CLI features such as PWA, universal support and app shell; support for third-party modules; and performance improvements.

Pentechs've been excellent and a pleasure to work with.  Despite the complexity of the project they've delivered a superb result and kept all their promises.

CEO, Digiclips, UK

See what our clients say

Want to start a project?

Contact us at

+91 886 110 9173

+91 997 289 6003

+91 80 4200 7229