|
1 | | -@echo off |
2 | | -setlocal |
3 | | -setlocal enabledelayedexpansion |
4 | | - |
5 | | -for /f "delims=" %%i in ('git rev-parse --show-toplevel') do set repoRoot=%%i |
6 | | -cd /d "%repoRoot%" |
7 | | - |
8 | | -set "PROTOC=%repoRoot%\third_party\_submodules\protobuf\cmake\build\protoc.exe" |
9 | | -set "PROTOBUF_PROTO=%repoRoot%\third_party\_submodules\protobuf\src" |
10 | | -set "TABLEAU_PROTO=%repoRoot%\third_party\_submodules\tableau\proto" |
11 | | -set "ROOTDIR=%repoRoot%\test\cpp-tableau-loader" |
12 | | -set "PLGUIN_DIR=%repoRoot%\cmd\protoc-gen-cpp-tableau-loader" |
13 | | -set "PROTOCONF_IN=%repoRoot%\test\proto" |
14 | | -set "PROTOCONF_OUT=%ROOTDIR%\src\protoconf" |
15 | | - |
16 | | -REM remove old generated files |
17 | | -rmdir /s /q "%PROTOCONF_OUT%" 2>nul |
18 | | -mkdir "%PROTOCONF_OUT%" |
19 | | - |
20 | | -REM build protoc plugin of loader |
21 | | -pushd "%PLGUIN_DIR%" |
22 | | -go build |
23 | | -popd |
24 | | - |
25 | | -set "PATH=%PATH%;%PLGUIN_DIR%" |
26 | | - |
27 | | -set protoFiles= |
28 | | -pushd "%PROTOCONF_IN%" |
29 | | -for /R %%f in (*.proto) do ( |
30 | | - set protoFiles=!protoFiles! "%%f" |
31 | | -) |
32 | | -popd |
33 | | -"%PROTOC%" ^ |
34 | | ---cpp-tableau-loader_out="%PROTOCONF_OUT%" ^ |
35 | | ---cpp-tableau-loader_opt=paths=source_relative,shards=2 ^ |
36 | | ---cpp_out="%PROTOCONF_OUT%" ^ |
37 | | ---proto_path="%PROTOBUF_PROTO%" ^ |
38 | | ---proto_path="%TABLEAU_PROTO%" ^ |
39 | | ---proto_path="%PROTOCONF_IN%" ^ |
40 | | -!protoFiles! |
41 | | - |
42 | | -set "TABLEAU_IN=%TABLEAU_PROTO%\tableau\protobuf" |
43 | | -set "TABLEAU_OUT=%ROOTDIR%\src" |
44 | | -REM remove old generated files |
45 | | -if exist "%TABLEAU_OUT%\tableau" rmdir /s /q "%TABLEAU_OUT%\tableau" |
46 | | -mkdir "%TABLEAU_OUT%\tableau" |
47 | | - |
48 | | -"%PROTOC%" ^ |
49 | | ---cpp_out="%TABLEAU_OUT%" ^ |
50 | | ---proto_path="%PROTOBUF_PROTO%" ^ |
51 | | ---proto_path="%TABLEAU_PROTO%" ^ |
52 | | -"%TABLEAU_IN%\tableau.proto" "%TABLEAU_IN%\wellknown.proto" |
53 | | - |
54 | | -endlocal |
55 | | -endlocal |
| 1 | +@echo off |
| 2 | +setlocal |
| 3 | +setlocal enabledelayedexpansion |
| 4 | + |
| 5 | +for /f "delims=" %%i in ('git rev-parse --show-toplevel') do set repoRoot=%%i |
| 6 | +cd /d "%repoRoot%" |
| 7 | +go mod tidy |
| 8 | + |
| 9 | +set "PROTOC=%repoRoot%\third_party\_submodules\protobuf\cmake\build\protoc.exe" |
| 10 | +set "PROTOBUF_PROTO=%repoRoot%\third_party\_submodules\protobuf\src" |
| 11 | +set "TABLEAU_GOPATH=github.com/tableauio/tableau" |
| 12 | +for /f "delims=" %%G in ('go env GOPATH') do set "GOPATH=%%G" |
| 13 | +for /f "tokens=2" %%V in ('findstr /c:"%TABLEAU_GOPATH%" go.mod') do set "VERSION=%%V" |
| 14 | +set "TABLEAU_PROTO=%GOPATH%\pkg\mod\%TABLEAU_GOPATH%@%VERSION%\proto" |
| 15 | +set "ROOTDIR=%repoRoot%\test\cpp-tableau-loader" |
| 16 | +set "PLGUIN_DIR=%repoRoot%\cmd\protoc-gen-cpp-tableau-loader" |
| 17 | +set "PROTOCONF_IN=%repoRoot%\test\proto" |
| 18 | +set "PROTOCONF_OUT=%ROOTDIR%\src\protoconf" |
| 19 | + |
| 20 | +REM remove old generated files |
| 21 | +rmdir /s /q "%PROTOCONF_OUT%" 2>nul |
| 22 | +mkdir "%PROTOCONF_OUT%" |
| 23 | + |
| 24 | +REM build protoc plugin of loader |
| 25 | +pushd "%PLGUIN_DIR%" |
| 26 | +go build |
| 27 | +popd |
| 28 | + |
| 29 | +set "PATH=%PATH%;%PLGUIN_DIR%" |
| 30 | + |
| 31 | +set protoFiles= |
| 32 | +pushd "%PROTOCONF_IN%" |
| 33 | +for /R %%f in (*.proto) do ( |
| 34 | + set protoFiles=!protoFiles! "%%f" |
| 35 | +) |
| 36 | +popd |
| 37 | +"%PROTOC%" ^ |
| 38 | +--cpp-tableau-loader_out="%PROTOCONF_OUT%" ^ |
| 39 | +--cpp-tableau-loader_opt=paths=source_relative,shards=2 ^ |
| 40 | +--cpp_out="%PROTOCONF_OUT%" ^ |
| 41 | +--proto_path="%PROTOBUF_PROTO%" ^ |
| 42 | +--proto_path="%TABLEAU_PROTO%" ^ |
| 43 | +--proto_path="%PROTOCONF_IN%" ^ |
| 44 | +!protoFiles! |
| 45 | + |
| 46 | +set "TABLEAU_IN=%TABLEAU_PROTO%\tableau\protobuf" |
| 47 | +set "TABLEAU_OUT=%ROOTDIR%\src" |
| 48 | +REM remove old generated files |
| 49 | +if exist "%TABLEAU_OUT%\tableau" rmdir /s /q "%TABLEAU_OUT%\tableau" |
| 50 | +mkdir "%TABLEAU_OUT%\tableau" |
| 51 | + |
| 52 | +"%PROTOC%" ^ |
| 53 | +--cpp_out="%TABLEAU_OUT%" ^ |
| 54 | +--proto_path="%PROTOBUF_PROTO%" ^ |
| 55 | +--proto_path="%TABLEAU_PROTO%" ^ |
| 56 | +"%TABLEAU_IN%\tableau.proto" "%TABLEAU_IN%\wellknown.proto" |
| 57 | + |
| 58 | +endlocal |
| 59 | +endlocal |
0 commit comments