Fix bug in Batch files when checking for unset variables PiperOrigin-RevId: 997224152 Change-Id: I8d032522a296b59b59e2ed7246b908ccf0bb471e
diff --git a/ci/windows_clangcl_bazel.bat b/ci/windows_clangcl_bazel.bat index 42be0f7..e196d3b 100755 --- a/ci/windows_clangcl_bazel.bat +++ b/ci/windows_clangcl_bazel.bat
@@ -32,15 +32,15 @@ :: Set the standard version, [c++17|c++20|c++latest] :: https://msdn.microsoft.com/en-us/library/mt490614.aspx :: The default is c++17 if not set on command line. -IF "%STD%"=="" SET STD=c++17 +IF NOT DEFINED STD SET STD=c++17 :: Set the compilation_mode (fastbuild|opt|dbg) :: https://docs.bazel.build/versions/master/user-manual.html#flag--compilation_mode :: The default is fastbuild -IF "%COMPILATION_MODE%"=="" SET COMPILATION_MODE=fastbuild +IF NOT DEFINED COMPILATION_MODE SET COMPILATION_MODE=fastbuild :: Copy the alternate option file, if specified. -IF NOT "%ALTERNATE_OPTIONS%"=="" copy %ALTERNATE_OPTIONS% absl\base\options.h +IF DEFINED ALTERNATE_OPTIONS copy %ALTERNATE_OPTIONS% absl\base\options.h :: To upgrade Bazel, first download a new binary from :: https://github.com/bazelbuild/bazel/releases and copy it to @@ -49,11 +49,11 @@ :: TODO(absl-team): Remove -Wno-microsoft-cast %KOKORO_GFILE_DIR%\bazel-9.1.0-windows-x86_64.exe ^ test ... ^ - --compilation_mode=%COMPILATION_MODE% ^ + --compilation_mode="%COMPILATION_MODE%" ^ --compiler=clang-cl ^ --copt=/WX ^ --copt=-Wno-microsoft-cast ^ - --cxxopt=/std:%STD% ^ + --cxxopt="/std:%STD%" ^ --define=absl=1 ^ --enable_bzlmod=true ^ --extra_execution_platforms=//:x64_windows-clang-cl ^
diff --git a/ci/windows_msvc_bazel.bat b/ci/windows_msvc_bazel.bat index a4bd3d7..4cb0870 100755 --- a/ci/windows_msvc_bazel.bat +++ b/ci/windows_msvc_bazel.bat
@@ -29,24 +29,24 @@ :: Set the standard version, [c++17|c++latest] :: https://msdn.microsoft.com/en-us/library/mt490614.aspx :: The default is c++17 if not set on command line. -IF "%STD%"=="" SET STD=c++17 +IF NOT DEFINED STD SET STD=c++17 :: Set the compilation_mode (fastbuild|opt|dbg) :: https://docs.bazel.build/versions/master/user-manual.html#flag--compilation_mode :: The default is fastbuild -IF "%COMPILATION_MODE%"=="" SET COMPILATION_MODE=fastbuild +IF NOT DEFINED COMPILATION_MODE SET COMPILATION_MODE=fastbuild :: Copy the alternate option file, if specified. -IF NOT "%ALTERNATE_OPTIONS%"=="" copy %ALTERNATE_OPTIONS% absl\base\options.h +IF DEFINED ALTERNATE_OPTIONS copy %ALTERNATE_OPTIONS% absl\base\options.h :: To upgrade Bazel, first download a new binary from :: https://github.com/bazelbuild/bazel/releases and copy it to :: /google/data/rw/teams/absl/kokoro/windows. "%KOKORO_GFILE_DIR%\bazel-9.1.0-windows-x86_64.exe" ^ test ... ^ - --compilation_mode=%COMPILATION_MODE% ^ + --compilation_mode="%COMPILATION_MODE%" ^ --copt=/WX ^ - --cxxopt=/std:%STD% ^ + --cxxopt="/std:%STD%" ^ --define=absl=1 ^ --enable_bzlmod=true ^ --keep_going ^
diff --git a/ci/windows_msvc_cmake.bat b/ci/windows_msvc_cmake.bat index 88d6efe..a35dcec 100755 --- a/ci/windows_msvc_cmake.bat +++ b/ci/windows_msvc_cmake.bat
@@ -43,13 +43,13 @@ :: Set the standard version, [c++17|c++latest] :: https://msdn.microsoft.com/en-us/library/mt490614.aspx :: The default is c++17 if not set on command line. -IF "%STD%"=="" SET STD=17 +IF NOT DEFINED STD SET STD=17 -IF "%ABSL_CMAKE_BUILD_SHARED%"=="" SET ABSL_CMAKE_BUILD_SHARED=OFF +IF NOT DEFINED ABSL_CMAKE_BUILD_SHARED SET ABSL_CMAKE_BUILD_SHARED=OFF -IF "%ABSL_CMAKE_BUILD_TYPE%"=="" SET ABSL_CMAKE_BUILD_TYPE=Debug +IF NOT DEFINED ABSL_CMAKE_BUILD_TYPE SET ABSL_CMAKE_BUILD_TYPE=Debug -IF "%ABSL_CMAKE_GENERATOR%"=="" SET "ABSL_CMAKE_GENERATOR=Visual Studio 17 2022" +IF NOT DEFINED ABSL_CMAKE_GENERATOR SET "ABSL_CMAKE_GENERATOR=Visual Studio 17 2022" :: Change directory to the root of the project. CD %~dp0\.. @@ -64,9 +64,9 @@ %CMAKE_BIN% ^ -DABSL_BUILD_TESTING=ON ^ - -DABSL_GOOGLETEST_DOWNLOAD_URL=%ABSL_GOOGLETEST_DOWNLOAD_URL% ^ - -DBUILD_SHARED_LIBS=%ABSL_CMAKE_BUILD_SHARED% ^ - -DCMAKE_CXX_STANDARD=%STD% ^ + -DABSL_GOOGLETEST_DOWNLOAD_URL="%ABSL_GOOGLETEST_DOWNLOAD_URL%" ^ + -DBUILD_SHARED_LIBS="%ABSL_CMAKE_BUILD_SHARED%" ^ + -DCMAKE_CXX_STANDARD="%STD%" ^ -G "%ABSL_CMAKE_GENERATOR%" ^ .. IF %errorlevel% neq 0 EXIT /B 1