Skip to content

Commit e453da9

Browse files
authored
Introduce a stub bazel wrapper for Windows (#1201)
This is a preparation before starting using 'clang-cl' to build Mozc for for Windows with Bazel (#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. There should be no impact on non-Windows bazel build as 'bazel.bat' is searched only on Windows. [1]: https://bazel.build/configure/windows#clang [2]: https://github.com/bazelbuild/bazelisk/blob/master/README.md#toolsbazel [3]: bazelbuild/bazelisk#567 PiperOrigin-RevId: 736025839
1 parent 2e2f2f5 commit e453da9

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/.bazeliskrc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
USE_BAZEL_VERSION=8.1.1
2+
BAZELISK_WRAPPER_DIRECTORY=./bazel/bazel_wrapper

src/bazel/bazel_wrapper/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# bazel_wrapper
2+
3+
This directory can be used to place special wrapper scripts for bazelisk.
4+
5+
* [tools/bazel - Bazelisk](https://github.com/bazelbuild/bazelisk/blob/master/README.md#toolsbazel)
6+
7+
By default `bazel` and `bazelisk` uses `tools/` as the bazel wrapper directory,
8+
but `bazelisk` allows us to customize it with `BAZELISK_WRAPPER_DIRECTORY` in
9+
[`src/.bazeliskrc`](../../.bazeliskrc) since bazelisk v1.21.0.
10+
11+
* [Allow overriding tools/bazel path with BAZELISK_WRAPPER_DIRECTORY](https://github.com/bazelbuild/bazelisk/pull/567)
12+
13+
## Contents
14+
15+
* [bazel.bat](./bazel.bat)

src/bazel/bazel_wrapper/bazel.bat

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@echo off
2+
%BAZEL_REAL% %* & call:myexit
3+
4+
:myexit
5+
exit /b

0 commit comments

Comments
 (0)