Kokoro: use ninja to build faster for Windows builds

Saves about 5 minutes per Windows build.

Bug: tint:940
Change-Id: Ib03fb6ca9d51575d8ee82324be7040153e5536bf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72540
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
diff --git a/kokoro/windows/build.bat b/kokoro/windows/build.bat
index 8ae65f2..1dfb553 100644
--- a/kokoro/windows/build.bat
+++ b/kokoro/windows/build.bat
@@ -104,7 +104,7 @@
 @echo on

 mkdir %BUILD_DIR%

 cd /d %BUILD_DIR%

-set COMMON_CMAKE_FLAGS=-DTINT_BUILD_DOCS=O

+set COMMON_CMAKE_FLAGS=-DTINT_BUILD_DOCS=O -DCMAKE_BUILD_TYPE=%BUILD_TYPE%

 @echo off

 

 call :status "Building tint"

@@ -113,13 +113,18 @@
 set IgnoreWarnIntDirInTempDetected=true

 rem Add Python3 to path as this Kokoro image only has Python2 in it

 set PATH=C:\Python37;%PATH%

-cmake %SRC_DIR% %CMAKE_FLAGS% %COMMON_CMAKE_FLAGS% || goto :error

-cmake --build . --config %BUILD_TYPE% || goto :error

+rem To use ninja with CMake requires VC env vars

+call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"

+@echo on

+rem Note that we need to specify the C and C++ compiler only because Cygwin is in PATH and CMake finds GCC and picks that over MSVC

+cmake %SRC_DIR% -G "Ninja" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" %COMMON_CMAKE_FLAGS% || goto :error

+cmake --build . || goto :error

+call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" /clean_env

 @echo off

 

 call :status "Running tint_unittests"

 @echo on

-%BUILD_TYPE%\tint_unittests.exe || goto :error

+tint_unittests.exe || goto :error

 @echo off

 

 call :status "Testing test/test-all.sh"

@@ -127,7 +132,7 @@
 cd /d %SRC_DIR% || goto :error

 set PATH=C:\Program Files\Metal Developer Tools\macos\bin;%PATH%

 where metal.exe

-git bash -- ./test/test-all.sh ../tint-build/%BUILD_TYPE%/tint.exe --verbose

+git bash -- ./test/test-all.sh ../tint-build/tint.exe --verbose

 @echo off

 

 call :status "Done"

diff --git a/kokoro/windows/cmake-msvc2019-debug/build.bat b/kokoro/windows/cmake-msvc2019-debug/build.bat
index f501277..25db347 100644
--- a/kokoro/windows/cmake-msvc2019-debug/build.bat
+++ b/kokoro/windows/cmake-msvc2019-debug/build.bat
@@ -14,6 +14,5 @@
 

 @echo on

 set BUILD_TYPE=Debug

-set CMAKE_FLAGS=-G "Visual Studio 16 2019" -A x64

 call %~dp0\..\build.bat

 exit /b %errorlevel%

diff --git a/kokoro/windows/cmake-msvc2019-release/build.bat b/kokoro/windows/cmake-msvc2019-release/build.bat
index 4984feb..a2f6072 100644
--- a/kokoro/windows/cmake-msvc2019-release/build.bat
+++ b/kokoro/windows/cmake-msvc2019-release/build.bat
@@ -14,6 +14,5 @@
 

 @echo on

 set BUILD_TYPE=Release

-set CMAKE_FLAGS=-G "Visual Studio 16 2019" -A x64

 call %~dp0\..\build.bat

 exit /b %errorlevel%