xref: /aosp_15_r20/external/abseil-cpp/ci/windows_msvc_bazel.bat (revision 9356374a3709195abf420251b3e825997ff56c0f)
1*9356374aSAndroid Build Coastguard Worker:: Copyright 2023 The Abseil Authors
2*9356374aSAndroid Build Coastguard Worker::
3*9356374aSAndroid Build Coastguard Worker:: Licensed under the Apache License, Version 2.0 (the "License");
4*9356374aSAndroid Build Coastguard Worker:: you may not use this file except in compliance with the License.
5*9356374aSAndroid Build Coastguard Worker:: You may obtain a copy of the License at
6*9356374aSAndroid Build Coastguard Worker::
7*9356374aSAndroid Build Coastguard Worker::     https://www.apache.org/licenses/LICENSE-2.0
8*9356374aSAndroid Build Coastguard Worker::
9*9356374aSAndroid Build Coastguard Worker:: Unless required by applicable law or agreed to in writing, software
10*9356374aSAndroid Build Coastguard Worker:: distributed under the License is distributed on an "AS IS" BASIS,
11*9356374aSAndroid Build Coastguard Worker:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*9356374aSAndroid Build Coastguard Worker:: See the License for the specific language governing permissions and
13*9356374aSAndroid Build Coastguard Worker:: limitations under the License.
14*9356374aSAndroid Build Coastguard Worker
15*9356374aSAndroid Build Coastguard WorkerSETLOCAL ENABLEDELAYEDEXPANSION
16*9356374aSAndroid Build Coastguard Worker
17*9356374aSAndroid Build Coastguard Worker:: Change directory to the root of the project.
18*9356374aSAndroid Build Coastguard WorkerCD %~dp0\..
19*9356374aSAndroid Build Coastguard Workerif %errorlevel% neq 0 EXIT /B 1
20*9356374aSAndroid Build Coastguard Worker
21*9356374aSAndroid Build Coastguard Worker:: Set the standard version, [c++14|c++latest]
22*9356374aSAndroid Build Coastguard Worker:: https://msdn.microsoft.com/en-us/library/mt490614.aspx
23*9356374aSAndroid Build Coastguard Worker:: The default is c++14 if not set on command line.
24*9356374aSAndroid Build Coastguard WorkerIF "%STD%"=="" SET STD=c++14
25*9356374aSAndroid Build Coastguard Worker
26*9356374aSAndroid Build Coastguard Worker:: Set the compilation_mode (fastbuild|opt|dbg)
27*9356374aSAndroid Build Coastguard Worker:: https://docs.bazel.build/versions/master/user-manual.html#flag--compilation_mode
28*9356374aSAndroid Build Coastguard Worker:: The default is fastbuild
29*9356374aSAndroid Build Coastguard WorkerIF "%COMPILATION_MODE%"=="" SET COMPILATION_MODE=fastbuild
30*9356374aSAndroid Build Coastguard Worker
31*9356374aSAndroid Build Coastguard Worker:: Copy the alternate option file, if specified.
32*9356374aSAndroid Build Coastguard WorkerIF NOT "%ALTERNATE_OPTIONS%"=="" copy %ALTERNATE_OPTIONS% absl\base\options.h
33*9356374aSAndroid Build Coastguard Worker
34*9356374aSAndroid Build Coastguard Worker:: To upgrade Bazel, first download a new binary from
35*9356374aSAndroid Build Coastguard Worker:: https://github.com/bazelbuild/bazel/releases and copy it to
36*9356374aSAndroid Build Coastguard Worker:: /google/data/rw/teams/absl/kokoro/windows.
37*9356374aSAndroid Build Coastguard Worker%KOKORO_GFILE_DIR%\bazel-7.0.0-windows-x86_64.exe ^
38*9356374aSAndroid Build Coastguard Worker  test ... ^
39*9356374aSAndroid Build Coastguard Worker  --compilation_mode=%COMPILATION_MODE% ^
40*9356374aSAndroid Build Coastguard Worker  --copt=/WX ^
41*9356374aSAndroid Build Coastguard Worker  --copt=/std:%STD% ^
42*9356374aSAndroid Build Coastguard Worker  --define=absl=1 ^
43*9356374aSAndroid Build Coastguard Worker  --distdir=%KOKORO_GFILE_DIR%\distdir ^
44*9356374aSAndroid Build Coastguard Worker  --enable_bzlmod=true ^
45*9356374aSAndroid Build Coastguard Worker  --keep_going ^
46*9356374aSAndroid Build Coastguard Worker  --test_env="GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1" ^
47*9356374aSAndroid Build Coastguard Worker  --test_env=TZDIR="%CD%\absl\time\internal\cctz\testdata\zoneinfo" ^
48*9356374aSAndroid Build Coastguard Worker  --test_output=errors ^
49*9356374aSAndroid Build Coastguard Worker  --test_tag_filters=-benchmark
50*9356374aSAndroid Build Coastguard Worker
51*9356374aSAndroid Build Coastguard Workerif %errorlevel% neq 0 EXIT /B 1
52*9356374aSAndroid Build Coastguard WorkerEXIT /B 0
53