Skip to content

Commit

Permalink
Introduce a stub bazel_wrapper/bazel.bat
Browse files Browse the repository at this point in the history
This is a preparation before starting using 'clang-cl' to build Mozc for
for Windows with Bazel (google#1179).

In order to make the build process reliable and reproducible, we would
like to download a specific version of LLVM with 'update_deps.py' then
deploy it under 'third_party/llvm/' and let 'rules_cc' use it by
specifying 'BAZEL_LLVM' environment variable [1].

To automate this process, one idea is to use 'tools/bazel' wrapper
script [2]. Luckily the wrapper script directory is also customizable
since bazelisk v1.21.0 [3].

With above this commit introduces a stub 'bazel.bat' so that we can use
it to set various environment variables for Windows bazel build in
subsequent commits. At this moment there must be no difference in the
final artifacts.

 [1]: https://bazel.build/configure/windows#clang
 [2]: https://github.com/bazelbuild/bazelisk/blob/master/README.md#toolsbazel
 [3]: bazelbuild/bazelisk#567
  • Loading branch information
yukawa committed Feb 27, 2025
1 parent f35915d commit aa37135
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/.bazeliskrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
USE_BAZEL_VERSION=8.1.0
BAZELISK_WRAPPER_DIRECTORY=./bazel_wrapper
13 changes: 13 additions & 0 deletions src/bazel_wrapper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# bazel_wrapper

This directory can be used to place special wrapper scripts for bazelisk.

* [tools/bazel - Bazelisk](https://github.com/bazelbuild/bazelisk/blob/master/README.md#toolsbazel).

By default `bazel` and `bazelisk` uses `tools/` as the bazel wrapper directory, but `bazelisk` allows us to customize it with `BAZELISK_WRAPPER_DIRECTORY` in [`src/.bazeliskrc`](../.bazeliskrc) since bazelisk v1.21.0.

* [Allow overriding tools/bazel path with BAZELISK_WRAPPER_DIRECTORY](https://github.com/bazelbuild/bazelisk/pull/567)

## Contents

* [bazel.bat](./bazel.bat)
5 changes: 5 additions & 0 deletions src/bazel_wrapper/bazel.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
%BAZEL_REAL% %* & call:myexit

:myexit
exit /b

0 comments on commit aa37135

Please sign in to comment.