From ce1e7e3aa23a2fd245f95abc1b60374ad7786607 Mon Sep 17 00:00:00 2001
From: Alberto Cavalcante <54247214+albertocavalcante@users.noreply.github.com>
Date: Wed, 12 Nov 2025 11:44:42 -0500
Subject: [PATCH 1/3] Step 1: add llms snapshot generation
---
README.md | 15 +
llms-full.txt | 57077 +++++++++++++++++++++++++++++++++++++
llms.txt | 256 +
scripts/generate_llms.py | 314 +
4 files changed, 57662 insertions(+)
create mode 100644 llms-full.txt
create mode 100644 llms.txt
create mode 100755 scripts/generate_llms.py
diff --git a/README.md b/README.md
index d492f8ea..3fb7855d 100644
--- a/README.md
+++ b/README.md
@@ -27,3 +27,18 @@ Install the Mintlify dev tool: `npm install -g mint`
Then run `mint dev` to get a locally-running site.
Send a PR to get a hosted preview of the changes.
+
+## LLM-friendly snapshots
+
+The repository ships two machine-readable indices at the site root:
+
+- `llms.txt` – a curated navigation guide so LLMs can understand the docs layout quickly.
+- `llms-full.txt` – the entire Markdown/MDX corpus flattened into a single file for ingestion.
+
+Regenerate both files after editing docs with:
+
+```bash
+python3 scripts/generate_llms.py
+```
+
+Set `LLMS_BASE_URL` if you need to point to a preview domain. The script reads `docs.json` so it stays aligned with the Mintlify navigation model.
diff --git a/llms-full.txt b/llms-full.txt
new file mode 100644
index 00000000..e8e04977
--- /dev/null
+++ b/llms-full.txt
@@ -0,0 +1,57077 @@
+# Bazel Documentation – llms-full.txt
+> Complete Markdown snapshot of the Bazel documentation tree. Each section is canonicalized to the published URL for easier ingestion.
+
+- Canonical domain: https://bazel.build/
+- Docs snapshot: HEAD
+- Generated: 2025-11-12 16:41:01 UTC
+- Source repo: https://github.com/bazel-contrib/bazel-docs
+
+---
+
+## { Fast, Correct }: Choose two
+- URL: https://bazel.build/
+- Source: index.mdx
+- Slug: /
+- Summary: From startup to enterprise, choose the Bazel open source project to build and test your multi-language, multi-platform projects.
+
+
+
+
+
+Rebuild only what is necessary. Get fast incremental builds with Bazel's advanced local and distributed caching, optimized dependency analysis, and parallel execution.
+
+
+ Build and test using Java, C++, Go, Android, iOS and many other languages and platforms. Bazel runs on Windows, macOS, and Linux.
+
+
+ Scale your organization, codebase, and Continuous Integration systems. Bazel handles codebases of any size, whether in multiple repositories or a huge monorepo.
+
+
+ Add support for new languages and platforms with Bazel's extension language. Share and re-use language rules written by the growing Bazel community.
+
+
+
+
+
+Essential Bazel
+
+
+Build and test software of any size, quickly and reliably. Industry leaders like Google, Stripe, and Dropbox trust Bazel to build heavy-duty, mission-critical infrastructure, services, and applications.
+
+
+
+
+Learn what Bazel is, why it is a good choice for your project, and how you can get started using it quickly.
+
+
+Learn how to use Bazel with documentation and tutorials covering topics from foundational to expert.
+
+
+
+Use these resources to efficiently look up the commands, queries, and terminology necessary to working with Bazel.
+
+
+
+
+
+
+
+
+
+
+Bazel is always evolving — check the release notes to see what's changed in the latest releases, and how that affects your builds.
+
+
+
+
+
+What's New?
+
+
+Catch up on the latest documentation, community events, and programs.
+
+
+
+Read our new public roadmap to see what is coming down the pipeline.
+
+
+Tune in for our new monthly community update livestream.
+
+
+Get started with the Bazel query language with this new guided scenario.
+
+
+
+
+
+
+---
+
+## FAQ
+- URL: https://bazel.build/about/faq
+- Source: about/faq.mdx
+- Slug: /about/faq
+
+If you have questions or need support, see [Getting Help](/help).
+
+## What is Bazel?
+
+Bazel is a tool that automates software builds and tests. Supported build tasks include running compilers and linkers to produce executable programs and libraries, and assembling deployable packages for Android, iOS and other target environments. Bazel is similar to other tools like Make, Ant, Gradle, Buck, Pants and Maven.
+
+## What is special about Bazel?
+
+Bazel was designed to fit the way software is developed at Google. It has the following features:
+
+* Multi-language support: Bazel supports [many languages](/reference/be/overview), and can be extended to support arbitrary programming languages.
+* High-level build language: Projects are described in the `BUILD` language, a concise text format that describes a project as sets of small interconnected libraries, binaries and tests. In contrast, with tools like Make, you have to describe individual files and compiler invocations.
+* Multi-platform support: The same tool and the same `BUILD` files can be used to build software for different architectures, and even different platforms. At Google, we use Bazel to build everything from server applications running on systems in our data centers to client apps running on mobile phones.
+* Reproducibility: In `BUILD` files, each library, test and binary must specify its direct dependencies completely. Bazel uses this dependency information to know what must be rebuilt when you make changes to a source file, and which tasks can run in parallel. This means that all builds are incremental and will always produce the same result.
+* Scalable: Bazel can handle large builds; at Google, it is common for a server binary to have 100k source files, and builds where no files were changed take about ~200ms.
+
+## Why doesn’t Google use...?
+
+* Make, Ninja: These tools give very exact control over what commands get invoked to build files, but it’s up to the user to write rules that are correct.
+ * Users interact with Bazel on a higher level. For example, Bazel has built-in rules for “Java test”, “C++ binary”, and notions such as “target platform” and “host platform”. These rules have been battle tested to be foolproof.
+* Ant and Maven: Ant and Maven are primarily geared toward Java, while Bazel handles multiple languages. Bazel encourages subdividing codebases in smaller reusable units, and can rebuild only ones that need rebuilding. This speeds up development when working with larger codebases.
+* Gradle: Bazel configuration files are much more structured than Gradle’s, letting Bazel understand exactly what each action does. This allows for more parallelism and better reproducibility.
+* Pants, Buck: Both tools were created and developed by ex-Googlers at Twitter and Foursquare, and Facebook respectively. They have been modeled after Bazel, but their feature sets are different, so they aren’t viable alternatives for us.
+
+## Where did Bazel come from?
+
+Bazel is a flavor of the tool that Google uses to build its server software internally. It has expanded to build other software as well, like mobile apps (iOS, Android) that connect to our servers.
+
+## Did you rewrite your internal tool as open-source? Is it a fork?
+
+Bazel shares most of its code with the internal tool and its rules are used for millions of builds every day.
+
+## Why did Google build Bazel?
+
+A long time ago, Google built its software using large, generated Makefiles. These led to slow and unreliable builds, which began to interfere with our developers’ productivity and the company’s agility. Bazel was a way to solve these problems.
+
+## Does Bazel require a build cluster?
+
+Bazel runs build operations locally by default. However, Bazel can also connect to a build cluster for even faster builds and tests. See our documentation on [remote execution and caching](/remote/rbe) and [remote caching](/remote/caching) for further details.
+
+## How does the Google development process work?
+
+For our server code base, we use the following development workflow:
+
+* All our server code is in a single, gigantic version control system.
+* Everybody builds their software with Bazel.
+* Different teams own different parts of the source tree, and make their components available as `BUILD` targets.
+* Branching is primarily used for managing releases, so everybody develops their software at the head revision.
+
+Bazel is a cornerstone of this philosophy: since Bazel requires all dependencies to be fully specified, we can predict which programs and tests are affected by a change, and vet them before submission.
+
+More background on the development process at Google can be found on the [eng tools blog](http://google-engtools.blogspot.com/).
+
+## Why did you open up Bazel?
+
+Building software should be fun and easy. Slow and unpredictable builds take the fun out of programming.
+
+## Why would I want to use Bazel?
+
+* Bazel may give you faster build times because it can recompile only the files that need to be recompiled. Similarly, it can skip re-running tests that it knows haven’t changed.
+* Bazel produces deterministic results. This eliminates skew between incremental and clean builds, laptop and CI system, etc.
+* Bazel can build different client and server apps with the same tool from the same workspace. For example, you can change a client/server protocol in a single commit, and test that the updated mobile app works with the updated server, building both with the same tool, reaping all the aforementioned benefits of Bazel.
+
+## Can I see examples?
+
+Yes; see a [simple example](https://github.com/bazelbuild/bazel/blob/master/examples/cpp/BUILD)
+or read the [Bazel source code](https://github.com/bazelbuild/bazel/blob/master/src/BUILD) for a more complex example.
+
+
+## What is Bazel best at?
+
+Bazel shines at building and testing projects with the following properties:
+
+* Projects with a large codebase
+* Projects written in (multiple) compiled languages
+* Projects that deploy on multiple platforms
+* Projects that have extensive tests
+
+## Where can I run Bazel?
+
+Bazel runs on Linux, macOS (OS X), and Windows.
+
+Porting to other UNIX platforms should be relatively easy, as long as a JDK is available for the platform.
+
+## What should I not use Bazel for?
+
+* Bazel tries to be smart about caching. This means that it is not good for running build operations whose outputs should not be cached. For example, the following steps should not be run from Bazel:
+ * A compilation step that fetches data from the internet.
+ * A test step that connects to the QA instance of your site.
+ * A deployment step that changes your site’s cloud configuration.
+* If your build consists of a few long, sequential steps, Bazel may not be able to help much. You’ll get more speed by breaking long steps into smaller, discrete targets that Bazel can run in parallel.
+
+## How stable is Bazel’s feature set?
+
+The core features (C++, Java, and shell rules) have extensive use inside Google, so they are thoroughly tested and have very little churn. Similarly, we test new versions of Bazel across hundreds of thousands of targets every day to find regressions, and we release new versions multiple times every month.
+
+In short, except for features marked as experimental, Bazel should Just Work. Changes to non-experimental rules will be backward compatible. A more detailed list of feature support statuses can be found in our [support document](/contribute/support).
+
+## How stable is Bazel as a binary?
+
+Inside Google, we make sure that Bazel crashes are very rare. This should also hold for our open source codebase.
+
+## How can I start using Bazel?
+
+See [Getting Started](/start/).
+
+## Doesn’t Docker solve the reproducibility problems?
+
+With Docker you can easily create sandboxes with fixed OS releases, for example, Ubuntu 12.04, Fedora 21. This solves the problem of reproducibility for the system environment – that is, “which version of /usr/bin/c++ do I need?”
+
+Docker does not address reproducibility with regard to changes in the source code. Running Make with an imperfectly written Makefile inside a Docker container can still yield unpredictable results.
+
+Inside Google, we check tools into source control for reproducibility. In this way, we can vet changes to tools (“upgrade GCC to 4.6.1”) with the same mechanism as changes to base libraries (“fix bounds check in OpenSSL”).
+
+## Can I build binaries for deployment on Docker?
+
+With Bazel, you can build standalone, statically linked binaries in C/C++, and self-contained jar files for Java. These run with few dependencies on normal UNIX systems, and as such should be simple to install inside a Docker container.
+
+Bazel has conventions for structuring more complex programs, for example, a Java program that consumes a set of data files, or runs another program as subprocess. It is possible to package up such environments as standalone archives, so they can be deployed on different systems, including Docker images.
+
+## Can I build Docker images with Bazel?
+
+Yes, you can use our [Docker rules](https://github.com/bazelbuild/rules_docker) to build reproducible Docker images.
+
+## Will Bazel make my builds reproducible automatically?
+
+For Java and C++ binaries, yes, assuming you do not change the toolchain. If you have build steps that involve custom recipes (for example, executing binaries through a shell script inside a rule), you will need to take some extra care:
+
+* Do not use dependencies that were not declared. Sandboxed execution (–spawn\_strategy=sandboxed, only on Linux) can help find undeclared dependencies.
+* Avoid storing timestamps and user-IDs in generated files. ZIP files and other archives are especially prone to this.
+* Avoid connecting to the network. Sandboxed execution can help here too.
+* Avoid processes that use random numbers, in particular, dictionary traversal is randomized in many programming languages.
+
+## Do you have binary releases?
+
+Yes, you can find the latest [release binaries](https://github.com/bazelbuild/bazel/releases/latest) and review our [release policy](/release/)
+
+## I use Eclipse/IntelliJ/XCode. How does Bazel interoperate with IDEs?
+
+For IntelliJ, check out the [IntelliJ with Bazel plugin](https://ij.bazel.build/).
+
+For XCode, check out [Tulsi](http://tulsi.bazel.build/).
+
+For Eclipse, check out [E4B plugin](https://github.com/bazelbuild/e4b).
+
+For other IDEs, check out the [blog post](https://blog.bazel.build/2016/06/10/ide-support.html) on how these plugins work.
+
+## I use Jenkins/CircleCI/TravisCI. How does Bazel interoperate with CI systems?
+
+Bazel returns a non-zero exit code if the build or test invocation fails, and this should be enough for basic CI integration. Since Bazel does not need clean builds for correctness, the CI system should not be configured to clean before starting a build/test run.
+
+Further details on exit codes are in the [User Manual](/docs/user-manual).
+
+## What future features can we expect in Bazel?
+
+See our [Roadmaps](/about/roadmap).
+
+## Can I use Bazel for my INSERT LANGUAGE HERE project?
+
+Bazel is extensible. Anyone can add support for new languages. Many languages are supported: see the [build encyclopedia](/reference/be/overview) for a list of recommendations and [awesomebazel.com](https://awesomebazel.com/) for a more comprehensive list.
+
+If you would like to develop extensions or learn how they work, see the documentation for [extending Bazel](/extending/concepts).
+
+## Can I contribute to the Bazel code base?
+
+See our [contribution guidelines](/contribute/).
+
+## Why isn’t all development done in the open?
+
+We still have to refactor the interfaces between the public code in Bazel and our internal extensions frequently. This makes it hard to do much development in the open.
+
+## Are you done open sourcing Bazel?
+
+Open sourcing Bazel is a work-in-progress. In particular, we’re still working on open sourcing:
+
+* Many of our unit and integration tests (which should make contributing patches easier).
+* Full IDE integration.
+
+Beyond code, we’d like to eventually have all code reviews, bug tracking, and design decisions happen publicly, with the Bazel community involved. We are not there yet, so some changes will simply appear in the Bazel repository without clear explanation. Despite this lack of transparency, we want to support external developers and collaborate. Thus, we are opening up the code, even though some of the development is still happening internal to Google. Please let us know if anything seems unclear or unjustified as we transition to an open model.
+
+## Are there parts of Bazel that will never be open sourced?
+
+Yes, some of the code base either integrates with Google-specific technology or we have been looking for an excuse to get rid of (or is some combination of the two). These parts of the code base are not available on GitHub and probably never will be.
+
+## How do I contact the team?
+
+We are reachable at bazel-discuss@googlegroups.com.
+
+## Where do I report bugs?
+
+Open an issue [on GitHub](https://github.com/bazelbuild/bazel/issues).
+
+## What’s up with the word “Blaze” in the codebase?
+
+This is an internal name for the tool. Please refer to Blaze as Bazel.
+
+## Why do other Google projects (Android, Chrome) use other build tools?
+
+Until the first (Alpha) release, Bazel was not available externally, so open source projects such as Chromium and Android could not use it. In addition, the original lack of Windows support was a problem for building Windows applications, such as Chrome. Since the project has matured and become more stable, the [Android Open Source Project](https://source.android.com/) is in the process of migrating to Bazel.
+
+## How do you pronounce “Bazel”?
+
+The same way as “basil” (the herb) in US English: “BAY-zel”. It rhymes with “hazel”. IPA: /ˈbeɪzˌəl/
+
+---
+
+## Intro to Bazel
+- URL: https://bazel.build/about/intro
+- Source: about/intro.mdx
+- Slug: /about/intro
+
+Bazel is an open-source build and test tool similar to Make, Maven, and Gradle.
+It uses a human-readable, high-level build language. Bazel supports projects in
+multiple languages and builds outputs for multiple platforms. Bazel supports
+large codebases across multiple repositories, and large numbers of users.
+
+## Benefits
+
+Bazel offers the following advantages:
+
+* **High-level build language.** Bazel uses an abstract, human-readable
+ language to describe the build properties of your project at a high
+ semantical level. Unlike other tools, Bazel operates on the *concepts*
+ of libraries, binaries, scripts, and data sets, shielding you from the
+ complexity of writing individual calls to tools such as compilers and
+ linkers.
+
+* **Bazel is fast and reliable.** Bazel caches all previously done work and
+ tracks changes to both file content and build commands. This way, Bazel
+ knows when something needs to be rebuilt, and rebuilds only that. To further
+ speed up your builds, you can set up your project to build in a highly
+ parallel and incremental fashion.
+
+* **Bazel is multi-platform.** Bazel runs on Linux, macOS, and Windows. Bazel
+ can build binaries and deployable packages for multiple platforms, including
+ desktop, server, and mobile, from the same project.
+
+* **Bazel scales.** Bazel maintains agility while handling builds with 100k+
+ source files. It works with multiple repositories and user bases in the tens
+ of thousands.
+
+* **Bazel is extensible.** Many [languages](/rules) are
+ supported, and you can extend Bazel to support any other language or
+ framework.
+
+## Using Bazel
+
+To build or test a project with Bazel, you typically do the following:
+
+1. **Set up Bazel.** Download and [install Bazel](/install).
+
+2. **Set up a project [workspace](/concepts/build-ref#workspaces)**, which is a
+ directory where Bazel looks for build inputs and `BUILD` files, and where it
+ stores build outputs.
+
+3. **Write a `BUILD` file**, which tells Bazel what to build and how to
+ build it.
+
+ You write your `BUILD` file by declaring build targets using
+ [Starlark](/rules/language), a domain-specific language. (See example
+ [here](https://github.com/bazelbuild/bazel/blob/master/examples/cpp/BUILD).)
+
+ A build target specifies a set of input artifacts that Bazel will build plus
+ their dependencies, the build rule Bazel will use to build it, and options
+ that configure the build rule.
+
+ A build rule specifies the build tools Bazel will use, such as compilers and
+ linkers, and their configurations. Bazel ships with a number of build rules
+ covering the most common artifact types in the supported languages on
+ supported platforms.
+
+4. **Run Bazel** from the [command line](/reference/command-line-reference). Bazel
+ places your outputs within the workspace.
+
+In addition to building, you can also use Bazel to run
+[tests](/reference/test-encyclopedia) and [query](/query/guide) the build
+to trace dependencies in your code.
+
+## Bazel build process
+
+When running a build or a test, Bazel does the following:
+
+1. **Loads** the `BUILD` files relevant to the target.
+
+2. **Analyzes** the inputs and their
+ [dependencies](/concepts/dependencies), applies the specified build
+ rules, and produces an [action](/extending/concepts#evaluation-model)
+ graph.
+
+3. **Executes** the build actions on the inputs until the final build outputs
+ are produced.
+
+Since all previous build work is cached, Bazel can identify and reuse cached
+artifacts and only rebuild or retest what's changed. To further enforce
+correctness, you can set up Bazel to run builds and tests
+[hermetically](/basics/hermeticity) through sandboxing, minimizing skew
+and maximizing [reproducibility](/run/build#correct-incremental-rebuilds).
+
+### Action graph
+
+The action graph represents the build artifacts, the relationships between them,
+and the build actions that Bazel will perform. Thanks to this graph, Bazel can
+[track](/run/build#build-consistency) changes to
+file content as well as changes to actions, such as build or test commands, and
+know what build work has previously been done. The graph also enables you to
+easily [trace dependencies](/query/guide) in your code.
+
+## Getting started tutorials
+
+To get started with Bazel, see [Getting Started](/start/) or jump
+directly to the Bazel tutorials:
+
+* [Tutorial: Build a C++ Project](/start/cpp)
+* [Tutorial: Build a Java Project](/start/java)
+* [Tutorial: Build an Android Application](/start/android-app)
+* [Tutorial: Build an iOS Application](/start/ios-app)
+
+---
+
+## Bazel roadmap
+- URL: https://bazel.build/about/roadmap
+- Source: about/roadmap.mdx
+- Slug: /about/roadmap
+
+As Bazel continues to evolve in response to your needs, we want to share our
+2025 roadmap update.
+
+We plan to bring Bazel 9.0
+[long term support (LTS)](https://bazel.build/release/versioning) to you in late
+2025.
+
+## Full transition to Bzlmod
+
+[Bzlmod](https://bazel.build/docs/bzlmod) has been the standard external
+dependency system in Bazel since Bazel 7, replacing the legacy WORKSPACE system.
+As of March 2025, the [Bazel Central Registry](https://registry.bazel.build/)
+hosts more than 650 modules.
+
+With Bazel 9, we will completely remove WORKSPACE functionality, and Bzlmod will
+be the only way to introduce external dependencies in Bazel. To minimize the
+migration cost for the community, we'll focus on further improving our migration
+[guide](https://bazel.build/external/migration) and
+[tool](https://github.com/bazelbuild/bazel-central-registry/tree/main/tools#migrate_to_bzlmodpy).
+
+Additionally, we aim to implement an improved shared repository cache (see
+[#12227](https://github.com/bazelbuild/bazel/issues/12227))
+with garbage collection, and may backport it to Bazel 8. The Bazel Central
+Registry will also support verifying SLSA attestations.
+
+## Migration of Android, C++, Java, Python, and Proto rules
+
+With Bazel 8, we have migrated support for Android, Java, Python, and Proto
+rules out of the Bazel codebase into Starlark rules in their corresponding
+repositories. To ease the migration, we implemented the autoload features in
+Bazel, which can be controlled with
+[--incompatible_autoload_externally](https://github.com/bazelbuild/bazel/issues/23043)
+and [--incompatible_disable_autoloads_in_main_repo](https://github.com/bazelbuild/bazel/issues/25755)
+flags.
+
+With Bazel 9, we aim to disable autoloads by default and require every project
+to explicitly load required rules in BUILD files.
+
+We will rewrite most of C++ language support to Starlark, detach it from Bazel
+binary and move it into the [/rules_cc](https://github.com/bazelbuild/rules_cc)
+repository. This is the last remaining major language support that is still part
+of Bazel.
+
+We're also porting unit tests for C++, Java, and Proto rules to Starlark, moving
+them to repositories next to the implementation to increase velocity of rule
+authors.
+
+## Starlark improvements
+
+Bazel will have the ability to evaluate symbolic macros lazily. This means that
+a symbolic macro won't run if the targets it declares are not requested,
+improving performance for very large packages.
+
+Starlark will have an experimental type system, similar to Python's type
+annotations. We expect the type system to stabilize _after_ Bazel 9 is launched.
+
+## Configurability
+
+Our main focus is reducing the cost and confusion of build flags.
+
+We're [experimenting](https://github.com/bazelbuild/bazel/issues/24839) with a
+new project configuration model that doesn't make users have to know which build
+and test flags to set where. So `$ bazel test //foo` automatically sets the
+right flags based on `foo`'s project's policy. This will likely remain
+experimental in 9.0 but guiding feedback is welcome.
+
+[Flag scoping](https://github.com/bazelbuild/bazel/issues/24042) lets you strip
+out Starlark flags when they leave project boundaries, so they don't break
+caching on transitive dependencies that don't need them. This makes builds that
+use [transitions](https://bazel.build/extending/config#user-defined-transitions)
+cheaper and faster.
+[Here's](https://github.com/gregestren/snippets/tree/master/project_scoped_flags)
+an example. We're extending the idea to control which flags propagate to
+[exec configurations](https://bazel.build/extending/rules#configurations) and
+are considering even more flexible support like custom Starlark to determine
+which dependency edges should propagate flags.
+
+We're up-prioritizing effort to move built-in language flags out of Bazel and
+into Starlark, where they can live with related rule definitions.
+
+## Remote execution improvements
+
+We plan to add support for asynchronous execution, speeding up remote execution
+by increasing parallelism.
+
+---
+
+To follow updates to the roadmap and discuss planned features, join the
+community Slack server at [slack.bazel.build](https://slack.bazel.build/).
+
+*This roadmap is intended to help inform the community about the team's
+intentions for Bazel 9.0. Priorities are subject to change in response to
+developer and customer feedback, or to new market opportunities.*
+
+---
+
+## Bazel Vision
+- URL: https://bazel.build/about/vision
+- Source: about/vision.mdx
+- Slug: /about/vision
+
+Any software developer can efficiently build, test, and package
+any project, of any size or complexity, with tooling that's easy to adopt and
+extend.
+
+* **Engineers can take build fundamentals for granted.** Software developers
+ focus on the creative process of authoring code because the mechanical
+ process of build and test is solved. When customizing the build system to
+ support new languages or unique organizational needs, users focus on the
+ aspects of extensibility that are unique to their use case, without having
+ to reinvent the basic plumbing.
+
+* **Engineers can easily contribute to any project.** A developer who wants to
+ start working on a new project can simply clone the project and run the
+ build. There's no need for local configuration - it just works. With
+ cross-platform remote execution, they can work on any machine anywhere and
+ fully test their changes against all platforms the project targets.
+ Engineers can quickly configure the build for a new project or incrementally
+ migrate an existing build.
+
+* **Projects can scale to any size codebase, any size team.** Fast,
+ incremental testing allows teams to fully validate every change before it is
+ committed. This remains true even as repos grow, projects span multiple
+ repos, and multiple languages are introduced. Infrastructure does not force
+ developers to trade test coverage for build speed.
+
+**We believe Bazel has the potential to fulfill this vision.**
+
+Bazel was built from the ground up to enable builds that are reproducible (a
+given set of inputs will always produce the same outputs) and portable (a build
+can be run on any machine without affecting the output).
+
+These characteristics support safe incrementality (rebuilding only changed
+inputs doesn't introduce the risk of corruption) and distributability (build
+actions are isolated and can be offloaded). By minimizing the work needed to do
+a correct build and parallelizing that work across multiple cores and remote
+systems, Bazel can make any build fast.
+
+Bazel's abstraction layer — instructions specific to languages, platforms, and
+toolchains implemented in a simple extensibility language — allows it to be
+easily applied to any context.
+
+## Bazel core competencies
+
+1. Bazel supports **multi-language, multi-platform** builds and tests. You can
+ run a single command to build and test your entire source tree, no matter
+ which combination of languages and platforms you target.
+1. Bazel builds are **fast and correct**. Every build and test run is
+ incremental, on your developers' machines and on CI.
+1. Bazel provides a **uniform, extensible language** to define builds for any
+ language or platform.
+1. Bazel allows your builds **to scale** by connecting to remote execution and
+ caching services.
+1. Bazel works across **all major development platforms** (Linux, MacOS, and
+ Windows).
+1. We accept that adopting Bazel requires effort, but **gradual adoption** is
+ possible. Bazel interfaces with de-facto standard tools for a given
+ language/platform.
+
+## Serving language communities
+
+Software engineering evolves in the context of language communities — typically,
+self-organizing groups of people who use common tools and practices.
+
+To be of use to members of a language community, high-quality Bazel rules must be
+available that integrate with the workflows and conventions of that community.
+
+Bazel is committed to be extensible and open, and to support good rulesets for
+any language.
+
+### Requirements of a good ruleset
+
+1. The rules need to support efficient **building and testing** for the
+ language, including code coverage.
+1. The rules need to **interface with a widely-used "package manager"** for the
+ language (such as Maven for Java), and support incremental migration paths
+ from other widely-used build systems.
+1. The rules need to be **extensible and interoperable**, following
+ ["Bazel sandwich"](https://github.com/bazelbuild/bazel-website/blob/master/designs/_posts/2016-08-04-extensibility-for-native-rules.md)
+ principles.
+1. The rules need to be **remote-execution ready**. In practice, this means
+ **configurable using the [toolchains](/extending/toolchains) mechanism**.
+1. The rules (and Bazel) need to interface with a **widely-used IDE** for the
+ language, if there is one.
+1. The rules need to have **thorough, usable documentation,** with introductory
+ material for new users, comprehensive docs for expert users.
+
+Each of these items is essential and only together do they deliver on Bazel's
+competencies for their particular ecosystem.
+
+They are also, by and large, sufficient - once all are fulfilled, Bazel fully
+delivers its value to members of that language community.
+
+---
+
+## Why Bazel?
+- URL: https://bazel.build/about/why
+- Source: about/why.mdx
+- Slug: /about/why
+
+Bazel is a [fast](#fast), [correct](#correct), and [extensible](#extensible)
+build tool with [integrated testing](#integrated-testing) that supports multiple
+[languages](#multi-language), [repositories](#multi-repository), and
+[platforms](#multi-platform) in an industry-leading [ecosystem](#ecosystem).
+
+## Bazel is fast
+
+Bazel knows exactly what input files each build command needs, avoiding
+unnecessary work by re-running only when the set of input files have
+changed between each build.
+It runs build commands with as much parallelism as possible, either within the
+same computer or on [remote build nodes](/remote/rbe). If the structure of build
+allows for it, it can run thousands of build or test commands at the same time.
+
+This is supported by multiple caching layers, in memory, on disk and on the
+remote build farm, if available. At Google, we routinely achieve cache hit rates
+north of 99%.
+
+## Bazel is correct
+
+Bazel ensures that your binaries are built *only* from your own
+source code. Bazel actions run in individual sandboxes and Bazel tracks
+every input file of the build, only and always re-running build
+commands when it needs to. This keeps your binaries up-to-date so that the
+[same source code always results in the same binary](/basics/hermeticity), bit
+by bit.
+
+Say goodbye to endless `make clean` invocations and to chasing phantom bugs
+that were in fact resolved in source code that never got built.
+
+## Bazel is extensible
+
+Harness the full power of Bazel by writing your own rules and macros to
+customize Bazel for your specific needs across a wide range of projects.
+
+Bazel rules are written in [Starlark](/rules/language), our
+in-house programming language that's a subset of Python. Starlark makes
+rule-writing accessible to most developers, while also creating rules that can
+be used across the ecosystem.
+
+## Integrated testing
+
+Bazel's [integrated test runner](/docs/user-manual#running-tests)
+knows and runs only those tests needing to be re-run, using remote execution
+(if available) to run them in parallel. Detect flakes early by using remote
+execution to quickly run a test thousands of times.
+
+Bazel [provides facilities](/remote/bep) to upload test results to a central
+location, thereby facilitating efficient communication of test outcomes, be it
+on CI or by individual developers.
+
+## Multi-language support
+
+Bazel supports many common programming languages including C++, Java,
+Kotlin, Python, Go, and Rust. You can build multiple binaries (for example,
+backend, web UI and mobile app) in the same Bazel invocation without being
+constrained to one language's idiomatic build tool.
+
+## Multi-repository support
+
+Bazel can [gather source code from multiple locations](/external/overview): you
+don't need to vendor your dependencies (but you can!), you can instead point
+Bazel to the location of your source code or prebuilt artifacts (e.g. a git
+repository or Maven Central), and it takes care of the rest.
+
+## Multi-platform support
+
+Bazel can simultaneously build projects for multiple platforms including Linux,
+macOS, Windows, and Android. It also provides powerful
+[cross-compilation capabilities](/extending/platforms) to build code for one
+platform while running the build on another.
+
+## Wide ecosystem
+
+[Industry leaders](/community/users) love Bazel, building a large
+community of developers who use and contribute to Bazel. Find a tools, services
+and documentation, including [consulting and SaaS offerings](/community/experts)
+Bazel can use. Explore extensions like support for programming languages in
+our [open source software repositories](/rules).
+
+---
+
+## Breaking down build performance
+- URL: https://bazel.build/advanced/performance/build-performance-breakdown
+- Source: advanced/performance/build-performance-breakdown.mdx
+- Slug: /advanced/performance/build-performance-breakdown
+
+Bazel is complex and does a lot of different things over the course of a build,
+some of which can have an impact on build performance. This page attempts to map
+some of these Bazel concepts to their implications on build performance. While
+not extensive, we have included some examples of how to detect build performance
+issues through [extracting metrics](/configure/build-performance-metrics)
+and what you can do to fix them. With this, we hope you can apply these concepts
+when investigating build performance regressions.
+
+### Clean vs Incremental builds
+
+A clean build is one that builds everything from scratch, while an incremental
+build reuses some already completed work.
+
+We suggest looking at clean and incremental builds separately, especially when
+you are collecting / aggregating metrics that are dependent on the state of
+Bazel’s caches (for example
+[build request size metrics](#deterministic-build-metrics-as-a-proxy-for-build-performance)
+). They also represent two different user experiences. As compared to starting
+a clean build from scratch (which takes longer due to a cold cache), incremental
+builds happen far more frequently as developers iterate on code (typically
+faster since the cache is usually already warm).
+
+You can use the `CumulativeMetrics.num_analyses` field in the BEP to classify
+builds. If `num_analyses <= 1`, it is a clean build; otherwise, we can broadly
+categorize it to likely be an incremental build - the user could have switched
+to different flags or different targets causing an effectively clean build. Any
+more rigorous definition of incrementality will likely have to come in the form
+of a heuristic, for example looking at the number of packages loaded
+(`PackageMetrics.packages_loaded`).
+
+### Deterministic build metrics as a proxy for build performance
+
+Measuring build performance can be difficult due to the non-deterministic nature
+of certain metrics (for example Bazel’s CPU time or queue times on a remote
+cluster). As such, it can be useful to use deterministic metrics as a proxy for
+the amount of work done by Bazel, which in turn affects its performance.
+
+The size of a build request can have a significant implication on build
+performance. A larger build could represent more work in analyzing and
+constructing the build graphs. Organic growth of builds comes naturally with
+development, as more dependencies are added/created, and thus grow in complexity
+and become more expensive to build.
+
+We can slice this problem into the various build phases, and use the following
+metrics as proxy metrics for work done at each phase:
+
+1. `PackageMetrics.packages_loaded`: the number of packages successfully loaded.
+ A regression here represents more work that needs to be done to read and parse
+ each additional BUILD file in the loading phase.
+ - This is often due to the addition of dependencies and having to load their
+ transitive closure.
+ - Use [query](/query/quickstart) / [cquery](/query/cquery) to find
+ where new dependencies might have been added.
+
+2. `TargetMetrics.targets_configured`: representing the number of targets and
+ aspects configured in the build. A regression represents more work in
+ constructing and traversing the configured target graph.
+ - This is often due to the addition of dependencies and having to construct
+ the graph of their transitive closure.
+ - Use [cquery](/query/cquery) to find where new
+ dependencies might have been added.
+
+3. `ActionSummary.actions_created`: represents the actions created in the build,
+ and a regression represents more work in constructing the action graph. Note
+ that this also includes unused actions that might not have been executed.
+ - Use [aquery](/query/aquery) for debugging regressions;
+ we suggest starting with
+ [`--output=summary`](/reference/command-line-reference#flag--output)
+ before further drilling down with
+ [`--skyframe_state`](/reference/command-line-reference#flag--skyframe_state).
+
+4. `ActionSummary.actions_executed`: the number of actions executed, a
+ regression directly represents more work in executing these actions.
+ - The [BEP](/remote/bep) writes out the action statistics
+ `ActionData` that shows the most executed action types. By default, it
+ collects the top 20 action types, but you can pass in the
+ [`--experimental_record_metrics_for_all_mnemonics`](/reference/command-line-reference#flag--experimental_record_metrics_for_all_mnemonics)
+ to collect this data for all action types that were executed.
+ - This should help you to figure out what kind of actions were executed
+ (additionally).
+
+5. `BuildGraphSummary.outputArtifactCount`: the number of artifacts created by
+ the executed actions.
+ - If the number of actions executed did not increase, then it is likely that
+ a rule implementation was changed.
+
+
+These metrics are all affected by the state of the local cache, hence you will
+want to ensure that the builds you extract these metrics from are
+**clean builds**.
+
+We have noted that a regression in any of these metrics can be accompanied by
+regressions in wall time, cpu time and memory usage.
+
+### Usage of local resources
+
+Bazel consumes a variety of resources on your local machine (both for analyzing
+the build graph and driving the execution, and for running local actions), this
+can affect the performance / availability of your machine in performing the
+build, and also other tasks.
+
+#### Time spent
+
+Perhaps the metrics most susceptible to noise (and can vary greatly from build
+to build) is time; in particular - wall time, cpu time and system time. You can
+use [bazel-bench](https://github.com/bazelbuild/bazel-bench) to get
+a benchmark for these metrics, and with a sufficient number of `--runs`, you can
+increase the statistical significance of your measurement.
+
+- **Wall time** is the real world time elapsed.
+ - If _only_ wall time regresses, we suggest collecting a
+ [JSON trace profile](/advanced/performance/json-trace-profile) and looking
+ for differences. Otherwise, it would likely be more efficient to
+ investigate other regressed metrics as they could have affected the wall
+ time.
+
+- **CPU time** is the time spent by the CPU executing user code.
+ - If the CPU time regresses across two project commits, we suggest collecting
+ a Starlark CPU profile. You should probably also use `--nobuild` to
+ restrict the build to the analysis phase since that is where most of the
+ CPU heavy work is done.
+
+- System time is the time spent by the CPU in the kernel.
+ - If system time regresses, it is mostly correlated with I/O when Bazel reads
+ files from your file system.
+
+#### System-wide load profiling
+
+Using the
+[`--experimental_collect_load_average_in_profiler`](https://github.com/bazelbuild/bazel/blob/6.0.0/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java#L306-L312)
+flag introduced in Bazel 6.0, the
+[JSON trace profiler](/advanced/performance/json-trace-profile) collects the
+system load average during the invocation.
+
+
+
+**Figure 1.** Profile that includes system load average.
+
+A high load during a Bazel invocation can be an indication that Bazel schedules
+too many local actions in parallel for your machine. You might want to look into
+adjusting
+[`--local_cpu_resources`](/reference/command-line-reference#flag--local_cpu_resources)
+and [`--local_ram_resources`](/reference/command-line-reference#flag--local_ram_resources),
+especially in container environments (at least until
+[#16512](https://github.com/bazelbuild/bazel/pull/16512) is merged).
+
+
+#### Monitoring Bazel memory usage
+
+There are two main sources to get Bazel’s memory usage, Bazel `info` and the
+[BEP](/remote/bep).
+
+- `bazel info used-heap-size-after-gc`: The amount of used memory in bytes after
+ a call to `System.gc()`.
+ - [Bazel bench](https://github.com/bazelbuild/bazel-bench)
+ provides benchmarks for this metric as well.
+ - Additionally, there are `peak-heap-size`, `max-heap-size`, `used-heap-size`
+ and `committed-heap-size` (see
+ [documentation](/docs/user-manual#configuration-independent-data)), but are
+ less relevant.
+
+- [BEP](/remote/bep)’s
+ `MemoryMetrics.peak_post_gc_heap_size`: Size of the peak JVM heap size in
+ bytes post GC (requires setting
+ [`--memory_profile`](/reference/command-line-reference#flag--memory_profile)
+ that attempts to force a full GC).
+
+A regression in memory usage is usually a result of a regression in
+[build request size metrics](#deterministic_build_metrics_as_a_proxy_for_build_performance),
+which are often due to addition of dependencies or a change in the rule
+implementation.
+
+To analyze Bazel’s memory footprint on a more granular level, we recommend using
+the [built-in memory profiler](/rules/performance#memory-profiling)
+for rules.
+
+#### Memory profiling of persistent workers
+
+While [persistent workers](/remote/persistent) can help to speed up builds
+significantly (especially for interpreted languages) their memory footprint can
+be problematic. Bazel collects metrics on its workers, in particular, the
+`WorkerMetrics.WorkerStats.worker_memory_in_kb` field tells how much memory
+workers use (by mnemonic).
+
+The [JSON trace profiler](/advanced/performance/json-trace-profile) also
+collects persistent worker memory usage during the invocation by passing in the
+[`--experimental_collect_system_network_usage`](https://github.com/bazelbuild/bazel/blob/6.0.0/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java#L314-L320)
+flag (new in Bazel 6.0).
+
+
+
+**Figure 2.** Profile that includes workers memory usage.
+
+Lowering the value of
+[`--worker_max_instances`](/reference/command-line-reference#flag--worker_max_instances)
+(default 4) might help to reduce
+the amount of memory used by persistent workers. We are actively working on
+making Bazel’s resource manager and scheduler smarter so that such fine tuning
+will be required less often in the future.
+
+### Monitoring network traffic for remote builds
+
+In remote execution, Bazel downloads artifacts that were built as a result of
+executing actions. As such, your network bandwidth can affect the performance
+of your build.
+
+If you are using remote execution for your builds, you might want to consider
+monitoring the network traffic during the invocation using the
+`NetworkMetrics.SystemNetworkStats` proto from the [BEP](/remote/bep)
+(requires passing `--experimental_collect_system_network_usage`).
+
+Furthermore, [JSON trace profiles](/advanced/performance/json-trace-profile)
+allow you to view system-wide network usage throughout the course of the build
+by passing the `--experimental_collect_system_network_usage` flag (new in Bazel
+6.0).
+
+
+
+**Figure 3.** Profile that includes system-wide network usage.
+
+A high but rather flat network usage when using remote execution might indicate
+that network is the bottleneck in your build; if you are not using it already,
+consider turning on Build without the Bytes by passing
+[`--remote_download_minimal`](/reference/command-line-reference#flag--remote_download_minimal).
+This will speed up your builds by avoiding the download of unnecessary intermediate artifacts.
+
+Another option is to configure a local
+[disk cache](/reference/command-line-reference#flag--disk_cache) to save on
+download bandwidth.
+
+---
+
+## Extracting build performance metrics
+- URL: https://bazel.build/advanced/performance/build-performance-metrics
+- Source: advanced/performance/build-performance-metrics.mdx
+- Slug: /advanced/performance/build-performance-metrics
+
+Probably every Bazel user has experienced builds that were slow or slower than
+anticipated. Improving the performance of individual builds has particular value
+for targets with significant impact, such as:
+
+1. Core developer targets that are frequently iterated on and (re)built.
+
+2. Common libraries widely depended upon by other targets.
+
+3. A representative target from a class of targets (e.g. custom rules),
+ diagnosing and fixing issues in one build might help to resolve issues at the
+ larger scale.
+
+An important step to improving the performance of builds is to understand where
+resources are spent. This page lists different metrics you can collect.
+[Breaking down build performance](/configure/build-performance-breakdown) showcases
+how you can use these metrics to detect and fix build performance issues.
+
+There are a few main ways to extract metrics from your Bazel builds, namely:
+
+## Build Event Protocol (BEP)
+
+Bazel outputs a variety of protocol buffers
+[`build_event_stream.proto`](https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto)
+through the [Build Event Protocol (BEP)](/remote/bep), which
+can be aggregated by a backend specified by you. Depending on your use cases,
+you might decide to aggregate the metrics in various ways, but here we will go
+over some concepts and proto fields that would be useful in general to consider.
+
+## Bazel’s query / cquery / aquery commands
+
+Bazel provides 3 different query modes ([query](/query/quickstart),
+[cquery](/query/cquery) and [aquery](/query/aquery)) that allow users
+to query the target graph, configured target graph and action graph
+respectively. The query language provides a
+[suite of functions](/query/language#functions) usable across the different
+query modes, that allows you to customize your queries according to your needs.
+
+## JSON Trace Profiles
+
+For every build-like Bazel invocation, Bazel writes a trace profile in JSON
+format. The [JSON trace profile](/advanced/performance/json-trace-profile) can
+be very useful to quickly understand what Bazel spent time on during the
+invocation.
+
+## Execution Log
+
+The [execution log](/remote/cache-remote) can help you to troubleshoot and fix
+missing remote cache hits due to machine and environment differences or
+non-deterministic actions. If you pass the flag
+[`--experimental_execution_log_spawn_metrics`](/reference/command-line-reference#flag--experimental_execution_log_spawn_metrics)
+(available from Bazel 5.2) it will also contain detailed spawn metrics, both for
+locally and remotely executed actions. You can use these metrics for example to
+make comparisons between local and remote machine performance or to find out
+which part of the spawn execution is consistently slower than expected (for
+example due to queuing).
+
+## Execution Graph Log
+
+While the JSON trace profile contains the critical path information, sometimes
+you need additional information on the dependency graph of the executed actions.
+Starting with Bazel 6.0, you can pass the flags
+`--experimental_execution_graph_log` and
+`--experimental_execution_graph_log_dep_type=all` to write out a log about the
+executed actions and their inter-dependencies.
+
+This information can be used to understand the drag that is added by a node on
+the critical path. The drag is the amount of time that can potentially be saved
+by removing a particular node from the execution graph.
+
+The data helps you predict the impact of changes to the build and action graph
+before you actually do them.
+
+## Benchmarking with bazel-bench
+
+[Bazel bench](https://github.com/bazelbuild/bazel-bench) is a
+benchmarking tool for Git projects to benchmark build performance in the
+following cases:
+
+* **Project benchmark:** Benchmarking two git commits against each other at a
+ single Bazel version. Used to detect regressions in your build (often through
+ the addition of dependencies).
+
+* **Bazel benchmark:** Benchmarking two versions of Bazel against each other at
+ a single git commit. Used to detect regressions within Bazel itself (if you
+ happen to maintain / fork Bazel).
+
+Benchmarks monitor wall time, CPU time and system time and Bazel’s retained
+heap size.
+
+It is also recommended to run Bazel bench on dedicated, physical machines that
+are not running other processes so as to reduce sources of variability.
+
+---
+
+## Optimize Iteration Speed
+- URL: https://bazel.build/advanced/performance/iteration-speed
+- Source: advanced/performance/iteration-speed.mdx
+- Slug: /advanced/performance/iteration-speed
+
+This page describes how to optimize Bazel's build performance when running Bazel
+repeatedly.
+
+## Bazel's Runtime State
+
+A Bazel invocation involves several interacting parts.
+
+* The `bazel` command line interface (CLI) is the user-facing front-end tool
+ and receives commands from the user.
+
+* The CLI tool starts a [*Bazel server*](https://bazel.build/run/client-server)
+ for each distinct [output base](https://bazel.build/remote/output-directories).
+ The Bazel server is generally persistent, but will shut down after some idle
+ time so as to not waste resources.
+
+* The Bazel server performs the loading and analysis steps for a given command
+ (`build`, `run`, `cquery`, etc.), in which it constructs the necessary parts
+ of the build graph in memory. The resulting data structures are retained in
+ the Bazel server as part of the *analysis cache*.
+
+* The Bazel server can also perform the action execution, or it can send
+ actions off for remote execution if it is set up to do so. The results of
+ action executions are also cached, namely in the *action cache* (or
+ *execution cache*, which may be either local or remote, and it may be shared
+ among Bazel servers).
+
+* The result of the Bazel invocation is made available in the output tree.
+
+## Running Bazel Iteratively
+
+In a typical developer workflow, it is common to build (or run) a piece of code
+repeatedly, often at a very high frequency (e.g. to resolve some compilation
+error or investigate a failing test). In this situation, it is important that
+repeated invocations of `bazel` have as little overhead as possible relative to
+the underlying, repeated action (e.g. invoking a compiler, or executing a test).
+
+With this in mind, we take another look at Bazel's runtime state:
+
+The analysis cache is a critical piece of data. A significant amount of time can
+be spent just on the loading and analysis phases of a cold run (i.e. a run just
+after the Bazel server was started or when the analysis cache was discarded).
+For a single, successful cold build (e.g. for a production release) this cost is
+bearable, but for repeatedly building the same target it is important that this
+cost be amortized and not repeated on each invocation.
+
+The analysis cache is rather volatile. First off, it is part of the in-process
+state of the Bazel server, so losing the server loses the cache. But the cache
+is also *invalidated* very easily: for example, many `bazel` command line flags
+cause the cache to be discarded. This is because many flags affect the build
+graph (e.g. because of
+[configurable attributes](https://bazel.build/configure/attributes)). Some flag
+changes can also cause the Bazel server to be restarted (e.g. changing
+[startup options](https://bazel.build/docs/user-manual#startup-options)).
+
+A good execution cache is also valuable for build performance. An execution
+cache can be kept locally
+[on disk](https://bazel.build/remote/caching#disk-cache), or
+[remotely](https://bazel.build/remote/caching). The cache can be shared among
+Bazel servers, and indeed among developers.
+
+## Avoid discarding the analysis cache
+
+Bazel will print a warning if either the analysis cache was discarded or the
+server was restarted. Either of these should be avoided during iterative use:
+
+* Be mindful of changing `bazel` flags in the middle of an iterative
+ workflow. For example, mixing a `bazel build -c opt` with a `bazel cquery`
+ causes each command to discard the analysis cache of the other. In general,
+ try to use a fixed set of flags for the duration of a particular workflow.
+
+* Losing the Bazel server loses the analysis cache. The Bazel server has a
+ [configurable](https://bazel.build/docs/user-manual#max-idle-secs) idle
+ time, after which it shuts down. You can configure this time via your
+ bazelrc file to suit your needs. The server also restarted when startup
+ flags change, so, again, avoid changing those flags if possible.
+
+*