From 63769f5e2d4c4cd3914eca71d4bc28cbbeedaa0d Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 4 Oct 2023 01:03:35 -0700 Subject: [PATCH] chore: update outdated links to docs.bazel.build (#330) --- android/ndk/README.md | 2 +- android/tutorial/README.md | 2 +- configurations/README.md | 2 +- configurations/attaching_transitions_to_rules/BUILD | 2 +- .../attaching_transitions_to_rules/defs.bzl | 2 +- configurations/basic_build_setting/defs.bzl | 2 +- configurations/cc_binary_selectable_copts/README.md | 6 +++--- .../cc_binary_selectable_copts/custom_settings/BUILD | 4 ++-- configurations/cc_test/README.md | 2 +- configurations/multi_arch_binary/README.md | 2 +- configurations/multi_arch_binary/defs.bzl | 8 ++++---- configurations/read_attr_in_transition/BUILD | 2 +- configurations/read_attr_in_transition/README.md | 2 +- configurations/select_on_build_setting/BUILD | 2 +- configurations/select_on_build_setting/README.md | 2 +- configurations/transition_on_native_flag/defs.bzl | 4 ++-- configurations/use_skylib_build_setting/BUILD | 2 +- cpp-tutorial/README.md | 2 ++ flags-parsing-tutorial/README.md | 12 ++++++------ flags-parsing-tutorial/build_defs.bzl | 2 +- make-variables/README.md | 3 +-- rules/README.md | 2 +- rules/aspect/file_collector.bzl | 2 +- rules/features/BUILD | 2 +- third-party-dependencies/README.md | 4 ++-- 25 files changed, 39 insertions(+), 38 deletions(-) diff --git a/android/ndk/README.md b/android/ndk/README.md index 5dbadb8bb..a76c3db24 100644 --- a/android/ndk/README.md +++ b/android/ndk/README.md @@ -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 diff --git a/android/tutorial/README.md b/android/tutorial/README.md index 48e67c425..d153393ab 100644 --- a/android/tutorial/README.md +++ b/android/tutorial/README.md @@ -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). diff --git a/configurations/README.md b/configurations/README.md index a57bed2d1..dceaf26ab 100644 --- a/configurations/README.md +++ b/configurations/README.md @@ -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). \ No newline at end of file +This directory contains examples of how to use [Starlark Build Configurations](https://bazel.build/extending/config). \ No newline at end of file diff --git a/configurations/attaching_transitions_to_rules/BUILD b/configurations/attaching_transitions_to_rules/BUILD index e3a22e0b5..219becfb8 100644 --- a/configurations/attaching_transitions_to_rules/BUILD +++ b/configurations/attaching_transitions_to_rules/BUILD @@ -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") diff --git a/configurations/attaching_transitions_to_rules/defs.bzl b/configurations/attaching_transitions_to_rules/defs.bzl index b268d3252..14944c60e 100644 --- a/configurations/attaching_transitions_to_rules/defs.bzl +++ b/configurations/attaching_transitions_to_rules/defs.bzl @@ -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", ), diff --git a/configurations/basic_build_setting/defs.bzl b/configurations/basic_build_setting/defs.bzl index 597dbf9a8..c5fcd416f 100644 --- a/configurations/basic_build_setting/defs.bzl +++ b/configurations/basic_build_setting/defs.bzl @@ -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"), }, diff --git a/configurations/cc_binary_selectable_copts/README.md b/configurations/cc_binary_selectable_copts/README.md index 98a338fe6..8d5240a38 100644 --- a/configurations/cc_binary_selectable_copts/README.md +++ b/configurations/cc_binary_selectable_copts/README.md @@ -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. @@ -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. diff --git a/configurations/cc_binary_selectable_copts/custom_settings/BUILD b/configurations/cc_binary_selectable_copts/custom_settings/BUILD index 0c783333e..3e23b362b 100644 --- a/configurations/cc_binary_selectable_copts/custom_settings/BUILD +++ b/configurations/cc_binary_selectable_copts/custom_settings/BUILD @@ -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") @@ -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", diff --git a/configurations/cc_test/README.md b/configurations/cc_test/README.md index dada7b83f..5b512e77e 100644 --- a/configurations/cc_test/README.md +++ b/configurations/cc_test/README.md @@ -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. diff --git a/configurations/multi_arch_binary/README.md b/configurations/multi_arch_binary/README.md index a370fea8f..5611dd876 100644 --- a/configurations/multi_arch_binary/README.md +++ b/configurations/multi_arch_binary/README.md @@ -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 diff --git a/configurations/multi_arch_binary/defs.bzl b/configurations/multi_arch_binary/defs.bzl index 7146d60d1..11cdc62ef 100644 --- a/configurations/multi_arch_binary/defs.bzl +++ b/configurations/multi_arch_binary/defs.bzl @@ -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"}, @@ -22,7 +22,7 @@ fat_transition = transition( # buildifier: disable=print def _rule_impl(ctx): # Access the split dependencies via `ctx.split_attr.`. - # 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 @@ -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", ), @@ -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) diff --git a/configurations/read_attr_in_transition/BUILD b/configurations/read_attr_in_transition/BUILD index b8c62a5e7..c6126f979 100644 --- a/configurations/read_attr_in_transition/BUILD +++ b/configurations/read_attr_in_transition/BUILD @@ -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") diff --git a/configurations/read_attr_in_transition/README.md b/configurations/read_attr_in_transition/README.md index 28469e636..b03e95b76 100644 --- a/configurations/read_attr_in_transition/README.md +++ b/configurations/read_attr_in_transition/README.md @@ -9,7 +9,7 @@ $ bazel build :do-transition # "value of some-string: abc-transitioned" ``` Caveat: 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. This can create a dependency cycle between attribute values and configuration. To see an example of this cycle, run the following: ``` diff --git a/configurations/select_on_build_setting/BUILD b/configurations/select_on_build_setting/BUILD index d8af7ea8a..484728caf 100644 --- a/configurations/select_on_build_setting/BUILD +++ b/configurations/select_on_build_setting/BUILD @@ -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") diff --git a/configurations/select_on_build_setting/README.md b/configurations/select_on_build_setting/README.md index bd06baddd..cd020ab5a 100644 --- a/configurations/select_on_build_setting/README.md +++ b/configurations/select_on_build_setting/README.md @@ -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 ``` diff --git a/configurations/transition_on_native_flag/defs.bzl b/configurations/transition_on_native_flag/defs.bzl index 51d9ce6c2..8bac50fe1 100644 --- a/configurations/transition_on_native_flag/defs.bzl +++ b/configurations/transition_on_native_flag/defs.bzl @@ -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 [] @@ -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", ), diff --git a/configurations/use_skylib_build_setting/BUILD b/configurations/use_skylib_build_setting/BUILD index 07f27e2ec..865a97274 100644 --- a/configurations/use_skylib_build_setting/BUILD +++ b/configurations/use_skylib_build_setting/BUILD @@ -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") diff --git a/cpp-tutorial/README.md b/cpp-tutorial/README.md index 0b5eb33ac..1cc6b13d1 100644 --- a/cpp-tutorial/README.md +++ b/cpp-tutorial/README.md @@ -1,5 +1,7 @@ # Examples to build C++ code +This folder is part of the C++ Bazel Tutorial, found at + This package will showcase how to build C++ code in stages. ### Stage 1 diff --git a/flags-parsing-tutorial/README.md b/flags-parsing-tutorial/README.md index e7ab13cc3..6137b87ac 100644 --- a/flags-parsing-tutorial/README.md +++ b/flags-parsing-tutorial/README.md @@ -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 `:`. For example: ``` # bazelrc @@ -26,7 +26,7 @@ Instructions cd examples/flags-parsing-tutorial ``` In this WORKSPACE, we have: -* [bazelrc](https://docs.bazel.build/guide.html#bazelrc-the-bazel-configuration-file) file: This is the user-defined bazelrc where flags can be defined. +* [bazelrc](https://bazel.build/run/bazelrc) file: This is the user-defined bazelrc where flags can be defined. * build_defs.bzl: This contains the Starlark rules' implementations. * BUILD: This contains rules Bazel uses to build a package. @@ -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. ### -⭐ Tips: Use [--announce_rc](https://docs.bazel.build/user-manual.html#flag--announce_rc) to debug flag parsing. +⭐ Tips: Use [--announce_rc](https://bazel.build/docs/user-manual#flag--announce_rc) to debug flag parsing. Example B.1 ``` @@ -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). diff --git a/flags-parsing-tutorial/build_defs.bzl b/flags-parsing-tutorial/build_defs.bzl index 98c346145..f51888e0d 100644 --- a/flags-parsing-tutorial/build_defs.bzl +++ b/flags-parsing-tutorial/build_defs.bzl @@ -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), ) diff --git a/make-variables/README.md b/make-variables/README.md index c8307aa32..99a307d17 100644 --- a/make-variables/README.md +++ b/make-variables/README.md @@ -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 diff --git a/rules/README.md b/rules/README.md index d3c0bc468..45fb3ce01 100644 --- a/rules/README.md +++ b/rules/README.md @@ -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 diff --git a/rules/aspect/file_collector.bzl b/rules/aspect/file_collector.bzl index 711fdbef1..d2ebf6608 100644 --- a/rules/aspect/file_collector.bzl +++ b/rules/aspect/file_collector.bzl @@ -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( diff --git a/rules/features/BUILD b/rules/features/BUILD index 74467fc43..c442973ae 100644 --- a/rules/features/BUILD +++ b/rules/features/BUILD @@ -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( diff --git a/third-party-dependencies/README.md b/third-party-dependencies/README.md index 6974cfb91..5e4625334 100644 --- a/third-party-dependencies/README.md +++ b/third-party-dependencies/README.md @@ -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. @@ -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.