Imported Upstream version 1.41.0
[platform/upstream/grpc.git] / tools / internal_ci / helper_scripts / prepare_build_windows.bat
1 @rem Copyright 2017 gRPC authors.
2 @rem
3 @rem Licensed under the Apache License, Version 2.0 (the "License");
4 @rem you may not use this file except in compliance with the License.
5 @rem You may obtain a copy of the License at
6 @rem
7 @rem     http://www.apache.org/licenses/LICENSE-2.0
8 @rem
9 @rem Unless required by applicable law or agreed to in writing, software
10 @rem distributed under the License is distributed on an "AS IS" BASIS,
11 @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 @rem See the License for the specific language governing permissions and
13 @rem limitations under the License.
14
15 @rem make sure msys binaries are preferred over cygwin binaries
16 @rem set path to python 2.7
17 @rem set path to CMake
18 set PATH=C:\tools\msys64\usr\bin;C:\Python27;C:\Program Files\CMake\bin;%PATH%
19
20 @rem If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests
21 if defined KOKORO_GITHUB_PULL_REQUEST_NUMBER if defined RUN_TESTS_FLAGS (
22   set RUN_TESTS_FLAGS=%RUN_TESTS_FLAGS% --filter_pr_tests --base_branch origin/%KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH%
23 )
24
25 @rem Update DNS settings to:
26 @rem 1. allow resolving metadata.google.internal hostname
27 @rem 2. make fetching default GCE credential by oauth2client work
28 netsh interface ip set dns "Local Area Connection 8" static 169.254.169.254 primary
29 netsh interface ip add dnsservers "Local Area Connection 8" 8.8.8.8 index=2
30 netsh interface ip add dnsservers "Local Area Connection 8" 8.8.4.4 index=3
31
32 @rem Needed for big_query_utils
33 python -m pip install google-api-python-client || goto :error
34
35 @rem C# prerequisites: Install dotnet SDK
36 powershell -File src\csharp\install_dotnet_sdk.ps1 || goto :error
37 set PATH=%LOCALAPPDATA%\Microsoft\dotnet;%PATH%
38
39 @rem Disable some unwanted dotnet options
40 set NUGET_XMLDOC_MODE=skip
41 set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
42 set DOTNET_CLI_TELEMETRY_OPTOUT=true
43
44 @rem Only install Python interpreters if we are running Python tests
45 If "%PREPARE_BUILD_INSTALL_DEPS_PYTHON%" == "true" (
46     powershell -File tools\internal_ci\helper_scripts\install_python_interpreters.ps1 || goto :error
47 )
48
49 git submodule update --init || goto :error
50
51 goto :EOF
52
53 :error
54 exit /b 1