Skip to content

Commit 675595b

Browse files
chore: update documentation from upstream Bazel repo [skip ci]
Synchronized pre-converted MDX files from upstream Bazel repository.
1 parent d0241bc commit 675595b

1,493 files changed

Lines changed: 32311 additions & 29276 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

about/faq.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ Bazel returns a non-zero exit code if the build or test invocation fails, and th
157157

158158
Further details on exit codes are in the [User Manual](/docs/user-manual).
159159

160+
## What future features can we expect in Bazel?
161+
162+
See our [Roadmaps](/about/roadmap).
163+
160164
## Can I use Bazel for my INSERT LANGUAGE HERE project?
161165

162166
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.

about/intro.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ It uses a human-readable, high-level build language. Bazel supports projects in
99
multiple languages and builds outputs for multiple platforms. Bazel supports
1010
large codebases across multiple repositories, and large numbers of users.
1111

12-
## Benefits {#benefits}
12+
## Benefits
1313

1414
Bazel offers the following advantages:
1515

@@ -38,7 +38,7 @@ Bazel offers the following advantages:
3838
supported, and you can extend Bazel to support any other language or
3939
framework.
4040

41-
## Using Bazel {#using-bazel}
41+
## Using Bazel
4242

4343
To build or test a project with Bazel, you typically do the following:
4444

@@ -71,7 +71,7 @@ In addition to building, you can also use Bazel to run
7171
[tests](/reference/test-encyclopedia) and [query](/query/guide) the build
7272
to trace dependencies in your code.
7373

74-
## Bazel build process {#bazel-build-process}
74+
## Bazel build process
7575

7676
When running a build or a test, Bazel does the following:
7777

@@ -91,7 +91,7 @@ correctness, you can set up Bazel to run builds and tests
9191
[hermetically](/basics/hermeticity) through sandboxing, minimizing skew
9292
and maximizing [reproducibility](/run/build#correct-incremental-rebuilds).
9393

94-
### Action graph {#action-graph}
94+
### Action graph
9595

9696
The action graph represents the build artifacts, the relationships between them,
9797
and the build actions that Bazel will perform. Thanks to this graph, Bazel can
@@ -100,7 +100,7 @@ file content as well as changes to actions, such as build or test commands, and
100100
know what build work has previously been done. The graph also enables you to
101101
easily [trace dependencies](/query/guide) in your code.
102102

103-
## Getting started tutorials {#getting-started-tutorials}
103+
## Getting started tutorials
104104

105105
To get started with Bazel, see [Getting Started](/start/) or jump
106106
directly to the Bazel tutorials:

about/vision.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Bazel's abstraction layer — instructions specific to languages, platforms, and
4545
toolchains implemented in a simple extensibility language — allows it to be
4646
easily applied to any context.
4747

48-
## Bazel core competencies {#bazel-core-competencies}
48+
## Bazel core competencies
4949

5050
1. Bazel supports **multi-language, multi-platform** builds and tests. You can
5151
run a single command to build and test your entire source tree, no matter
@@ -62,7 +62,7 @@ easily applied to any context.
6262
possible. Bazel interfaces with de-facto standard tools for a given
6363
language/platform.
6464

65-
## Serving language communities {#language-communities}
65+
## Serving language communities
6666

6767
Software engineering evolves in the context of language communities — typically,
6868
self-organizing groups of people who use common tools and practices.
@@ -73,7 +73,7 @@ available that integrate with the workflows and conventions of that community.
7373
Bazel is committed to be extensible and open, and to support good rulesets for
7474
any language.
7575

76-
### Requirements of a good ruleset {#ruleset-requirements}
76+
### Requirements of a good ruleset
7777

7878
1. The rules need to support efficient **building and testing** for the
7979
language, including code coverage.

about/why.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build tool with [integrated testing](#integrated-testing) that supports multiple
99
[languages](#multi-language), [repositories](#multi-repository), and
1010
[platforms](#multi-platform) in an industry-leading [ecosystem](#ecosystem).
1111

12-
## Bazel is fast {#fast}
12+
## Bazel is fast
1313

1414
Bazel knows exactly what input files each build command needs, avoiding
1515
unnecessary work by re-running only when the set of input files have
@@ -22,7 +22,7 @@ This is supported by multiple caching layers, in memory, on disk and on the
2222
remote build farm, if available. At Google, we routinely achieve cache hit rates
2323
north of 99%.
2424

25-
## Bazel is correct {#correct}
25+
## Bazel is correct
2626

2727
Bazel ensures that your binaries are built *only* from your own
2828
source code. Bazel actions run in individual sandboxes and Bazel tracks
@@ -34,7 +34,7 @@ by bit.
3434
Say goodbye to endless `make clean` invocations and to chasing phantom bugs
3535
that were in fact resolved in source code that never got built.
3636

37-
## Bazel is extensible {#extensible}
37+
## Bazel is extensible
3838

3939
Harness the full power of Bazel by writing your own rules and macros to
4040
customize Bazel for your specific needs across a wide range of projects.
@@ -44,7 +44,7 @@ in-house programming language that's a subset of Python. Starlark makes
4444
rule-writing accessible to most developers, while also creating rules that can
4545
be used across the ecosystem.
4646

47-
## Integrated testing {#integrated-testing}
47+
## Integrated testing
4848

4949
Bazel's [integrated test runner](/docs/user-manual#running-tests)
5050
knows and runs only those tests needing to be re-run, using remote execution
@@ -55,28 +55,28 @@ Bazel [provides facilities](/remote/bep) to upload test results to a central
5555
location, thereby facilitating efficient communication of test outcomes, be it
5656
on CI or by individual developers.
5757

58-
## Multi-language support {#multi-language}
58+
## Multi-language support
5959

6060
Bazel supports many common programming languages including C++, Java,
6161
Kotlin, Python, Go, and Rust. You can build multiple binaries (for example,
6262
backend, web UI and mobile app) in the same Bazel invocation without being
6363
constrained to one language's idiomatic build tool.
6464

65-
## Multi-repository support {#multi-repository}
65+
## Multi-repository support
6666

6767
Bazel can [gather source code from multiple locations](/external/overview): you
6868
don't need to vendor your dependencies (but you can!), you can instead point
6969
Bazel to the location of your source code or prebuilt artifacts (e.g. a git
7070
repository or Maven Central), and it takes care of the rest.
7171

72-
## Multi-platform support {#multi-platform}
72+
## Multi-platform support
7373

7474
Bazel can simultaneously build projects for multiple platforms including Linux,
7575
macOS, Windows, and Android. It also provides powerful
7676
[cross-compilation capabilities](/extending/platforms) to build code for one
7777
platform while running the build on another.
7878

79-
## Wide ecosystem {#ecosystem}
79+
## Wide ecosystem
8080

8181
[Industry leaders](/community/users) love Bazel, building a large
8282
community of developers who use and contribute to Bazel. Find a tools, services

advanced/performance/build-performance-metrics.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ how you can use these metrics to detect and fix build performance issues.
2323

2424
There are a few main ways to extract metrics from your Bazel builds, namely:
2525

26-
## Build Event Protocol (BEP) {#build-event-protocol}
26+
## Build Event Protocol (BEP)
2727

2828
Bazel outputs a variety of protocol buffers
2929
[`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)
@@ -32,7 +32,7 @@ can be aggregated by a backend specified by you. Depending on your use cases,
3232
you might decide to aggregate the metrics in various ways, but here we will go
3333
over some concepts and proto fields that would be useful in general to consider.
3434

35-
## Bazel’s query / cquery / aquery commands {#bazel-commands-query-cquery-aquery}
35+
## Bazel’s query / cquery / aquery commands
3636

3737
Bazel provides 3 different query modes ([query](/query/quickstart),
3838
[cquery](/query/cquery) and [aquery](/query/aquery)) that allow users
@@ -41,14 +41,14 @@ respectively. The query language provides a
4141
[suite of functions](/query/language#functions) usable across the different
4242
query modes, that allows you to customize your queries according to your needs.
4343

44-
## JSON Trace Profiles {#json-trace-profiles}
44+
## JSON Trace Profiles
4545

4646
For every build-like Bazel invocation, Bazel writes a trace profile in JSON
4747
format. The [JSON trace profile](/advanced/performance/json-trace-profile) can
4848
be very useful to quickly understand what Bazel spent time on during the
4949
invocation.
5050

51-
## Execution Log {#execution-log}
51+
## Execution Log
5252

5353
The [execution log](/remote/cache-remote) can help you to troubleshoot and fix
5454
missing remote cache hits due to machine and environment differences or
@@ -60,7 +60,7 @@ make comparisons between local and remote machine performance or to find out
6060
which part of the spawn execution is consistently slower than expected (for
6161
example due to queuing).
6262

63-
## Execution Graph Log {#execution-graph-log}
63+
## Execution Graph Log
6464

6565
While the JSON trace profile contains the critical path information, sometimes
6666
you need additional information on the dependency graph of the executed actions.
@@ -76,7 +76,7 @@ by removing a particular node from the execution graph.
7676
The data helps you predict the impact of changes to the build and action graph
7777
before you actually do them.
7878

79-
## Benchmarking with bazel-bench {#bazel-bench}
79+
## Benchmarking with bazel-bench
8080

8181
[Bazel bench](https://github.com/bazelbuild/bazel-bench) is a
8282
benchmarking tool for Git projects to benchmark build performance in the

advanced/performance/iteration-speed.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: 'Optimize Iteration Speed'
77
This page describes how to optimize Bazel's build performance when running Bazel
88
repeatedly.
99

10-
## Bazel's Runtime State {#bazel-runtime-state}
10+
## Bazel's Runtime State
1111

1212
A Bazel invocation involves several interacting parts.
1313

@@ -32,7 +32,7 @@ A Bazel invocation involves several interacting parts.
3232

3333
* The result of the Bazel invocation is made available in the output tree.
3434

35-
## Running Bazel Iteratively {#run-iteratively}
35+
## Running Bazel Iteratively
3636

3737
In a typical developer workflow, it is common to build (or run) a piece of code
3838
repeatedly, often at a very high frequency (e.g. to resolve some compilation
@@ -64,7 +64,7 @@ cache can be kept locally
6464
[remotely](https://bazel.build/remote/caching). The cache can be shared among
6565
Bazel servers, and indeed among developers.
6666

67-
## Avoid discarding the analysis cache {#avoid-discarding-cache}
67+
## Avoid discarding the analysis cache
6868

6969
Bazel will print a warning if either the analysis cache was discarded or the
7070
server was restarted. Either of these should be avoided during iterative use:

advanced/performance/json-trace-profile.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ $ zcat $(../bazel-6.0.0rc1-linux-x86_64 info output_base)/command.profile.gz | j
7676
[...]
7777
```
7878

79-
## Profile information {#profile-information}
79+
## Profile information
8080

8181
The profile contains multiple rows. Usually the bulk of rows represent Bazel
8282
threads and their corresponding events, but some special rows are also included.
@@ -99,7 +99,7 @@ Figure 1 shows a profile created with Bazel v5.3.1 and includes these rows:
9999
* `Garbage Collector`: Displays minor and major Garbage Collection (GC)
100100
pauses.
101101

102-
## Common performance issues {#common-performance-issues}
102+
## Common performance issues
103103

104104
When analyzing performance profiles, look for:
105105

@@ -117,7 +117,7 @@ When analyzing performance profiles, look for:
117117
or Bazel itself to introduce more parallelism. This can also happen when
118118
there is an unusual amount of GC.
119119

120-
## Profile file format {#profile-file-format}
120+
## Profile file format
121121

122122
The top-level object contains metadata (`otherData`) and the actual tracing data
123123
(`traceEvents`). The metadata contains extra info, for example the invocation ID

advanced/performance/memory.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ title: 'Optimize Memory'
66

77
This page describes how to limit and reduce the memory Bazel uses.
88

9-
## Running Bazel with Limited RAM {#running-bazel}
9+
## Running Bazel with Limited RAM
1010

1111
In certain situations, you may want Bazel to use minimal memory. You can set the
1212
maximum heap via the startup flag
1313
[`--host_jvm_args`](/docs/user-manual#host-jvm-args),
1414
like `--host_jvm_args=-Xmx2g`.
1515

16-
### Trade incremental build speeds for memory {#trade-incremental}
16+
### Trade incremental build speeds for memory
1717

1818
If your builds are too big, Bazel may throw an `OutOfMemoryError` (OOM) when
1919
it doesn't have enough memory. You can make Bazel use less memory, at the cost
@@ -40,7 +40,7 @@ prevent most re-execution).
4040
incremental builds have to build from scratch (except for the on-disk action
4141
cache). Alone, it does not affect the high-water mark of the current build.
4242

43-
### Trade build flexibility for memory with Skyfocus (Experimental) {#trade-flexibility}
43+
### Trade build flexibility for memory with Skyfocus (Experimental)
4444

4545
If you want to make Bazel use less memory *and* retain incremental build speeds,
4646
you can tell Bazel the working set of files that you will be modifying, and
@@ -59,11 +59,11 @@ changes to files outside of the working set will be disallowed, until you issue
5959
`bazel clean` or restart the Bazel server.
6060

6161
If you want to specify an exact set of files or directories, use the
62-
`--experimental_active_directories` flag, like so:
62+
`--experimental_working_set` flag, like so:
6363

6464
```sh
6565
bazel build //pkg:target --experimental_enable_skyfocus
66-
--experimental_active_directories=path/to/another/dir,path/to/tests/dir
66+
--experimental_working_set=path/to/another/dir,path/to/tests/dir
6767
```
6868

6969
You can also pass `--experimental_skyfocus_dump_post_gc_stats` to show the
@@ -72,7 +72,7 @@ memory reduction amount:
7272
Putting it altogether, you should see something like this:
7373

7474
```none
75-
$ bazel test //pkg:target //tests/... --experimental_enable_skyfocus --experimental_active_directories=dir1,dir2,dir3/subdir --experimental_skyfocus_dump_post_gc_stats
75+
$ bazel test //pkg:target //tests/... --experimental_enable_skyfocus --experimental_working_set dir1,dir2,dir3/subdir --experimental_skyfocus_dump_post_gc_stats
7676
INFO: --experimental_enable_skyfocus is enabled. Blaze will reclaim memory not needed to build the working set. Run 'blaze dump --skyframe=working_set' to show the working set, after this command.
7777
WARNING: Changes outside of the working set will cause a build error.
7878
INFO: Analyzed 149 targets (4533 packages loaded, 169438 targets configured).
@@ -89,7 +89,7 @@ and incremental builds to handle changes to files under `dir1`, `dir2`, and
8989
`dir3/subdir` will retain their fast speeds, with the tradeoff that Bazel cannot
9090
rebuild changed files outside of these directories.
9191

92-
## Memory Profiling {#memory-profiling}
92+
## Memory Profiling
9393

9494
Bazel comes with a built-in memory profiler that can help you check your rule’s
9595
memory use. Read more about this process on the

basics/hermeticity.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: 'Hermeticity'
77
This page covers hermeticity, the benefits of using hermetic builds, and
88
strategies for identifying non-hermetic behavior in your builds.
99

10-
## Overview {#overview}
10+
## Overview
1111

1212
When given the same input source code and product configuration, a hermetic
1313
build system always returns the same output by isolating the build from changes
@@ -30,7 +30,7 @@ The two important aspects of hermeticity are:
3030
unique hash code. Hermetic build systems use this hash to identify changes to
3131
the build's input.
3232

33-
## Benefits {#benefits}
33+
## Benefits
3434

3535
The major benefits of hermetic builds are:
3636

@@ -45,7 +45,7 @@ The major benefits of hermetic builds are:
4545
* **Reproducibility**: Hermetic builds are good for troubleshooting because you
4646
know the exact conditions that produced the build.
4747

48-
## Identifying non-hermeticity {#nonhermeticity}
48+
## Identifying non-hermeticity
4949

5050
If you are preparing to switch to Bazel, migration is easier if you improve
5151
your existing builds' hermeticity in advance. Some common sources of
@@ -61,7 +61,7 @@ non-hermeticity in builds are:
6161
tree, fixing the source tree for target A. Then trying to build target B may
6262
fail.
6363

64-
## Troubleshooting non-hermetic builds {#troubleshooting-nonhermeticity}
64+
## Troubleshooting non-hermetic builds
6565

6666
Starting with local execution, issues that affect local cache hits reveal
6767
non-hermetic actions.
@@ -94,7 +94,7 @@ Note: Make your build fully hermetic when mixing remote and local execution,
9494
using Bazel’s “dynamic strategy” functionality. Running Bazel inside the remote
9595
Docker container will enable the build to execute the same in both environments.
9696

97-
## Hermeticity with Bazel {#hermeticity-bazel}
97+
## Hermeticity with Bazel
9898

9999
For more information about how other projects have had success using hermetic
100100
builds with Bazel, see these BazelCon talks:

0 commit comments

Comments
 (0)