build_csharp.bat 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. @rem Copyright 2016 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. setlocal
  15. cd /d %~dp0\..\..\..
  16. mkdir cmake
  17. cd cmake
  18. mkdir build
  19. cd build
  20. @rem use setlocal/endlocal to prevent the C++ build env variables from polluting the environment for "dotnet build"
  21. setlocal
  22. @rem set cl.exe build environment to build with VS2015 tooling
  23. @rem this is required for Ninja build to work
  24. call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %ARCHITECTURE%
  25. @rem restore command echo
  26. echo on
  27. @rem Select MSVC compiler (cl.exe) explicitly to make sure we don't end up gcc from mingw or cygwin
  28. @rem (both are on path in kokoro win workers)
  29. cmake -G Ninja -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=%MSBUILD_CONFIG% -DgRPC_BUILD_TESTS=OFF -DgRPC_MSVC_STATIC_RUNTIME=ON -DgRPC_XDS_USER_AGENT_IS_CSHARP=ON ../.. || goto :error
  30. ninja -j%GRPC_RUN_TESTS_JOBS% grpc_csharp_ext || goto :error
  31. endlocal
  32. cd ..\..\src\csharp
  33. dotnet build --configuration %MSBUILD_CONFIG% Grpc.sln || goto :error
  34. endlocal
  35. goto :EOF
  36. :error
  37. echo Failed!
  38. exit /b %errorlevel%