Build Snippets #1 - Affected Target Analysis with Bazel
Affected target analysis
A question that naturally arises when interacting with pull requests is “What does this change affect?”.
It’s pretty easy to get Git to tell us1 what files were altered between two commits but if you answered that question with the list of modified files your interlocutor would probably roll their eyes at you.
Clearly, not all files are equal in significance: A change to a README probably merits less scrutiny & testing than a change to a unit test and changes to either of those are less significant (in some sense) than a change to a core behavioral library or user-facing API.
Sometimes the connection between a critical component and a file-level diff can be much harder to understand: An edit to a build script, or a change to toolchain, or rolling the URI pointing to a pinned dependency could all cause changes of great significance in ways that are less obvious than an edit to important_library.cc.