diff --git a/packages/grpc-tools/CMakeLists.txt b/packages/grpc-tools/CMakeLists.txt index e3deadde..11d6e843 100644 --- a/packages/grpc-tools/CMakeLists.txt +++ b/packages/grpc-tools/CMakeLists.txt @@ -18,6 +18,9 @@ add_executable(grpc_node_plugin src/node_plugin.cc ) +if (MSVC) + add_definitions(/MTd) +endif (MSVC) target_include_directories(grpc_node_plugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index 7b8d49b6..1a99b99a 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -1,7 +1,11 @@ +$ErrorActionPreference = "Stop" + Install-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 -Force Import-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 Install-Module -Force -Name 7Zip4Powershell +$env:Path += ";C:\Program Files\CMake\bin" + function MkDir-p($Path) { $FullPath = "\\?\" + $Path if (-not (Test-Path -Path $FullPath)) { @@ -28,16 +32,23 @@ foreach ($Arch in $ArchList) { } else { $Generator = "Visual Studio 14 2015" } - Remove-Item ($Base + "/build/bin/protoc.exe") - Remove-Item ($Base + "/build/bin/grpc_node_plugin.exe") - Remove-Item ($Base + "CMakeCache.txt") - Invoke-Expression "cmake ." - Invoke-Expression "cmake --build ." + & cmake.exe . + if ($LASTEXITCODE -ne 0) { + throw "cmake failed" + } + & cmake.exe --build . + if ($LASTEXITCODE -ne 0) { + throw "cmake build failed" + } - Copy-Item ($ProtobufBase + "/protoc.exe") -Destination ($Base + "/build/bin/protoc.exe") - Copy-Item ($Base + "/grpc_node_plugin.exe") -Destination ($Base + "/build/bin/grpc_node_plugin.exe") + Copy-Item ($ProtobufBase + "/Debug/protoc.exe") -Destination ($Base + "/build/bin/protoc.exe") + Copy-Item ($Base + "/Debug/grpc_node_plugin.exe") -Destination ($Base + "/build/bin/grpc_node_plugin.exe") Compress-7Zip -Path ($Base + "/build") -Format Tar -ArchiveFileName ($Base + "/Archive.tar") Compress-7Zip -Path ($Base + "/Archive.tar") -Format GZip -ArchiveFileName ($OutDir + "/windows-x64.tar.gz") + + Remove-Item ($Base + "/build/bin/protoc.exe") + Remove-Item ($Base + "/build/bin/grpc_node_plugin.exe") + Remove-Item ($Base + "/CMakeCache.txt") } \ No newline at end of file diff --git a/test/kokoro-nodejs-build-test.bat b/test/kokoro-nodejs-build-test.bat index bc987226..ac109e51 100644 --- a/test/kokoro-nodejs-build-test.bat +++ b/test/kokoro-nodejs-build-test.bat @@ -1,8 +1,8 @@ cd /d %~dp0 cd .. -call ./tools/release/kokoro-nodejs.bat || goto :error call ./tools/release/kokoro-grpc-tools.bat || goto :error +call ./tools/release/kokoro-nodejs.bat || goto :error goto :EOF diff --git a/tools/release/kokoro-grpc-tools.bat b/tools/release/kokoro-grpc-tools.bat index c6df803b..d0f7a74e 100644 --- a/tools/release/kokoro-grpc-tools.bat +++ b/tools/release/kokoro-grpc-tools.bat @@ -3,6 +3,8 @@ cd ../.. git submodule update --init --recursive +@rem make sure msys binaries are preferred over cygwin binaries +set PATH=C:\tools\msys64\usr\bin;%PATH% set ARTIFACTS_OUT=%cd%/artifacts powershell -File ./packages/grpc-tools/build_binaries.ps1 || goto :error goto :EOF diff --git a/tools/release/kokoro-nodejs.bat b/tools/release/kokoro-nodejs.bat index 054fc72b..d73a592a 100644 --- a/tools/release/kokoro-nodejs.bat +++ b/tools/release/kokoro-nodejs.bat @@ -30,12 +30,11 @@ cd ..\.. git submodule update --init git submodule foreach --recursive git submodule update --init -set ARTIFACTS_OUT=artifacts +set ARTIFACTS_OUT=%cd%\artifacts cd packages\grpc-native-core call tools\run_tests\artifacts\build_artifact_node.bat || goto :error cd ..\.. -move packages\grpc-native-core\artifacts . goto :EOF :error