- This object is created during the analysis phase to represent a file or directory that will be read or written during the execution phase. It is not an open file handle, and cannot be used to directly read or write file contents. Rather, you use it to construct the action graph in a rule implementation function by passing it to action-creating functions. See the Rules page for more information.
- .bzl file
Bazel & Angular
To truly benefit from Bazel the compilation must be split into independent actions that can be individually executed and cached. Each action coordinated by Angular Architect can instead be coordinated by Bazel. When Bazel is coordinating the actions the real benefits of Bazel will be seen such as parallelization, caching, test caching, remote execution/caching and all the other benefits that come with Bazel.
The primary action is compiling Angular TypeScript including component templates, css and the various annotations such as @Injectable. The Angular Compiler (ngc), is a drop-in replacement for the TypeScript compiler (tsc). The ts_project rule can be customized to use ngc as the compiler binary.
Bazel’s macros provide a simple way to define your own “syntax sugar”. We’ll start by declaring the ngc compiler target, and an ng_project macro that makes it easy to declare these.