xref: /aosp_15_r20/external/grpc-grpc/third_party/toolchains/generate_windows_rbe_configs.sh (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1#!/bin/bash
2# Copyright 2023 The gRPC Authors
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# Generate windows RBE configs using rbe_configs_gen.
17# See https://github.com/bazelbuild/bazel-toolchains#rbe_configs_gen---cli-tool-to-generate-configs
18
19set -ex
20
21cd $(dirname $0)/../..
22
23REPO_ROOT="$(pwd)"
24
25# Download a recent version of rbe_configs_gen binary
26wget https://github.com/bazelbuild/bazel-toolchains/releases/download/v5.1.2/rbe_configs_gen_windows_amd64.exe
27
28RBE_CONFIGS_GEN_TOOL_PATH="./rbe_configs_gen_windows_amd64.exe"
29
30# Actions on RBE will run under a dedicated docker image.
31WINDOWS_RBE_DOCKER_IMAGE=us-docker.pkg.dev/grpc-testing/testing-images-public/rbe_windows2019@sha256:63aed074a2ca1bf5af45bb43b255d21d51882d7169ec57be7f0f5454ea5d2c98
32
33# Bazel version used for configuring
34# Needs to be one of the versions from bazel/supported_versions.txt chosen so that the result is compatible
35# with other supported bazel versions.
36BAZEL_VERSION=6.3.2
37
38# Where to store the generated configs (relative to repo root)
39CONFIG_OUTPUT_PATH=third_party/toolchains/rbe_windows_bazel_6.3.2_vs2019
40
41# Delete old generated configs.
42rm -rf "${REPO_ROOT}/${CONFIG_OUTPUT_PATH}"
43
44# Pull the RBE windows docker image first.
45# TOOD(jtattermusch): investigate why pulling a docker image on windows is extremely slow.
46docker pull ${WINDOWS_RBE_DOCKER_IMAGE}
47
48${RBE_CONFIGS_GEN_TOOL_PATH} \
49    --bazel_version="${BAZEL_VERSION}" \
50    --toolchain_container="${WINDOWS_RBE_DOCKER_IMAGE}" \
51    --output_src_root="${REPO_ROOT}" \
52    --output_config_path="${CONFIG_OUTPUT_PATH}" \
53    --exec_os=windows \
54    --target_os=windows \
55    --generate_java_configs=false
56