Skip to content

Commit 5a622ab

Browse files
authored
feat: populate the version drop-down (#59)
* feat: populate the version drop-down * chore: remove assertion that checked-in files match what is generated * chore: some renames to make more obvious
1 parent 4791759 commit 5a622ab

File tree

869 files changed

+198098
-28
lines changed

Some content is hidden

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

869 files changed

+198098
-28
lines changed

.github/workflows/pull-from-bazel-build.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,5 @@ jobs:
4848
- name: Transform upstream docs to mdx
4949
run: ./copy-upstream-docs.sh
5050

51-
- name: Assert that nothing is different
52-
if: ${{ github.ref != 'refs/heads/main' }}
53-
run: |
54-
if untracked=$(git status --porcelain | grep "^??"); then
55-
echo "Error: Untracked files found:"
56-
echo "$untracked"
57-
exit 1
58-
fi
59-
git diff --exit-code
51+
- name: Create versioned navigation
52+
run: ./docs.json.update.sh

6.5.0/about/faq.mdx

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
---
2+
title: 'FAQ'
3+
---
4+
5+
6+
If you have questions or need support, see [Getting Help](/help).
7+
8+
## What is Bazel?
9+
10+
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.
11+
12+
## What is special about Bazel?
13+
14+
Bazel was designed to fit the way software is developed at Google. It has the following features:
15+
16+
* Multi-language support: Bazel supports [many languages](/reference/be/overview), and can be extended to support arbitrary programming languages.
17+
* 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.
18+
* 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.
19+
* 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.
20+
* 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.
21+
22+
## Why doesn’t Google use...?
23+
24+
* 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.
25+
* 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.
26+
* 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.
27+
* 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.
28+
* 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.
29+
30+
## Where did Bazel come from?
31+
32+
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.
33+
34+
## Did you rewrite your internal tool as open-source? Is it a fork?
35+
36+
Bazel shares most of its code with the internal tool and its rules are used for millions of builds every day.
37+
38+
## Why did Google build Bazel?
39+
40+
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.
41+
42+
## Does Bazel require a build cluster?
43+
44+
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](/docs/remote-execution) and [remote caching](/docs/remote-caching) for further details.
45+
46+
## How does the Google development process work?
47+
48+
For our server code base, we use the following development workflow:
49+
50+
* All our server code is in a single, gigantic version control system.
51+
* Everybody builds their software with Bazel.
52+
* Different teams own different parts of the source tree, and make their components available as `BUILD` targets.
53+
* Branching is primarily used for managing releases, so everybody develops their software at the head revision.
54+
55+
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.
56+
57+
More background on the development process at Google can be found on the [eng tools blog](http://google-engtools.blogspot.com/).
58+
59+
## Why did you open up Bazel?
60+
61+
Building software should be fun and easy. Slow and unpredictable builds take the fun out of programming.
62+
63+
## Why would I want to use Bazel?
64+
65+
* 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.
66+
* Bazel produces deterministic results. This eliminates skew between incremental and clean builds, laptop and CI system, etc.
67+
* 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.
68+
69+
## Can I see examples?
70+
71+
Yes; see a [simple example](https://github.com/bazelbuild/bazel/blob/master/examples/cpp/BUILD)
72+
or read the [Bazel source code](https://github.com/bazelbuild/bazel/blob/master/src/BUILD) for a more complex example.
73+
74+
75+
## What is Bazel best at?
76+
77+
Bazel shines at building and testing projects with the following properties:
78+
79+
* Projects with a large codebase
80+
* Projects written in (multiple) compiled languages
81+
* Projects that deploy on multiple platforms
82+
* Projects that have extensive tests
83+
84+
## Where can I run Bazel?
85+
86+
Bazel runs on Linux, macOS (OS X), and Windows.
87+
88+
Porting to other UNIX platforms should be relatively easy, as long as a JDK is available for the platform.
89+
90+
## What should I not use Bazel for?
91+
92+
* 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:
93+
* A compilation step that fetches data from the internet.
94+
* A test step that connects to the QA instance of your site.
95+
* A deployment step that changes your site’s cloud configuration.
96+
* 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.
97+
98+
## How stable is Bazel’s feature set?
99+
100+
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.
101+
102+
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).
103+
104+
## How stable is Bazel as a binary?
105+
106+
Inside Google, we make sure that Bazel crashes are very rare. This should also hold for our open source codebase.
107+
108+
## How can I start using Bazel?
109+
110+
See [Getting Started](/start/).
111+
112+
## Doesn’t Docker solve the reproducibility problems?
113+
114+
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?”
115+
116+
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.
117+
118+
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”).
119+
120+
## Can I build binaries for deployment on Docker?
121+
122+
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.
123+
124+
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.
125+
126+
## Can I build Docker images with Bazel?
127+
128+
Yes, you can use our [Docker rules](https://github.com/bazelbuild/rules_docker) to build reproducible Docker images.
129+
130+
## Will Bazel make my builds reproducible automatically?
131+
132+
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:
133+
134+
* Do not use dependencies that were not declared. Sandboxed execution (–spawn\_strategy=sandboxed, only on Linux) can help find undeclared dependencies.
135+
* Avoid storing timestamps and user-IDs in generated files. ZIP files and other archives are especially prone to this.
136+
* Avoid connecting to the network. Sandboxed execution can help here too.
137+
* Avoid processes that use random numbers, in particular, dictionary traversal is randomized in many programming languages.
138+
139+
## Do you have binary releases?
140+
141+
Yes, you can find the latest [release binaries](https://github.com/bazelbuild/bazel/releases/latest) and review our [release policy](/release/)
142+
143+
## I use Eclipse/IntelliJ/XCode. How does Bazel interoperate with IDEs?
144+
145+
For IntelliJ, check out the [IntelliJ with Bazel plugin](https://ij.bazel.build/).
146+
147+
For XCode, check out [Tulsi](http://tulsi.bazel.build/).
148+
149+
For Eclipse, check out [E4B plugin](https://github.com/bazelbuild/e4b).
150+
151+
For other IDEs, check out the [blog post](https://blog.bazel.build/2016/06/10/ide-support.html) on how these plugins work.
152+
153+
## I use Jenkins/CircleCI/TravisCI. How does Bazel interoperate with CI systems?
154+
155+
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.
156+
157+
Further details on exit codes are in the [User Manual](/docs/user-manual).
158+
159+
## What future features can we expect in Bazel?
160+
161+
See our [Roadmaps](/community/roadmaps).
162+
163+
## Can I use Bazel for my INSERT LANGUAGE HERE project?
164+
165+
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.
166+
167+
If you would like to develop extensions or learn how they work, see the documentation for [extending Bazel](/rules/concepts).
168+
169+
## Can I contribute to the Bazel code base?
170+
171+
See our [contribution guidelines](/contribute/guide).
172+
173+
## Why isn’t all development done in the open?
174+
175+
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.
176+
177+
## Are you done open sourcing Bazel?
178+
179+
Open sourcing Bazel is a work-in-progress. In particular, we’re still working on open sourcing:
180+
181+
* Many of our unit and integration tests (which should make contributing patches easier).
182+
* Full IDE integration.
183+
184+
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.
185+
186+
## Are there parts of Bazel that will never be open sourced?
187+
188+
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.
189+
190+
## How do I contact the team?
191+
192+
We are reachable at bazel-discuss@googlegroups.com.
193+
194+
## Where do I report bugs?
195+
196+
Open an issue [on GitHub](https://github.com/bazelbuild/bazel/issues).
197+
198+
## What’s up with the word “Blaze” in the codebase?
199+
200+
This is an internal name for the tool. Please refer to Bazel as Bazel.
201+
202+
## Why do other Google projects (Android, Chrome) use other build tools?
203+
204+
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.
205+
206+
## How do you pronounce “Bazel”?
207+
208+
The same way as “basil” (the herb) in US English: “BAY-zel”. It rhymes with “hazel”. IPA: /ˈbeɪzˌəl/

6.5.0/about/intro.mdx

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
title: 'Intro to Bazel'
3+
---
4+
5+
6+
Bazel is an open-source build and test tool similar to Make, Maven, and Gradle.
7+
It uses a human-readable, high-level build language. Bazel supports projects in
8+
multiple languages and builds outputs for multiple platforms. Bazel supports
9+
large codebases across multiple repositories, and large numbers of users.
10+
11+
## Benefits
12+
13+
Bazel offers the following advantages:
14+
15+
* **High-level build language.** Bazel uses an abstract, human-readable
16+
language to describe the build properties of your project at a high
17+
semantical level. Unlike other tools, Bazel operates on the *concepts*
18+
of libraries, binaries, scripts, and data sets, shielding you from the
19+
complexity of writing individual calls to tools such as compilers and
20+
linkers.
21+
22+
* **Bazel is fast and reliable.** Bazel caches all previously done work and
23+
tracks changes to both file content and build commands. This way, Bazel
24+
knows when something needs to be rebuilt, and rebuilds only that. To further
25+
speed up your builds, you can set up your project to build in a highly
26+
parallel and incremental fashion.
27+
28+
* **Bazel is multi-platform.** Bazel runs on Linux, macOS, and Windows. Bazel
29+
can build binaries and deployable packages for multiple platforms, including
30+
desktop, server, and mobile, from the same project.
31+
32+
* **Bazel scales.** Bazel maintains agility while handling builds with 100k+
33+
source files. It works with multiple repositories and user bases in the tens
34+
of thousands.
35+
36+
* **Bazel is extensible.** Many [languages](/rules) are
37+
supported, and you can extend Bazel to support any other language or
38+
framework.
39+
40+
## Using Bazel
41+
42+
To build or test a project with Bazel, you typically do the following:
43+
44+
1. **Set up Bazel.** Download and [install Bazel](/install).
45+
46+
2. **Set up a project [workspace](/concepts/build-ref#workspaces)**, which is a
47+
directory where Bazel looks for build inputs and `BUILD` files, and where it
48+
stores build outputs.
49+
50+
3. **Write a `BUILD` file**, which tells Bazel what to build and how to
51+
build it.
52+
53+
You write your `BUILD` file by declaring build targets using
54+
[Starlark](/rules/language), a domain-specific language. (See example
55+
[here](https://github.com/bazelbuild/bazel/blob/master/examples/cpp/BUILD).)
56+
57+
A build target specifies a set of input artifacts that Bazel will build plus
58+
their dependencies, the build rule Bazel will use to build it, and options
59+
that configure the build rule.
60+
61+
A build rule specifies the build tools Bazel will use, such as compilers and
62+
linkers, and their configurations. Bazel ships with a number of build rules
63+
covering the most common artifact types in the supported languages on
64+
supported platforms.
65+
66+
4. **Run Bazel** from the [command line](/reference/command-line-reference). Bazel
67+
places your outputs within the workspace.
68+
69+
In addition to building, you can also use Bazel to run
70+
[tests](/reference/test-encyclopedia) and [query](/docs/query-how-to) the build
71+
to trace dependencies in your code.
72+
73+
## Bazel build process
74+
75+
When running a build or a test, Bazel does the following:
76+
77+
1. **Loads** the `BUILD` files relevant to the target.
78+
79+
2. **Analyzes** the inputs and their
80+
[dependencies](/concepts/dependencies), applies the specified build
81+
rules, and produces an [action](/rules/concepts#evaluation-model)
82+
graph.
83+
84+
3. **Executes** the build actions on the inputs until the final build outputs
85+
are produced.
86+
87+
Since all previous build work is cached, Bazel can identify and reuse cached
88+
artifacts and only rebuild or retest what's changed. To further enforce
89+
correctness, you can set up Bazel to run builds and tests
90+
[hermetically](/concepts/hermeticity) through sandboxing, minimizing skew
91+
and maximizing [reproducibility](/docs/build#correct-incremental-rebuilds).
92+
93+
### Action graph
94+
95+
The action graph represents the build artifacts, the relationships between them,
96+
and the build actions that Bazel will perform. Thanks to this graph, Bazel can
97+
[track](/docs/build#build-consistency) changes to
98+
file content as well as changes to actions, such as build or test commands, and
99+
know what build work has previously been done. The graph also enables you to
100+
easily [trace dependencies](/docs/query-how-to) in your code.
101+
102+
## Getting started tutorials
103+
104+
To get started with Bazel, see [Getting Started](/start/getting-started) or jump
105+
directly to the Bazel tutorials:
106+
107+
* [Tutorial: Build a C++ Project](/tutorials/cpp)
108+
* [Tutorial: Build a Java Project](/tutorials/java)
109+
* [Tutorial: Build an Android Application](/tutorials/android-app)
110+
* [Tutorial: Build an iOS Application](/tutorials/ios-app)

0 commit comments

Comments
 (0)