Fix build script issues

This commit is contained in:
murgatroid99 2019-02-07 10:57:40 -08:00
parent 275b2908f9
commit 35e7a7575a
4 changed files with 27 additions and 12 deletions

View File

@ -3,6 +3,9 @@ if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/protobuf)
add_subdirectory(${PROTOBUF_ROOT_DIR}/cmake deps/protobuf)

View File

@ -1,3 +1,5 @@
Install-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 -Force
Import-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201
Install-Module -Name 7Zip4Powershell
function MkDir-p($Path) {
@ -9,10 +11,10 @@ function MkDir-p($Path) {
$WellKnownProtos = "any","api","compiler/plugin","descriptor","duration","empty","field_mask","source_context","struct","timestamp","type","wrappers"
$Base = %~dp0
$Base = $PSScriptRoot
cd $Base
$ProtobufBase = $Base + "/deps/protobuf"
MkDir-p $Base + "/build/bin"
MkDir-p ($Base + "/build/bin")
$PackageFile = $Base + "/package.json"
$ToolsVersion = (Get-Content $PackageFile) -join "`n" | ConvertFrom-Json | Get-Member -Name version
@ -21,7 +23,7 @@ $OutDir = $Env:ARTIFACTS_OUT + "/grpc-tools/v" + $ToolsVersion
Mkdir-p $OutDir
foreach ($Proto in $WellKnownProtos) {
Copy-Item $ProtobufBase + "/src/google/protobuf/" + $Proto + ".proto" -Destination $Base + "/build/bin/google/protobuf/" + $Proto + ".proto"
Copy-Item ($ProtobufBase + "/src/google/protobuf/" + $Proto + ".proto") -Destination ($Base + "/build/bin/google/protobuf/" + $Proto + ".proto")
}
$ArchList = "ia32","x64"
@ -32,16 +34,16 @@ 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"
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 ."
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 + "/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"
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")
}

View File

@ -2,4 +2,4 @@ cd /d %~dp0
cd ../..
set ARTIFACTS_OUT=artifacts
powershell -File ./packages/grpc-tools/build_binaries.ps1
powershell -File ./packages/grpc-tools/build_binaries.ps1 || exit /b 1

View File

@ -2,4 +2,14 @@ set -e
cd $(dirname $0)/../..
base_dir=$(pwd)
ARTIFACTS_OUT=$base_dir/artifacts ./packages/grpc-tools/build_binaries.sh
OS=$(uname)
case $OS in
Linux)
docker build -t kokoro-native-image tools/release/native
docker run -v /var/run/docker.sock:/var/run/docker.sock -v $base_dir:$base_dir kokoro-native-image -e ARTIFACTS_OUT=$base_dir/artifacts $base_dir/packages/grpc-tools/build_binaries.sh
;;
Darwin)
ARTIFACTS_OUT=$base_dir/artifacts ./packages/grpc-tools/build_binaries.sh
;;
esac