-
Notifications
You must be signed in to change notification settings - Fork 18
/
.bazelversion
65 lines (57 loc) · 2.8 KB
/
.bazelversion
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
7.4.1
### PLEASE READ ###
Bazelisk only reads the first line of this file. Don't move this up.
When upgrading bazel, you must also upgrade toolchains.
1. Install rbe_configs_gen:
1.1: $ git clone https://github.com/bazelbuild/bazel-toolchains
1.2: $ cd bazel-toolchains
1.3: $ go install ./cmd/rbe_configs_gen/rbe_configs_gen.go
2. Run it for Linux:
```
export NEW_BAZEL_VERSION=$(head -n 1 .bazelversion | tail -n 1)
export PATH_TO_RECLIENT=$PWD
export DOCKER_IMAGE="$(grep -Eio 'LINUX_DOCKER_IMAGE = "[^"]*' configs/defs.bzl | sed 's/LINUX_DOCKER_IMAGE = "//')"
rbe_configs_gen \
--output_src_root=${PATH_TO_RECLIENT} \
--output_config_path=configs/linux \
--exec_os=linux \
--target_os=linux \
--toolchain_container=${DOCKER_IMAGE} \
--bazel_version=${NEW_BAZEL_VERSION} \
--generate_java_configs=false
bazelisk run //:gazelle
```
Then:
1. Edit the cc_library in //configs/linux/cc/BUILD.bazel to include
`tags=["manual"]` so it isn't caught by `...` expansion.
2. Add `Copyright 2023 Google LLC` header for //configs/linux/cc/tools/cpp/empty.cc.
3. Edit the toolchain->exec_compatible_with in //configs/linux/config/BUILD to include "@linux_android1404//:no_android_toolchain"
3. Edit configs/linux/config/BUILD to refer to the constant in configs/defs.bzl
instead of hardcoding the docker image version.
3. Run it for Windows in PowerShell as an administrator.
(You'll need a windows GCE VM with docker enabled, gWindows cloudtop does not support docker)
$ gcloud auth configure-docker us-central1-docker.pkg.dev
# You must use your email to login, as service account does not have the permission to docker pull images from kokoro-container-bakery
$ gcloud auth login --no-launch-browser
$ $DOCKER_IMAGE = (Select-String -Path configs/defs.bzl -Pattern 'WINDOWS_DOCKER_IMAGE = "([^"]*)"' -AllMatches | ForEach-Object {$_.Matches.Groups[1].Value})
$ $NEW_BAZEL_VERSION = (Get-Content -Path .bazelversion -TotalCount 1)
$ $PATH_TO_RECLIENT = $PWD
$ rbe_configs_gen.exe `
--output_src_root=$PATH_TO_RECLIENT `
--output_config_path=configs/windows `
--exec_os=windows `
--target_os=windows `
--toolchain_container=$DOCKER_IMAGE `
--cpp_toolchain_target=cc-compiler-x64_windows-clang-cl `
--bazel_version=$NEW_BAZEL_VERSION `
--generate_java_configs=false
$ bazelisk run //:gazelle
Then:
1. Edit the cc_toolchain_suite in //configs/windows/cc/BUILD.bazel to include
`tags=["manual"]` so it isn't caught by `...` expansion.
2. Edit //configs/windows/config/BUILD to include "@bazel_tools//tools/cpp:clang-cl" for both:
- "cc-toolchain"'s exec_compatible_with field;
- "cc-toolchain"'s target_compatible_with field;
- "platform"'s constraint_values field;
3. Edit //configs/windows/config/BUILD to refer to the constant in configs/defs.bzl
instead of hardcoding the docker image version.