From 3f93d377d036d773fd505a18e084425a00fb94ea Mon Sep 17 00:00:00 2001 From: Googler Date: Wed, 26 Jun 2024 13:50:54 -0700 Subject: [PATCH] Add instructions for embed Bazel version when building from source Fixes https://github.com/bazelbuild/bazel/issues/22798 PiperOrigin-RevId: 647067109 Change-Id: I968866bd60c43552e90b87efd4551ddf19173143 --- site/en/install/compile-source.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/site/en/install/compile-source.md b/site/en/install/compile-source.md index 1a6ad4096325e1..486ed5c8e7d0ed 100644 --- a/site/en/install/compile-source.md +++ b/site/en/install/compile-source.md @@ -112,6 +112,9 @@ For instructions for Windows, see [Build Bazel on Windows](#build-bazel-on-windo Alternatively you can run `bazel build //src:bazel --compilation_mode=opt` to yield a smaller binary but it's slower to build. + You can build with `--stamp --embed_label=X.Y.Z` flag to embed a Bazel + version for the binary so that `bazel --version` outputs the given version. + 4. The output will be at `bazel-bin/src/bazel-dev` (or `bazel-bin/src/bazel`). ### Step 4b: Build Bazel on Windows {:#build-bazel-on-windows} @@ -134,11 +137,14 @@ For instructions for Unix-like systems, see 3. Build Bazel from source: - bazel build //src:bazel-dev.exe + bazel build //src:bazel-dev.exe Alternatively you can run `bazel build //src:bazel.exe --compilation_mode=opt` to yield a smaller binary but it's slower to build. + You can build with `--stamp --embed_label=X.Y.Z` flag to embed a Bazel + version for the binary so that `bazel --version` outputs the given version. + 4. The output will be at `bazel-bin\src\bazel-dev.exe` (or `bazel-bin\src\bazel.exe`).