-
Notifications
You must be signed in to change notification settings - Fork 21
/
gen-proto.ps1
32 lines (24 loc) · 1.09 KB
/
gen-proto.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# ----------------------------------------------------------------
# Copyright (c) ThoughtWorks, Inc.
# Licensed under the Apache License, Version 2.0
# See LICENSE.txt in the project root for license information.
# ----------------------------------------------------------------
dotnet restore
$grpc_tools_version = "2.65.0"
$grpc_tools = Join-Path $HOME ".nuget\packages\grpc.tools\$grpc_tools_version\tools"
$protoc = $null
$grpc_csharp = $null
if ($env:PROCESSOR_ARCHITECTURE -match 64){
$protoc = Resolve-Path $grpc_tools\windows_x64\protoc.exe
$grpc_csharp = Resolve-Path $grpc_tools\windows_x64\grpc_csharp_plugin.exe
}
else {
$protoc = Resolve-Path $grpc_tools\windows_x86\protoc.exe
$grpc_csharp = Resolve-Path $grpc_tools\windows_x86\grpc_csharp_plugin.exe
}
Write-Host "Generating Proto Classes.."
gci ".\gauge-proto" -Filter "*.proto" | %{
Write-Host "Generating classes for $_"
&$protoc @('-I.\gauge-proto', '--csharp_out=.\src\Gauge.CSharp.Core','--grpc_out=.\src\Gauge.CSharp.Core',"--plugin=protoc-gen-grpc=$grpc_csharp", ".\gauge-proto\$_")
}
Write-Host "Done!"