Skip to content

Commit

Permalink
chore: update outdated links to docs.bazel.build (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored Oct 4, 2023
1 parent beba0f3 commit 63769f5
Show file tree
Hide file tree
Showing 25 changed files with 39 additions and 38 deletions.
2 changes: 1 addition & 1 deletion android/ndk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Documentation

For the full documentation, please visit the [Bazel documentation page](https://docs.bazel.build/versions/master/android-ndk.html).
For the full documentation, please visit the [Bazel documentation page](https://bazel.build/docs/android-ndk).

## Instructions

Expand Down
2 changes: 1 addition & 1 deletion android/tutorial/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This is a barebones Android app for the [Bazel Android tutorial](https://docs.bazel.build/versions/master/tutorial/android-app.html).
This is a barebones Android app for the [Bazel Android tutorial](https://bazel.build/start/android-app).
2 changes: 1 addition & 1 deletion configurations/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### Starlark Build Configuration Examples

This directory contains examples of how to use [Starlark Build Configurations](https://docs.bazel.build/versions/master/skylark/config.html).
This directory contains examples of how to use [Starlark Build Configurations](https://bazel.build/extending/config).
2 changes: 1 addition & 1 deletion configurations/attaching_transitions_to_rules/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Skylib provides convenience macros that reduce boilerplate, so we'll use that
# here.
#
# See https://docs.bazel.build/versions/master/skylark/config.html and
# See https://bazel.build/extending/config and
# https://github.com/bazelbuild/bazel-skylib) for more info.
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load(":defs.bzl", "piece", "shirt")
Expand Down
2 changes: 1 addition & 1 deletion configurations/attaching_transitions_to_rules/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ shirt = rule(
"_color": attr.label(default = ":color"),
# This attribute is required to use starlark transitions. It allows
# allowlisting usage of this rule. For more information, see
# https://docs.bazel.build/versions/master/skylark/config.html#user-defined-transitions
# https://bazel.build/extending/config#user-defined-transitions
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
Expand Down
2 changes: 1 addition & 1 deletion configurations/basic_build_setting/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ breakfast = rule(
# configuration value inside your rule implementation. You
# might want to make these private attributes so rule
# users can't change what piece of configuration you are
# reading (https://docs.bazel.build/versions/master/skylark/rules.html#private-attributes-and-implicit-dependencies)
# reading (https://bazel.build/extending/rules#private-attributes-and-implicit-dependencies)
attrs = {
"_temperature": attr.label(default = ":coffee-temp"),
},
Expand Down
6 changes: 3 additions & 3 deletions configurations/cc_binary_selectable_copts/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
### Example showing how to use [Starlark configuration](https://docs.bazel.build/versions/master/skylark/config.html) so a `cc_binary` can set custom "features" for `cc_library` dependencies to include.
### Example showing how to use [Starlark configuration](https://bazel.build/extending/config) so a `cc_binary` can set custom "features" for `cc_library` dependencies to include.


This example has five files:

* [custom_settings/BUILD](custom_settings/BUILD) - This defines a [custom
Starlark
flag](https://docs.bazel.build/versions/master/skylark/config.html#user-defined-build-settings)
flag](https://bazel.build/extending/config#user-defined-build-settings)
called `//custom_settings:mycopts` which defines the set of possible features
and stores whatever features the `cc_binary` sets.

Expand All @@ -21,7 +21,7 @@ This example has five files:
omit `transition_rule` and just add the functionality directly.

`transition_rule` applies a [Starlark
transition](https://docs.bazel.build/versions/master/skylark/config.html#user-defined-transitions)
transition](https://bazel.build/extending/config#user-defined-transitions)
called `_copt_transition` that reads the value of `set_features` and sets
`//custom-settings:mycopts` accordingly.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Skylib provides convenience macros that reduce boilerplate, so we'll use that
# here.
#
# See https://docs.bazel.build/versions/master/skylark/config.html and
# See https://bazel.build/extending/config and
# https://github.com/bazelbuild/bazel-skylib) for more info.

load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
Expand All @@ -22,7 +22,7 @@ string_flag(
# It's also possible to disallow command line access (in this example
# we don't need that because cc_binary sets this implicitly without the
# end user even having to know this flag exists). See
# https://docs.bazel.build/versions/master/skylark/config.html#the-build_setting-rule-parameter
# https://bazel.build/extending/config#the-build_setting-rule-parameter
# for details.
name = "mycopts",
build_setting_default = "unset",
Expand Down
2 changes: 1 addition & 1 deletion configurations/cc_test/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Example showing how to use [Starlark configuration](https://docs.bazel.build/versions/master/skylark/config.html) to write a
### Example showing how to use [Starlark configuration](https://bazel.build/extending/config) to write a
`cc_test` wrapper with a starlark transition

the `test_arg_cc_test` macro in `defs.bzl` defines a wrapper for basically a cc_test that has been transitioned.
Expand Down
2 changes: 1 addition & 1 deletion configurations/multi_arch_binary/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This is an example of how to write a rule that builds a dependency for more than one
architecture. It covers the following topics:
- defining a
[split](https://docs.bazel.build/skylark/config.html#defining-12-transitions)
[split](https://bazel.build/extending/config#defining-1-2-transitions)
(also know as 1:2+) transition
- attaching a transition to a rule
- reading the transitioned deps
Expand Down
8 changes: 4 additions & 4 deletions configurations/multi_arch_binary/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def _transition_impl(_, __):
# Returning a dict of dicts creates a "split transition", which transitions
# the dep it's attached to to more than one configuration creating multiple
# configured targets. For more info on "split" transitions:
# https://docs.bazel.build/skylark/config.html#defining-12-transitions.
# https://bazel.build/extending/config#defining-1-2-transitions.
return {
"x86-platform": {"//command_line_option:cpu": "x86"},
"armeabi-v7a-platform": {"//command_line_option:cpu": "armeabi-v7a"},
Expand All @@ -22,7 +22,7 @@ fat_transition = transition(
# buildifier: disable=print
def _rule_impl(ctx):
# Access the split dependencies via `ctx.split_attr.<split-attr-name>`.
# See: https://docs.bazel.build/skylark/lib/ctx.html#split_attr.
# See: https://bazel.build/rules/lib/builtins/ctx#split_attr.
tools = ctx.split_attr.tool

# The values of `x86_dep` and `armeabi-v7a_dep` here are regular
Expand All @@ -40,7 +40,7 @@ foo_binary = rule(
"tool": attr.label(cfg = fat_transition),
# This attribute is required to use Starlark transitions. It allows
# allowlisting usage of this rule. For more information, see
# https://docs.bazel.build/skylark/config.html#user-defined-transitions.
# https://bazel.build/extending/config#user-defined-transitions.
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
Expand All @@ -52,7 +52,7 @@ CpuInfo = provider(doc = "", fields = ["value"])
def _impl(ctx):
# Get the current cpu using `ctx.var` which contains a
# dict of configuration variables. See:
# https://docs.bazel.build/skylark/lib/ctx.html#var.
# https://bazel.build/rules/lib/builtins/ctx#var.
return CpuInfo(value = "--cpu=" + ctx.var["TARGET_CPU"])

simple = rule(_impl)
2 changes: 1 addition & 1 deletion configurations/read_attr_in_transition/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Skylib provides convenience macros that reduce boilerplate, so we'll use that
# here.
#
# See https://docs.bazel.build/versions/master/skylark/config.html and
# See https://bazel.build/extending/config and
# https://github.com/bazelbuild/bazel-skylib) for more info.
load("@bazel_skylib//rules:common_settings.bzl", "string_setting")
load(":defs.bzl", "my_rule")
Expand Down
2 changes: 1 addition & 1 deletion configurations/read_attr_in_transition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $ bazel build :do-transition # "value of some-string: abc-transitioned"
```

Caveat: <b>You cannot read a
[configured attribute](https://docs.bazel.build/versions/master/configurable-attributes.html)
[configured attribute](https://bazel.build/docs/configurable-attributes)
in a rule transition.</b> This can create a dependency cycle between attribute
values and configuration. To see an example of this cycle, run the following:
```
Expand Down
2 changes: 1 addition & 1 deletion configurations/select_on_build_setting/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Skylib provides convenience macros that reduce boilerplate, so we'll use that
# here.
#
# See https://docs.bazel.build/versions/master/skylark/config.html and
# See https://bazel.build/extending/config and
# https://github.com/bazelbuild/bazel-skylib) for more info.
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load(":defs.bzl", "fruit", "harvest")
Expand Down
2 changes: 1 addition & 1 deletion configurations/select_on_build_setting/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This is an example of how to read build settings in a [configurable attribute](https://docs.bazel.build/versions/master/configurable-attributes.html) aka a `select()`.
This is an example of how to read build settings in a [configurable attribute](https://bazel.build/docs/configurable-attributes) aka a `select()`.

To test it out, cd to this directory and run the following
```
Expand Down
4 changes: 2 additions & 2 deletions configurations/transition_on_native_flag/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cpu_transition = transition(
def _impl(ctx):
# Print the current cpu using `ctx.var` which contains a
# dict of configuration variable
# https://docs.bazel.build/versions/master/skylark/lib/ctx.html#var
# https://bazel.build/rules/lib/builtins/ctx#var
print("--cpu=" + ctx.var["TARGET_CPU"])
return []

Expand All @@ -34,7 +34,7 @@ cpu_rule = rule(
attrs = {
# This attribute is required to use starlark transitions. It allows
# allowlisting usage of this rule. For more information, see
# https://docs.bazel.build/versions/master/skylark/config.html#user-defined-transitions
# https://bazel.build/extending/config#user-defined-transitions
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
Expand Down
2 changes: 1 addition & 1 deletion configurations/use_skylib_build_setting/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Skylib provides convenience macros that reduce boilerplate, so we'll use that
# here.
#
# See https://docs.bazel.build/versions/master/skylark/config.html and
# See https://bazel.build/extending/config and
# https://github.com/bazelbuild/bazel-skylib) for more info.

load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
Expand Down
2 changes: 2 additions & 0 deletions cpp-tutorial/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Examples to build C++ code

This folder is part of the C++ Bazel Tutorial, found at <https://bazel.build/start/cpp>

This package will showcase how to build C++ code in stages.

### Stage 1
Expand Down
12 changes: 6 additions & 6 deletions flags-parsing-tutorial/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Bazel flags parsing examples
========================

This provides examples for the current behavior of flag parsing. This tutorial assumes that users have basic knowledge of creating a Bazel [WORKSPACE](https://docs.bazel.build/build-ref.html#workspace) and writing a [BUILD](https://docs.bazel.build/versions/main/build-ref.html#BUILD_files) file. Users should also be familiar with [built-in](https://docs.bazel.build/versions/main/configurable-attributes.html#built-in-flags) (non-Starlark) and [user-defined](https://docs.bazel.build/versions/main/configurable-attributes.html#custom-flags) (Starlark) flags.
This provides examples for the current behavior of flag parsing. This tutorial assumes that users have basic knowledge of creating a Bazel [WORKSPACE](https://bazel.build/concepts/build-ref#workspace) and writing a [BUILD](https://bazel.build/concepts/build-ref#BUILD_files) file. Users should also be familiar with [built-in](https://bazel.build/docs/configurable-attributes#built-in-flags) (non-Starlark) and [user-defined](https://bazel.build/docs/configurable-attributes#custom-flags) (Starlark) flags.

Note that a broader term, [options](https://docs.bazel.build/versions/main/command-line-reference.html#option-syntax) is often used interchangeably with flags. An important distinction is that only flags can be set on the command line.
Note that a broader term, [options](https://bazel.build/reference/command-line-reference#option-syntax) is often used interchangeably with flags. An important distinction is that only flags can be set on the command line.

Terminologies
========================
`--config`: Throughout this tutorial, users will see regular usage of `--config`. Although, it's already defined [here](https://docs.bazel.build/guide.html#bazelrc), we will repeat important points for first-time Bazel users.
`--config`: Throughout this tutorial, users will see regular usage of `--config`. Although, it's already defined [here](https://bazel.build/run/bazelrc), we will repeat important points for first-time Bazel users.
* `--config` can be used to represent a group of flags with a short name following the convention `<command>:<config_name>`. For example:
```
# bazelrc
Expand All @@ -26,7 +26,7 @@ Instructions
cd examples/flags-parsing-tutorial
```
In this WORKSPACE, we have:
* <b>[bazelrc](https://docs.bazel.build/guide.html#bazelrc-the-bazel-configuration-file) file</b>: This is the user-defined bazelrc where flags can be defined.
* <b>[bazelrc](https://bazel.build/run/bazelrc) file</b>: This is the user-defined bazelrc where flags can be defined.
* <b>build_defs.bzl</b>: This contains the Starlark rules' implementations.
* <b>BUILD</b>: This contains rules Bazel uses to build a package.

Expand All @@ -44,7 +44,7 @@ For user-defined (Starlark) flags, the evaluated value can be observed by adding
DEBUG: /my/root/examples/flags-parsing-tutorial/build_defs.bzl:6:10: evaluated value for flag: cmd
```
### B. The last option on the command line takes precedence. ###
⭐ <b>Tips</b>: Use [--announce_rc](https://docs.bazel.build/user-manual.html#flag--announce_rc) to debug flag parsing.
⭐ <b>Tips</b>: Use [--announce_rc](https://bazel.build/docs/user-manual#flag--announce_rc) to debug flag parsing.

<u><b>Example B.1</b></u>
```
Expand Down Expand Up @@ -112,5 +112,5 @@ If the host platform (where Bazel is running) is `macos` and the `build` command
```
bazel --bazelrc=./bazelrc build :wibble
```
Note that Bazel will only enable flags based on the host platform, instead of execution platform or target platform. The definitions for these platforms can be found [here](https://docs.bazel.build/platforms.html).
Note that Bazel will only enable flags based on the host platform, instead of execution platform or target platform. The definitions for these platforms can be found [here](https://bazel.build/extending/platforms).

2 changes: 1 addition & 1 deletion flags-parsing-tutorial/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def _string_imp(ctx):

string_flag = rule(
implementation = _string_imp,
# https://docs.bazel.build/versions/main/skylark/config.html#the-build_setting-rule-parameter
# https://bazel.build/extending/config#the-build_setting-rule-parameter
build_setting = config.string(flag = True),
)
3 changes: 1 addition & 2 deletions make-variables/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Examples demonstrating "Make" variables

These examples demonstrate Bazel's ["Make"
variable](https://docs.bazel.build/versions/master/be/make-variables.html)
These examples demonstrate Bazel's ["Make" variable](https://bazel.build/reference/be/make-variables)
support.

## Predefined variables
Expand Down
2 changes: 1 addition & 1 deletion rules/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Bazel Rules

This directory contains examples of Bazel rules. For additional information,
please refer to [the documentation](https://docs.bazel.build/versions/master/skylark/concepts.html).
please refer to [the documentation](https://bazel.build/extending/concepts).

## Getting started

Expand Down
2 changes: 1 addition & 1 deletion rules/aspect/file_collector.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Example of using an aspect to collect information from dependencies.
For more information about aspects, see the documentation:
https://docs.bazel.build/versions/master/skylark/aspects.html
https://bazel.build/extending/aspects
"""

CollectedFileInfo = provider(
Expand Down
2 changes: 1 addition & 1 deletion rules/features/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package(features = ["foo"])
# features have no specific meaning in Bazel. Each rule can decide how to use
# the features.
# See the documentation:
# https://docs.bazel.build/versions/master/be/common-definitions.html#common.features
# https://bazel.build/reference/be/common-definitions#common.features

# in target1, the enabled features are ["foo"]
myrule(
Expand Down
4 changes: 2 additions & 2 deletions third-party-dependencies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Bazel with third party dependencies
Goal
----

This is a small Bazel example that uses third party dependencies ([also called external dependencies](https://docs.bazel.build/versions/master/external.html))
This is a small Bazel example that uses third party dependencies ([also called external dependencies](https://bazel.build/external/overview))
but is well structured following the principles of software development. The main goal is that the principles and guidelines shown here they should scale big.
Bazel consultants with access to over 40 codebases have seen this pattern deployed successfully at scale.

Expand Down Expand Up @@ -57,6 +57,6 @@ For the Catch2 test, you can add additinal parameters for a nicer output:
bazel test //:catch2_test --test_arg "--reporter compact" --test_arg --success --test_output=streamed
```

If you want to know more about the parameters of the bazel command, you can check [here](https://docs.bazel.build/versions/master/command-line-reference.html)
If you want to know more about the parameters of the bazel command, you can check [here](https://bazel.build/reference/command-line-reference)

To try with bzlmod, add the `--enable_bzlmod` flag to any of the bazel commands above.

0 comments on commit 63769f5

Please sign in to comment.