-
Notifications
You must be signed in to change notification settings - Fork 56
/
gen.cmd
32 lines (25 loc) · 945 Bytes
/
gen.cmd
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
@echo off
setlocal
rem Define array elements
set "PROTO_NAMES=auth conversation errinfo relation group jssdk msg msggateway push rtc sdkws third user statistics wrapperspb"
rem Loop through each element in the array
for %%i in (%PROTO_NAMES%) do (
protoc --go_out=./%%i --go_opt=module=github.com/openimsdk/protocol/%%i %%i/%%i.proto
if ERRORLEVEL 1 (
echo error processing %%i.proto
exit /b %ERRORLEVEL%
)
)
rem Generate Go-grpc code
for %%i in (%PROTO_NAMES%) do (
protoc --go-grpc_out=./%%i --go-grpc_opt=module=github.com/openimsdk/protocol/%%i %%i/%%i.proto
if ERRORLEVEL 1 (
echo error processing %%i.proto
exit /b %ERRORLEVEL%
)
)
rem Replace "omitempty" in *.pb.go files with UTF-8 encoding
for /r %%f in (*.pb.go) do (
powershell -Command "(Get-Content -Path '%%f' -Encoding UTF8) -replace ',omitempty\"`"', '\"`"' | Set-Content -Path '%%f' -Encoding UTF8"
)
endlocal