You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: about/faq.mdx
+38-36Lines changed: 38 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
title: 'FAQ'
3
3
---
4
4
5
+
6
+
5
7
If you have questions or need support, see [Getting Help](/help).
6
8
7
9
## What is Bazel?
@@ -12,19 +14,19 @@ Bazel is a tool that automates software builds and tests. Supported build tasks
12
14
13
15
Bazel was designed to fit the way software is developed at Google. It has the following features:
14
16
15
-
- Multi-language support: Bazel supports [many languages](/reference/be/overview), and can be extended to support arbitrary programming languages.
16
-
- 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.
17
-
- 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.
18
-
- 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.
19
-
-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.
17
+
* Multi-language support: Bazel supports [many languages](/reference/be/overview), and can be extended to support arbitrary programming languages.
18
+
* 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.
19
+
* 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.
20
+
* 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.
21
+
*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.
20
22
21
23
## Why doesn’t Google use...?
22
24
23
-
- 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.
24
-
- 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.
25
-
- 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.
26
-
- 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.
27
-
- 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.
25
+
* 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.
26
+
* 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.
27
+
* 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.
28
+
* 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.
29
+
* 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.
28
30
29
31
## Where did Bazel come from?
30
32
@@ -46,10 +48,10 @@ Bazel runs build operations locally by default. However, Bazel can also connect
46
48
47
49
For our server code base, we use the following development workflow:
48
50
49
-
- All our server code is in a single, gigantic version control system.
50
-
- Everybody builds their software with Bazel.
51
-
- Different teams own different parts of the source tree, and make their components available as `BUILD` targets.
52
-
- Branching is primarily used for managing releases, so everybody develops their software at the head revision.
51
+
* All our server code is in a single, gigantic version control system.
52
+
* Everybody builds their software with Bazel.
53
+
* Different teams own different parts of the source tree, and make their components available as `BUILD` targets.
54
+
* Branching is primarily used for managing releases, so everybody develops their software at the head revision.
53
55
54
56
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.
55
57
@@ -61,22 +63,24 @@ Building software should be fun and easy. Slow and unpredictable builds take the
61
63
62
64
## Why would I want to use Bazel?
63
65
64
-
- 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.
65
-
- Bazel produces deterministic results. This eliminates skew between incremental and clean builds, laptop and CI system, etc.
66
-
- 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.
66
+
* 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.
67
+
* Bazel produces deterministic results. This eliminates skew between incremental and clean builds, laptop and CI system, etc.
68
+
* 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.
67
69
68
70
## Can I see examples?
69
71
70
-
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.
72
+
Yes; see a [simple example](https://github.com/bazelbuild/bazel/blob/master/examples/cpp/BUILD)
73
+
or read the [Bazel source code](https://github.com/bazelbuild/bazel/blob/master/src/BUILD) for a more complex example.
74
+
71
75
72
76
## What is Bazel best at?
73
77
74
78
Bazel shines at building and testing projects with the following properties:
75
79
76
-
- Projects with a large codebase
77
-
- Projects written in (multiple) compiled languages
78
-
- Projects that deploy on multiple platforms
79
-
- Projects that have extensive tests
80
+
* Projects with a large codebase
81
+
* Projects written in (multiple) compiled languages
82
+
* Projects that deploy on multiple platforms
83
+
* Projects that have extensive tests
80
84
81
85
## Where can I run Bazel?
82
86
@@ -86,13 +90,11 @@ Porting to other UNIX platforms should be relatively easy, as long as a JDK is a
86
90
87
91
## What should I not use Bazel for?
88
92
89
-
- 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:
90
-
91
-
- A compilation step that fetches data from the internet.
92
-
- A test step that connects to the QA instance of your site.
93
-
- A deployment step that changes your site’s cloud configuration.
94
-
95
-
- 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.
93
+
* 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:
94
+
* A compilation step that fetches data from the internet.
95
+
* A test step that connects to the QA instance of your site.
96
+
* A deployment step that changes your site’s cloud configuration.
97
+
* 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.
96
98
97
99
## How stable is Bazel’s feature set?
98
100
@@ -130,10 +132,10 @@ Yes, you can use our [Docker rules](https://github.com/bazelbuild/rules_docker)
130
132
131
133
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:
132
134
133
-
- Do not use dependencies that were not declared. Sandboxed execution (–spawn\_strategy=sandboxed, only on Linux) can help find undeclared dependencies.
134
-
- Avoid storing timestamps and user-IDs in generated files. ZIP files and other archives are especially prone to this.
135
-
- Avoid connecting to the network. Sandboxed execution can help here too.
136
-
- Avoid processes that use random numbers, in particular, dictionary traversal is randomized in many programming languages.
135
+
* Do not use dependencies that were not declared. Sandboxed execution (–spawn\_strategy=sandboxed, only on Linux) can help find undeclared dependencies.
136
+
* Avoid storing timestamps and user-IDs in generated files. ZIP files and other archives are especially prone to this.
137
+
* Avoid connecting to the network. Sandboxed execution can help here too.
138
+
* Avoid processes that use random numbers, in particular, dictionary traversal is randomized in many programming languages.
137
139
138
140
## Do you have binary releases?
139
141
@@ -177,8 +179,8 @@ We still have to refactor the interfaces between the public code in Bazel and ou
177
179
178
180
Open sourcing Bazel is a work-in-progress. In particular, we’re still working on open sourcing:
179
181
180
-
- Many of our unit and integration tests (which should make contributing patches easier).
181
-
- Full IDE integration.
182
+
* Many of our unit and integration tests (which should make contributing patches easier).
183
+
* Full IDE integration.
182
184
183
185
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.
184
186
@@ -188,7 +190,7 @@ Yes, some of the code base either integrates with Google-specific technology or
188
190
189
191
## How do I contact the team?
190
192
191
-
We are reachable at [bazel-discuss@googlegroups.com](mailto:bazel-discuss@googlegroups.com).
193
+
We are reachable at bazel-discuss@googlegroups.com.
0 commit comments