Skip to content

Commit f55970c

Browse files
committed
update
1 parent 45ed0cd commit f55970c

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

codegen/tml/cmd/template_cmd.go

+16-3
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ fi
115115
echo "option unsupport"
116116
help`
117117
const txtbat = `@echo off
118-
chcp 65001
119118
REM Warning!!!!!!!!!!!This file is readonly!Don't modify this file!
120119
121120
cd %~dp0
@@ -224,18 +223,32 @@ goto :help
224223
del >nul 2>nul .\api\*.md
225224
del >nul 2>nul .\api\*.ts
226225
go mod tidy
227-
for /f "delims=" %%i in ('go list -m -f {{"\"{{.Dir}}\""}} github.com/chenjie199234/Corelib') do ( set "corelib=%%i" )
228226
set workdir=%cd%
227+
for /f %%a in ('wmic os get CodeSet /value ^| find "="') do (
228+
for /f "tokens=2 delims==" %%b in ("%%a") do set current_chcp=%%b
229+
)
230+
REM don't known why,in different system codeset the corelib's path will be strange
231+
REM when want to use cd to switch to the dir,the codeset need to be set to the utf-8
232+
REM tested on Windows 10 Enterprise LTSC 2021 and system codeset is 936
233+
chcp 65001
234+
for /f %%a in ('go list -m -f "{{.Dir}}" github.com/chenjie199234/Corelib') do set corelib=%%a
229235
cd %corelib%
236+
chcp %current_chcp%
237+
echo install codegen and protoc plugins in %corelib%
230238
go install ./...
231239
cd %workdir%
240+
REM don't known why,in different system codeset the corelib's path will be strange
241+
REM when want to use protoc to generate code,the codeset need to be set to the system's codeset
242+
REM tested on Windows 10 Enterprise LTSC 2021 and system codeset is 936
243+
for /f %%a in ('go list -m -f "{{.Dir}}" github.com/chenjie199234/Corelib') do set corelib=%%a
244+
echo generate api in %workdir%
232245
protoc -I ./ -I %corelib% --go_out=paths=source_relative:. ./api/*.proto
233246
protoc -I ./ -I %corelib% --go-pbex_out=paths=source_relative:. ./api/*.proto
234247
protoc -I ./ -I %corelib% --go-cgrpc_out=paths=source_relative:. ./api/*.proto
235248
protoc -I ./ -I %corelib% --go-crpc_out=paths=source_relative:. ./api/*.proto
236249
protoc -I ./ -I %corelib% --go-web_out=paths=source_relative:. ./api/*.proto
237-
protoc -I ./ -I %corelib% --browser_out=paths=source_relative,gen_tob=true:. ./api/*.proto
238250
protoc -I ./ -I %corelib% --markdown_out=paths=source_relative:. ./api/*.proto
251+
protoc -I ./ -I %corelib% --browser_out=paths=source_relative:. ./api/*.proto
239252
go mod tidy
240253
goto :end
241254

0 commit comments

Comments
 (0)