From b2756d2d78b4f1d66cce93d0f76ab891ae1c5d45 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 12 Feb 2019 12:59:40 -0800 Subject: [PATCH 1/9] grpc-tools build script fixes part 2 --- packages/grpc-tools/build_binaries.ps1 | 13 ++++++++----- tools/release/kokoro-grpc-tools.bat | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index 7b8d49b6..b0d92307 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -1,3 +1,5 @@ +$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 @@ -28,16 +30,17 @@ 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 . + & cmake --build . 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") 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/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 From 004d8e044a9bef2a67132b62ebe657aa7451d944 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 12 Feb 2019 16:04:29 -0800 Subject: [PATCH 2/9] Trying 'cmake.exe' --- packages/grpc-tools/build_binaries.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index b0d92307..6956b0ec 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -31,8 +31,8 @@ foreach ($Arch in $ArchList) { $Generator = "Visual Studio 14 2015" } - & cmake . - & cmake --build . + & cmake.exe . + & cmake.exe --build . 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") From 464f91a16401ffa51fc61cc5c56da782d8d37afe Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 13 Feb 2019 10:17:35 -0800 Subject: [PATCH 3/9] Add env debug output --- packages/grpc-tools/build_binaries.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index 6956b0ec..c0a362cf 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -1,5 +1,8 @@ $ErrorActionPreference = "Stop" +gci env:* +ls Env: + Install-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 -Force Import-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 Install-Module -Force -Name 7Zip4Powershell From 8bb3f0a130bc92066753826f4e75da6a448e9d32 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 13 Feb 2019 12:42:42 -0800 Subject: [PATCH 4/9] Add cmake to path --- packages/grpc-tools/build_binaries.ps1 | 5 ++--- test/kokoro-nodejs-build-test.bat | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index c0a362cf..34a38b95 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -1,12 +1,11 @@ $ErrorActionPreference = "Stop" -gci env:* -ls Env: - 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)) { 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 From 90233c965fa68c38d0d31ff8170d3301d8e48425 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 13 Feb 2019 15:22:48 -0800 Subject: [PATCH 5/9] Force plugin to link statically on Windows --- packages/grpc-tools/CMakeLists.txt | 3 +++ packages/grpc-tools/build_binaries.ps1 | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/grpc-tools/CMakeLists.txt b/packages/grpc-tools/CMakeLists.txt index e3deadde..85c90dee 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(/MT) +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 34a38b95..f96e4b98 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -33,8 +33,14 @@ foreach ($Arch in $ArchList) { $Generator = "Visual Studio 14 2015" } - & cmake.exe . - & cmake.exe --build . + & cmake.exe . --config Release + if ($LASTEXITCODE -ne 0) { + throw "cmake failed" + } + & cmake.exe --build . --config Release + 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") From 35c257c019fa1826ed6d1e877ee8a12f23285ba6 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 13 Feb 2019 15:58:48 -0800 Subject: [PATCH 6/9] Remove 'Release' config argument --- packages/grpc-tools/CMakeLists.txt | 2 +- packages/grpc-tools/build_binaries.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/grpc-tools/CMakeLists.txt b/packages/grpc-tools/CMakeLists.txt index 85c90dee..11d6e843 100644 --- a/packages/grpc-tools/CMakeLists.txt +++ b/packages/grpc-tools/CMakeLists.txt @@ -19,7 +19,7 @@ add_executable(grpc_node_plugin ) if (MSVC) - add_definitions(/MT) + add_definitions(/MTd) endif (MSVC) target_include_directories(grpc_node_plugin diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index f96e4b98..4af43784 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -33,11 +33,11 @@ foreach ($Arch in $ArchList) { $Generator = "Visual Studio 14 2015" } - & cmake.exe . --config Release + & cmake.exe . if ($LASTEXITCODE -ne 0) { throw "cmake failed" } - & cmake.exe --build . --config Release + & cmake.exe --build . if ($LASTEXITCODE -ne 0) { throw "cmake build failed" } From 9a629f9b76c40baffeed69c61ea2ee6fec8fa039 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 13 Feb 2019 16:22:13 -0800 Subject: [PATCH 7/9] Fix directory where we are searching for build output --- packages/grpc-tools/build_binaries.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index 4af43784..b551c8c2 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -42,8 +42,8 @@ foreach ($Arch in $ArchList) { 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") From d879e21a4216f81b8e23341497853457d349e939 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 13 Feb 2019 16:46:18 -0800 Subject: [PATCH 8/9] Fix missing slash in file path --- packages/grpc-tools/build_binaries.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index b551c8c2..1a99b99a 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -50,5 +50,5 @@ foreach ($Arch in $ArchList) { Remove-Item ($Base + "/build/bin/protoc.exe") Remove-Item ($Base + "/build/bin/grpc_node_plugin.exe") - Remove-Item ($Base + "CMakeCache.txt") + Remove-Item ($Base + "/CMakeCache.txt") } \ No newline at end of file From efe0fb1b8f58eb6a4fc75cec662cf35cbd462d3a Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 14 Feb 2019 09:27:48 -0800 Subject: [PATCH 9/9] Don't move artifacts directory around --- tools/release/kokoro-nodejs.bat | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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