Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 5 additions & 11 deletions basics/dependencies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ targets, we’ve made some strides in mitigating the downside by investing in
tooling to automatically manage `BUILD` files to avoid burdening developers.

Some of these tools, such as `buildifier` and `buildozer`, are available with
Bazel in the [`buildtools`
directory](https://github.com/bazelbuild/buildtools).
Bazel in the [`buildtools` directory](https://github.com/bazelbuild/buildtools).

## Minimizing Module Visibility

Expand Down Expand Up @@ -108,8 +107,7 @@ transitive dependencies (Figure 1). Suppose target A depends on target B, which
depends on a common library target C. Should target A be able to use classes
defined in target C?

[![Transitive
dependencies](/images/transitive-dependencies.png)](/images/transitive-dependencies.png)
[![Transitive dependencies](/images/transitive-dependencies.png)](/images/transitive-dependencies.png)

**Figure 1**. Transitive dependencies

Expand Down Expand Up @@ -143,9 +141,7 @@ dependencies and adding them to a `BUILD` files without any developer
intervention. But even without such tools, we’ve found the trade-off to be well
worth it as the codebase scales: explicitly adding a dependency to `BUILD` file
is a one-time cost, but dealing with implicit transitive dependencies can cause
ongoing problems as long as the build target exists. Bazel [enforces strict
transitive
dependencies](https://blog.bazel.build/2017/06/28/sjd-unused_deps.html)
ongoing problems as long as the build target exists. Bazel [enforces strict transitive dependencies](https://blog.bazel.build/2017/06/28/sjd-unused_deps.html)
on Java code by default.

### External dependencies
Expand Down Expand Up @@ -194,8 +190,7 @@ so in theory there’s no reason that different versions of the same external
dependency couldn’t both be declared in the build system under different names.
That way, each target could choose which version of the dependency it wanted to
use. This causes a lot of problems in practice, so Google enforces a strict
[One-Version
Rule](https://opensource.google/docs/thirdparty/oneversion/) for
[One-Version Rule](https://opensource.google/docs/thirdparty/oneversion/) for
all third-party dependencies in our codebase.

The biggest problem with allowing multiple versions is the diamond dependency
Expand Down Expand Up @@ -234,8 +229,7 @@ Bazel did not use to automatically download transitive dependencies. It used to
employ a `WORKSPACE` file that required all transitive dependencies to be
listed, which led to a lot of pain when managing external dependencies. Bazel
has since added support for automatic transitive external dependency management
in the form of the `MODULE.bazel` file. See [external dependency
overview](/external/overview) for more details.
in the form of the `MODULE.bazel` file. See [external dependency overview](/external/overview) for more details.

Yet again, the choice here is one between convenience and scalability. Small
projects might prefer not having to worry about managing transitive dependencies
Expand Down
Binary file added community/images/hermetiq-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions community/sig.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ title: 'Bazel Special Interest Groups'


Bazel hosts Special Interest Groups (SIGs) to focus collaboration on particular
areas and to support communication and coordination between [Bazel owners,
maintainers, and contributors](/contribute/policy). This policy
areas and to support communication and coordination between [Bazel owners, maintainers, and contributors](/contribute/policy). This policy
applies to [`bazelbuild`](http://github.com/bazelbuild).

SIGs do their work in public. The ideal scope for a SIG covers a well-defined
Expand Down
6 changes: 2 additions & 4 deletions community/users.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,9 @@ safety systems_.
Pigweed is an open-source solution for sustained, robust, and rapid embedded
product development for large teams. Pigweed has shipped in millions of
devices, including Google's suite of Pixel devices, Nest thermostats,
[satellites](https://www.spinlaunch.com/), and [autonomous aerial
drones](https://www.flyzipline.com/).
[satellites](https://www.spinlaunch.com/), and [autonomous aerial drones](https://www.flyzipline.com/).

Pigweed [uses Bazel as its primary build
system](https://pigweed.dev/seed/0111-build-systems.html). The [Bazel for
Pigweed [uses Bazel as its primary build system](https://pigweed.dev/seed/0111-build-systems.html). The [Bazel for
Embedded][pw-bazel-great] blog post discusses why we think it's a great build
system for embedded projects!

Expand Down
6 changes: 2 additions & 4 deletions concepts/build-ref.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ its root; such a boundary marker file could be `MODULE.bazel`, `REPO.bazel`, or
in legacy contexts, `WORKSPACE` or `WORKSPACE.bazel`.

The repo in which the current Bazel command is being run is called the _main
repo_. Other, (external) repos are defined by _repo rules_; see [external
dependencies overview](/external/overview) for more information.
repo_. Other, (external) repos are defined by _repo rules_; see [external dependencies overview](/external/overview) for more information.

## Workspace {#workspace}

Expand Down Expand Up @@ -97,5 +96,4 @@ have three properties: the list of packages they contain, their name, and other
package groups they include. The only allowed ways to refer to them are from the
`visibility` attribute of rules or from the `default_visibility` attribute of
the `package` function; they do not generate or consume files. For more
information, refer to the [`package_group`
documentation](/reference/be/functions#package_group).
information, refer to the [`package_group` documentation](/reference/be/functions#package_group).
3 changes: 1 addition & 2 deletions concepts/labels.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ form looks like:
```

The first part of the label is the repository name, `@@myrepo`. The double-`@`
syntax signifies that this is a [*canonical* repo
name](/external/overview#canonical-repo-name), which is unique within
syntax signifies that this is a [*canonical* repo name](/external/overview#canonical-repo-name), which is unique within
the workspace. Labels with canonical repo names unambiguously identify a target
no matter which context they appear in.

Expand Down
12 changes: 4 additions & 8 deletions concepts/platforms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ To test your Android project with platforms, see
for support.

You can still use platform APIs with Apple builds (for example, when building
with a mixture of Apple rules and pure C++) with [platform
mappings](#platform-mappings).
with a mixture of Apple rules and pure C++) with [platform mappings](#platform-mappings).

### Other languages {#other-languages}

Expand Down Expand Up @@ -244,8 +243,7 @@ sets `--cpu`, `--crossstool_top`, or other legacy flags, rules that read

When migrating your project to platforms, you must either convert changes like
`return { "//command_line_option:cpu": "arm" }` to `return {
"//command_line_option:platforms": "//:my_arm_platform" }` or use [platform
mappings](#platform-mappings) to support both styles during migration.
"//command_line_option:platforms": "//:my_arm_platform" }` or use [platform mappings](#platform-mappings) to support both styles during migration.
window.

## Migrating your rule set {#migrating-your-rule-set}
Expand Down Expand Up @@ -364,10 +362,8 @@ attributes declare a language's tools (like `compiler =
this information to rules that need to build with these tools.

Toolchains declare the `constraint_value`s of machines they can
[target][target_compatible_with Attribute]
(`target_compatible_with = ["@platforms//os:linux"]`) and machines their tools can
[run on][exec_compatible_with Attribute]
(`exec_compatible_with = ["@platforms//os:mac"]`).
[target][target_compatible_with Attribute](`target_compatible_with = ["@platforms//os:linux"]`) and machines their tools can
[run on][exec_compatible_with Attribute](`exec_compatible_with = ["@platforms//os:mac"]`).

When building `$ bazel build //:myproject --platforms=//:myplatform`, Bazel
automatically selects a toolchain that can run on the build machine and
Expand Down
6 changes: 2 additions & 4 deletions configure/attributes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ title: 'Configurable Build Attributes'



**_Configurable attributes_**, commonly known as [`select()`](
/reference/be/functions#select), is a Bazel feature that lets users toggle the values
**_Configurable attributes_**, commonly known as [`select()`](/reference/be/functions#select), is a Bazel feature that lets users toggle the values
of build rule attributes at the command line.

This can be used, for example, for a multiplatform library that automatically
Expand Down Expand Up @@ -409,8 +408,7 @@ sh_library(
)
```

If you need a `select` to match when multiple conditions match, consider [AND
chaining](#and-chaining).
If you need a `select` to match when multiple conditions match, consider [AND chaining](#and-chaining).

## OR chaining {#or-chaining}

Expand Down
6 changes: 2 additions & 4 deletions configure/integrate-cpp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ To depend on a C++ toolchain in your rule, set the `toolchains` parameter to
`use_cc_toolchain()`. Then, in the rule implementation, use
`find_cpp_toolchain(ctx)` to get the
[`CcToolchainInfo`](/rules/lib/providers/CcToolchainInfo). A complete working
example can be found [in the rules_cc
examples](https://github.com/bazelbuild/rules_cc/blob/main/examples/write_cc_toolchain_cpu/write_cc_toolchain_cpu.bzl).
example can be found [in the rules_cc examples](https://github.com/bazelbuild/rules_cc/blob/main/examples/write_cc_toolchain_cpu/write_cc_toolchain_cpu.bzl).

## Generating command lines and environment variables using the C++ toolchain {#generate-command-lines-toolchain}

Expand All @@ -25,8 +24,7 @@ This is because when writing our own actions, they must behave
consistently with the C++ toolchain - for example, passing C++ command line
flags to a tool that invokes the C++ compiler behind the scenes.

C++ rules use a special way of constructing command lines based on [feature
configuration](/docs/cc-toolchain-config-reference). To construct a command line,
C++ rules use a special way of constructing command lines based on [feature configuration](/docs/cc-toolchain-config-reference). To construct a command line,
you need the following:

* `features` and `action_configs` - these come from the `CcToolchainConfigInfo`
Expand Down
21 changes: 7 additions & 14 deletions configure/windows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ To build C++ targets with MSVC, you need:
set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
```

* The [Windows
SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk).
* The [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk).

The Windows SDK contains header files and libraries you need when building
Windows applications, including Bazel itself. By default, the latest Windows SDK installed will
Expand All @@ -182,8 +181,7 @@ To build C++ targets with MSVC, you need:

If everything is set up, you can build a C++ target now!

Try building a target from one of our [sample
projects](https://github.com/bazelbuild/bazel/tree/master/examples):
Try building a target from one of our [sample projects](https://github.com/bazelbuild/bazel/tree/master/examples):

```
<code class="devsite-terminal"
Expand All @@ -207,8 +205,7 @@ cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_exten
use_repo(cc_configure, "local_config_cc")
```

To build and use Dynamically Linked Libraries (DLL files), see [this
example](https://github.com/bazelbuild/bazel/tree/master/examples/windows/dll).
To build and use Dynamically Linked Libraries (DLL files), see [this example](https://github.com/bazelbuild/bazel/tree/master/examples/windows/dll).

**Command Line Length Limit**: To prevent the
[Windows command line length limit issue](https://github.com/bazelbuild/bazel/issues/5163),
Expand Down Expand Up @@ -361,8 +358,7 @@ necessary for consistent behavior between WORKSPACE and Bzlmod setups in Bazel
a build flag `--compiler=clang-cl`.

* If your build sets the flag
[\-\-incompatible_enable_cc_toolchain_resolution]
(https://github.com/bazelbuild/bazel/issues/7260)
[\-\-incompatible_enable_cc_toolchain_resolution](https://github.com/bazelbuild/bazel/issues/7260)
to `true`, then use the approach for Bazel 7.0.0.

**Bazel 0.28 and older:**
Expand All @@ -381,8 +377,7 @@ On Windows, Bazel builds two output files for `java_binary` rules:
* a `.jar` file
* a `.exe` file that can set up the environment for the JVM and run the binary

Try building a target from one of our [sample
projects](https://github.com/bazelbuild/bazel/tree/master/examples):
Try building a target from one of our [sample projects](https://github.com/bazelbuild/bazel/tree/master/examples):

```
<code class="devsite-terminal"
Expand All @@ -406,8 +401,7 @@ On Windows, Bazel builds two output files for `py_binary` rules:
You can either run the executable file (it has a `.exe` extension) or you can run
Python with the self-extracting zip file as the argument.

Try building a target from one of our [sample
projects](https://github.com/bazelbuild/bazel/tree/master/examples):
Try building a target from one of our [sample projects](https://github.com/bazelbuild/bazel/tree/master/examples):

```
<code class="devsite-terminal"
Expand All @@ -419,5 +413,4 @@ projects](https://github.com/bazelbuild/bazel/tree/master/examples):
```

If you are interested in details about how Bazel builds Python targets on
Windows, check out this [design
doc](https://github.com/bazelbuild/bazel-website/blob/master/designs/_posts/2016-09-05-build-python-on-windows.md).
Windows, check out this [design doc](https://github.com/bazelbuild/bazel-website/blob/master/designs/_posts/2016-09-05-build-python-on-windows.md).
3 changes: 1 addition & 2 deletions contribute/codebase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ repository", the others are called "external repositories".
A repository is marked by a repo boundary file (`MODULE.bazel`, `REPO.bazel`, or
in legacy contexts, `WORKSPACE` or `WORKSPACE.bazel`) in its root directory. The
main repo is the source tree where you're invoking Bazel from. External repos
are defined in various ways; see [external dependencies
overview](/external/overview) for more information.
are defined in various ways; see [external dependencies overview](/external/overview) for more information.

Code of external repositories is symlinked or downloaded under
`$OUTPUT_BASE/external`.
Expand Down
6 changes: 2 additions & 4 deletions contribute/design-documents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ A lead reviewer should be a domain expert who is:
* Objective and capable of providing constructive feedback
* Available for the entire review period to lead the process

Consider checking the contacts for various [team
labels](/contribute/maintainers-guide#team-labels).
Consider checking the contacts for various [team labels](/contribute/maintainers-guide#team-labels).

## Markdown vs Google Docs {#markdown-versus-gdocs}

Expand Down Expand Up @@ -170,8 +169,7 @@ Markdown for posterity.

### Using Google Docs {#gdocs}

For consistency, use the [Bazel design doc template](
https://docs.google.com/document/d/1cE5zrjrR40RXNg64XtRFewSv6FrLV6slGkkqxBumS1w/template/preview).
For consistency, use the [Bazel design doc template](https://docs.google.com/document/d/1cE5zrjrR40RXNg64XtRFewSv6FrLV6slGkkqxBumS1w/template/preview).
It includes the necessary header and creates visual
consistency with other Bazel related documents.

Expand Down
1 change: 1 addition & 0 deletions contribute/images/structured-concurrency-3d.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions contribute/images/structured-concurrency.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions contribute/images/suspend-resume.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading