build_artifact_csharp.bat 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. @rem Builds C# artifacts on Windows
  15. set ARCHITECTURE=%1
  16. @rem enter repo root
  17. cd /d %~dp0\..\..\..
  18. mkdir cmake
  19. cd cmake
  20. mkdir build
  21. cd build
  22. mkdir %ARCHITECTURE%
  23. cd %ARCHITECTURE%
  24. @rem Use externally provided env to determine build parallelism, otherwise use default.
  25. if "%GRPC_CSHARP_BUILD_EXT_COMPILER_JOBS%"=="" (
  26. set GRPC_CSHARP_BUILD_EXT_COMPILER_JOBS=2
  27. )
  28. @rem set cl.exe build environment to build with VS2015 tooling
  29. @rem this is required for Ninja build to work
  30. call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %ARCHITECTURE%
  31. @rem restore command echo
  32. echo on
  33. @rem Select MSVC compiler (cl.exe) explicitly to make sure we don't end up gcc from mingw or cygwin
  34. @rem (both are on path in kokoro win workers)
  35. cmake -G Ninja -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DgRPC_BUILD_TESTS=OFF -DgRPC_MSVC_STATIC_RUNTIME=ON -DgRPC_XDS_USER_AGENT_IS_CSHARP=ON ../../.. || goto :error
  36. ninja -j%GRPC_CSHARP_BUILD_EXT_COMPILER_JOBS% grpc_csharp_ext || goto :error
  37. cd ..\..\..
  38. mkdir -p %ARTIFACTS_OUT%
  39. copy /Y cmake\build\%ARCHITECTURE%\grpc_csharp_ext.dll %ARTIFACTS_OUT% || goto :error
  40. copy /Y cmake\build\%ARCHITECTURE%\grpc_csharp_ext.pdb %ARTIFACTS_OUT% || goto :error
  41. goto :EOF
  42. :error
  43. echo Failed!
  44. exit /b %errorlevel%