|
115 | 115 | echo "option unsupport"
|
116 | 116 | help`
|
117 | 117 | const txtbat = `@echo off
|
118 |
| -chcp 65001 |
119 | 118 | REM Warning!!!!!!!!!!!This file is readonly!Don't modify this file!
|
120 | 119 |
|
121 | 120 | cd %~dp0
|
@@ -224,18 +223,32 @@ goto :help
|
224 | 223 | del >nul 2>nul .\api\*.md
|
225 | 224 | del >nul 2>nul .\api\*.ts
|
226 | 225 | go mod tidy
|
227 |
| - for /f "delims=" %%i in ('go list -m -f {{"\"{{.Dir}}\""}} github.com/chenjie199234/Corelib') do ( set "corelib=%%i" ) |
228 | 226 | 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 |
229 | 235 | cd %corelib%
|
| 236 | + chcp %current_chcp% |
| 237 | + echo install codegen and protoc plugins in %corelib% |
230 | 238 | go install ./...
|
231 | 239 | 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% |
232 | 245 | protoc -I ./ -I %corelib% --go_out=paths=source_relative:. ./api/*.proto
|
233 | 246 | protoc -I ./ -I %corelib% --go-pbex_out=paths=source_relative:. ./api/*.proto
|
234 | 247 | protoc -I ./ -I %corelib% --go-cgrpc_out=paths=source_relative:. ./api/*.proto
|
235 | 248 | protoc -I ./ -I %corelib% --go-crpc_out=paths=source_relative:. ./api/*.proto
|
236 | 249 | 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 |
238 | 250 | protoc -I ./ -I %corelib% --markdown_out=paths=source_relative:. ./api/*.proto
|
| 251 | + protoc -I ./ -I %corelib% --browser_out=paths=source_relative:. ./api/*.proto |
239 | 252 | go mod tidy
|
240 | 253 | goto :end
|
241 | 254 |
|
|
0 commit comments