Bazel's code search and source browsing interface is a web-based tool for browsing Bazel source code repositories. You can use these features to navigate among different repositories, branches, and files. You can also view history, diffs, and blame information.
Note: For the best experience, use the latest version of Chrome, Safari, or Firefox.
To access the code search and source browsing interface, open https://source.bazel.build in your web browser.
The main screen appears. This screen contains the following components:
The Breadcrumb toolbar. This toolbar displays your current location in the repository and allows you to move quickly to another location such as another repository, or another location within a repository, such as a file, branch, or commit.
A list of repositories that you can browse.
At the top of the screen is a search box. You can use this box to search for specific files and code.
To open a repository, click its name from the main screen.
Alternatively, you can use the Breadcrumb toolbar to browse for a specificrepository. This toolbar displays your current location in the repository and allows you to move quickly to another location such as another repository, or another location within a repository, such as a file, branch, or commit.
To switch to a different repository, select the repository from the Breadcrumb toolbar.
To view a repository at a specific commit:
The interface now shows the repository as it existed at that commit.
By default, the code search and source browsing interface opens a repository to the master branch. To open a different branch, from the Breadcrumb toolbar, click the Branch/Commit/Tag menu. A submenu opens, allowing you to select a branch using a branch name, a tag name, or through a search box.
When you select a repository from the main screen, the screen changes to display a view of that repository. If a README file exists, its contents appear in the file pane, located on the right side of the screen. Otherwise, a list of repository's files and folders appear. On the left side of the screen is a tree view of the repository's files and folders. You can use this tree to browse and open specific files.
Notice that, when you are viewing a repository, the Breadcrumb toolbar now has three components:
You can open a file by browsing to its directory and selecting it. The view of the repository updates to show the contents of the file in the file pane, and its location in the repository in the tree pane.
To view file changes:
The file pane updates to display who made changes to the file and when.
To view the change history of a file:
For Gerrit code reviews, you can open the tool directly from the Change History pane.
To view the code review for a file:
The Gerrit Code Review tool opens in a new browser window.
To open a file at a specific commit:
To compare a file at a different commit:
The file pane updates to display a side-by-side comparison between the two files. The oldest of the two commits is always on the left.
In the Change History pane, both commits are highlighted, and a label indicates if the commit is displayed on the left or the right.
To change either file, hover over the commit in the Change History pane. Then, click either the Left or Right button to have the open the commit on the left or right side of the diff.
Another way to browse source repositories is through the use of cross references. These references appear automatically as hyperlinks within a given source file.
To make cross references easier to identify, click Cross References, located in the upper-right corner. This option displays an underline below all cross references in a file.
Note: If Cross References is grayed out, it indicates that cross references are not available for that file.
Click a cross reference to open the Cross Reference pane. This pane contains two sections:
Both sections display the the name of the file, as well as the line or lines that contains the reference. To open a file from the Cross Reference pane, click the line number entry. The file appears in a new section of the pane, allowing you to continue to browse the file while keeping the original file in view.
You can continue to browse cross references using the Cross Reference pane, just
as you can in the File pane. When you do, the pane displays a breadcrumb trail,
which you can use to navigate between different cross references.
You can search for specific files or code snippets using the search box located at the top of the screen. Searches are always against the master branch.
All searches use RE2 regular expressions by default. If you do not want to use regular expressions, enclose your search in double quotes ( " ).
Note: To quickly search for a specific file, either add a backslash in front of the period, or enclose the entire file name in quotes.
You can refine your search using the following filters.
|lang:||language:||Perform an exact match by file language.||lang:java test|
|case:yes||Make the search case sensitive. By default, searches are not case-sensitive.||case:yes Hello World|
|class:||Search for a class name.||class:MainClass|
|function:||func:||Search for a function name.||function:print|
|-||Negates the term from the search.||hello -world|
|\||Escapes special characters, such as ., \, or (.||run\(\)|
|"[term]"||Perform a literal search.||"class:main"|
To report an issue, click the Feedback button that appears in the top right-hand corner of the screen and enter your feedback in the provided form.