From a5e03887f79a3651f34d48e17a738d45aafd5456 Mon Sep 17 00:00:00 2001 From: Kybxd <627940450@qq.com> Date: Tue, 24 Mar 2026 20:03:06 +0800 Subject: [PATCH 1/4] feat: support protobuf editions chore: Update tableau submodule to fe374083 build: Update Go version to 1.24.x across CI/workflows feat: Add CMake install step for protobuf-config.cmake refactor: Replace string reference with std::string construction chore: Update protoc path to use .build directory chore: Upgrade Protoc and simplify CI workflows ci: Optimize CI protobuf setup and caching feat: Add custom Protobuf log handler when ABSL is absent refactor: Switch to version-based Protobuf log handler guards --- .github/workflows/release-cpp.yml | 2 +- .github/workflows/release-csharp.yml | 2 +- .github/workflows/release-go.yml | 2 +- .github/workflows/testing-cpp.yml | 18 +++++++++++--- .github/workflows/testing-csharp.yml | 8 +++---- .github/workflows/testing-go.yml | 10 ++++---- cmd/protoc-gen-cpp-tableau-loader/main.go | 5 +++- cmd/protoc-gen-csharp-tableau-loader/main.go | 5 +++- cmd/protoc-gen-go-tableau-loader/main.go | 5 +++- go.mod | 5 ++-- go.sum | 10 ++++---- init.bat | 24 +++++++++++++++---- init.sh | 24 +++++++++++++++---- internal/options/options.go | 2 +- test/cpp-tableau-loader/CMakeLists.txt | 6 ++--- test/cpp-tableau-loader/gen.bat | 4 ++-- test/cpp-tableau-loader/gen.sh | 2 +- .../src/protoconf/hero_conf.pc.cc | 2 +- .../src/protoconf/hero_conf.pc.h | 2 +- .../src/protoconf/hub.pc.cc | 2 +- .../cpp-tableau-loader/src/protoconf/hub.pc.h | 2 +- .../src/protoconf/hub_shard0.pc.cc | 2 +- .../src/protoconf/hub_shard1.pc.cc | 2 +- .../src/protoconf/index_conf.pc.cc | 2 +- .../src/protoconf/index_conf.pc.h | 2 +- .../src/protoconf/item_conf.pc.cc | 2 +- .../src/protoconf/item_conf.pc.h | 2 +- .../src/protoconf/load.pc.cc | 2 +- .../src/protoconf/load.pc.h | 2 +- .../src/protoconf/logger.pc.cc | 2 +- .../src/protoconf/logger.pc.h | 2 +- .../src/protoconf/patch_conf.pc.cc | 2 +- .../src/protoconf/patch_conf.pc.h | 2 +- .../src/protoconf/scheduler.pc.cc | 2 +- .../src/protoconf/scheduler.pc.h | 2 +- .../src/protoconf/test_conf.pc.cc | 2 +- .../src/protoconf/test_conf.pc.h | 2 +- .../src/protoconf/util.pc.cc | 2 +- .../src/protoconf/util.pc.h | 2 +- test/csharp-tableau-loader/Loader.csproj | 2 +- test/csharp-tableau-loader/gen.bat | 4 ++-- test/csharp-tableau-loader/gen.sh | 2 +- .../tableau/HeroConf.pc.cs | 2 +- test/csharp-tableau-loader/tableau/Hub.pc.cs | 2 +- .../tableau/IndexConf.pc.cs | 2 +- .../tableau/ItemConf.pc.cs | 2 +- test/csharp-tableau-loader/tableau/Load.pc.cs | 2 +- .../tableau/PatchConf.pc.cs | 2 +- .../tableau/TestConf.pc.cs | 2 +- test/csharp-tableau-loader/tableau/Util.pc.cs | 2 +- test/go-tableau-loader/gen.bat | 4 ++-- test/go-tableau-loader/gen.sh | 2 +- .../protoconf/loader/hero_conf.pc.go | 2 +- .../protoconf/loader/hub.pc.go | 2 +- .../protoconf/loader/index_conf.pc.go | 2 +- .../protoconf/loader/item_conf.pc.go | 2 +- .../protoconf/loader/messager.pc.go | 2 +- .../protoconf/loader/messager_container.pc.go | 2 +- .../protoconf/loader/patch_conf.pc.go | 2 +- .../protoconf/loader/test_conf.pc.go | 2 +- .../protoconf/loader/util.pc.go | 2 +- third_party/_submodules/protobuf | 2 +- third_party/_submodules/tableau | 2 +- 63 files changed, 138 insertions(+), 92 deletions(-) diff --git a/.github/workflows/release-cpp.yml b/.github/workflows/release-cpp.yml index 34792cca..801c9b9f 100644 --- a/.github/workflows/release-cpp.yml +++ b/.github/workflows/release-cpp.yml @@ -27,7 +27,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: "1.21.x" + go-version: "1.24.x" - name: Download dependencies run: | diff --git a/.github/workflows/release-csharp.yml b/.github/workflows/release-csharp.yml index aa718903..36bd54f7 100644 --- a/.github/workflows/release-csharp.yml +++ b/.github/workflows/release-csharp.yml @@ -27,7 +27,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: "1.21.x" + go-version: "1.24.x" - name: Download dependencies run: | diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 68da1559..988109c1 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -26,7 +26,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: "1.21.x" + go-version: "1.24.x" - name: Download dependencies run: | diff --git a/.github/workflows/testing-cpp.yml b/.github/workflows/testing-cpp.yml index 3e88a540..e30cee18 100644 --- a/.github/workflows/testing-cpp.yml +++ b/.github/workflows/testing-cpp.yml @@ -18,19 +18,19 @@ jobs: matrix: include: - os: ubuntu-latest - go-version: 1.21.x + go-version: 1.24.x init_script: bash init.sh gen_script: bash gen.sh run_loader: ./bin/loader - os: windows-latest - go-version: 1.21.x + go-version: 1.24.x init_script: cmd /c init.bat gen_script: cmd /c gen.bat run_loader: .\bin\loader.exe name: test (${{ matrix.os }}) runs-on: ${{ matrix.os }} - timeout-minutes: 10 + timeout-minutes: 20 steps: - name: Checkout Code @@ -56,6 +56,18 @@ jobs: if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 + - name: Get protobuf submodule hash + id: protobuf-hash + shell: bash + run: echo "hash=$(git ls-tree HEAD third_party/_submodules/protobuf | awk '{print $3}')" >> $GITHUB_OUTPUT + + - name: Cache protobuf install + id: cache-protobuf + uses: actions/cache@v4 + with: + path: third_party/_submodules/protobuf/.build/_install + key: protobuf-${{ runner.os }}-${{ steps.protobuf-hash.outputs.hash }}-${{ hashFiles('init.sh', 'init.bat') }} + - name: Init submodules and build protobuf run: ${{ matrix.init_script }} diff --git a/.github/workflows/testing-csharp.yml b/.github/workflows/testing-csharp.yml index b631f4c8..db03d70c 100644 --- a/.github/workflows/testing-csharp.yml +++ b/.github/workflows/testing-csharp.yml @@ -18,10 +18,10 @@ jobs: matrix: include: - os: ubuntu-latest - go-version: 1.21.x + go-version: 1.24.x gen_script: bash gen.sh - os: windows-latest - go-version: 1.21.x + go-version: 1.24.x gen_script: cmd /c gen.bat name: test (${{ matrix.os }}) @@ -46,9 +46,9 @@ jobs: dotnet-version: "8.0.x" - name: Install Protoc - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@v3 with: - version: "3.19.3" + version: "32.x" repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Generate protoconf diff --git a/.github/workflows/testing-go.yml b/.github/workflows/testing-go.yml index 8128c057..6e6aba39 100644 --- a/.github/workflows/testing-go.yml +++ b/.github/workflows/testing-go.yml @@ -18,10 +18,10 @@ jobs: matrix: include: - os: ubuntu-latest - go-version: 1.21.x + go-version: 1.24.x gen_script: bash gen.sh - os: windows-latest - go-version: 1.21.x + go-version: 1.24.x gen_script: cmd /c gen.bat name: test (${{ matrix.os }}) @@ -41,13 +41,13 @@ jobs: cache: true - name: Install Protoc - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@v3 with: - version: "3.19.3" + version: "32.x" repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install protoc-gen-go - run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2 + run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.9 - name: Generate protoconf working-directory: test/go-tableau-loader diff --git a/cmd/protoc-gen-cpp-tableau-loader/main.go b/cmd/protoc-gen-cpp-tableau-loader/main.go index bf90b56f..3b99f4e6 100644 --- a/cmd/protoc-gen-cpp-tableau-loader/main.go +++ b/cmd/protoc-gen-cpp-tableau-loader/main.go @@ -6,6 +6,7 @@ import ( "github.com/tableauio/loader/internal/options" "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" ) @@ -50,7 +51,9 @@ func main() { protogen.Options{ ParamFunc: flags.Set, }.Run(func(gen *protogen.Plugin) error { - gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL | pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO3 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 for _, f := range gen.Files { if !options.NeedGenFile(f) { continue diff --git a/cmd/protoc-gen-csharp-tableau-loader/main.go b/cmd/protoc-gen-csharp-tableau-loader/main.go index bad35e59..035d8d39 100644 --- a/cmd/protoc-gen-csharp-tableau-loader/main.go +++ b/cmd/protoc-gen-csharp-tableau-loader/main.go @@ -6,6 +6,7 @@ import ( "github.com/tableauio/loader/internal/options" "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" ) @@ -24,7 +25,9 @@ func main() { protogen.Options{ ParamFunc: flags.Set, }.Run(func(gen *protogen.Plugin) error { - gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL | pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO3 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 for _, f := range gen.Files { if !options.NeedGenFile(f) { continue diff --git a/cmd/protoc-gen-go-tableau-loader/main.go b/cmd/protoc-gen-go-tableau-loader/main.go index 8ae2859e..3b6a3de2 100644 --- a/cmd/protoc-gen-go-tableau-loader/main.go +++ b/cmd/protoc-gen-go-tableau-loader/main.go @@ -6,6 +6,7 @@ import ( "github.com/tableauio/loader/internal/options" "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" ) @@ -27,7 +28,9 @@ func main() { protogen.Options{ ParamFunc: flags.Set, }.Run(func(gen *protogen.Plugin) error { - gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL | pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO3 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 for _, f := range gen.Files { if !options.NeedGenFile(f) { continue diff --git a/go.mod b/go.mod index 85fa6d7f..056769f5 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,13 @@ module github.com/tableauio/loader -go 1.21 +go 1.23 require ( github.com/iancoleman/strcase v0.3.0 github.com/pmezard/go-difflib v1.0.0 github.com/stretchr/testify v1.10.0 github.com/tableauio/tableau v0.15.1 - golang.org/x/exp v0.0.0-20230418202329-0354be287a23 - google.golang.org/protobuf v1.34.2 + google.golang.org/protobuf v1.36.11 ) require ( diff --git a/go.sum b/go.sum index 973838c6..964d3598 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -56,8 +56,6 @@ go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= -golang.org/x/exp v0.0.0-20230418202329-0354be287a23 h1:4NKENAGIctmZYLK9W+X1kDK8ObBFqOSCJM6WE7CvkJY= -golang.org/x/exp v0.0.0-20230418202329-0354be287a23/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= @@ -66,8 +64,8 @@ golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= diff --git a/init.bat b/init.bat index a83d505c..5c5e8023 100644 --- a/init.bat +++ b/init.bat @@ -14,23 +14,37 @@ cd /d "%repoRoot%" git submodule update --init --recursive REM Build and install the C++ Protocol Buffer runtime and the Protocol Buffer compiler (protoc) -REM Refer: https://github.com/protocolbuffers/protobuf/blob/3.19.x/cmake/README.md#cmake-configuration -cd third_party\_submodules\protobuf\cmake +REM Refer: https://github.com/protocolbuffers/protobuf/blob/v32.0/cmake/README.md#cmake-configuration +cd third_party\_submodules\protobuf + +REM Skip build if already installed (e.g. restored from CI cache) +if exist ".build\_install" ( + echo Protobuf already installed at .build\_install, skipping build. + exit /b 0 +) + REM use Debug version REM - protobuf_MSVC_STATIC_RUNTIME defaults to ON, which uses static CRT (/MTd for Debug). REM Our project's CMakeLists.txt also sets static CRT to match. REM - protobuf_WITH_ZLIB=OFF: disable ZLIB dependency to avoid ZLIB::ZLIB link requirement REM in protobuf's exported CMake targets, which simplifies cross-platform builds. REM - protobuf_BUILD_SHARED_LIBS=OFF: build static libraries explicitly. -cmake -S . -B build -G Ninja ^ +cmake -S . -B .build -G Ninja ^ -DCMAKE_BUILD_TYPE=Debug ^ -DCMAKE_CXX_STANDARD=17 ^ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ^ -Dprotobuf_BUILD_TESTS=OFF ^ -Dprotobuf_WITH_ZLIB=OFF ^ - -Dprotobuf_BUILD_SHARED_LIBS=OFF + -Dprotobuf_BUILD_SHARED_LIBS=OFF ^ + -Dutf8_range_ENABLE_INSTALL=ON REM Compile the code -cmake --build build --parallel +cmake --build .build --parallel + +REM Install into .build/_install so that protobuf-config.cmake (along with +REM absl and utf8_range configs) is generated for find_package(Protobuf CONFIG) +REM used by downstream CMakeLists.txt. +REM NOTE: .build/ is already in protobuf's .gitignore, so _install stays clean. +cmake --install .build --prefix .build\_install endlocal diff --git a/init.sh b/init.sh index 84b7a1f9..676e8f77 100755 --- a/init.sh +++ b/init.sh @@ -12,20 +12,34 @@ git submodule update --init --recursive # sudo apt-get install autoconf automake libtool curl make g++ unzip # Build and install the C++ Protocol Buffer runtime and the Protocol Buffer compiler (protoc) -# Refer: https://github.com/protocolbuffers/protobuf/blob/3.19.x/cmake/README.md#cmake-configuration -cd third_party/_submodules/protobuf/cmake +# Refer: https://github.com/protocolbuffers/protobuf/blob/v32.0/cmake/README.md#cmake-configuration +cd third_party/_submodules/protobuf + +# Skip build if already installed (e.g. restored from CI cache) +if [ -d ".build/_install" ]; then + echo "Protobuf already installed at .build/_install, skipping build." + exit 0 +fi + # use Debug version # - protobuf_MSVC_STATIC_RUNTIME defaults to ON, which uses static CRT (/MTd for Debug). # Our project's CMakeLists.txt also sets static CRT to match. # - protobuf_WITH_ZLIB=OFF: disable ZLIB dependency to avoid ZLIB::ZLIB link requirement # in protobuf's exported CMake targets, which simplifies cross-platform builds. # - protobuf_BUILD_SHARED_LIBS=OFF: build static libraries explicitly. -cmake -S . -B build -G Ninja \ +cmake -S . -B .build -G Ninja \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_STANDARD=17 \ -Dprotobuf_BUILD_TESTS=OFF \ -Dprotobuf_WITH_ZLIB=OFF \ - -Dprotobuf_BUILD_SHARED_LIBS=OFF + -Dprotobuf_BUILD_SHARED_LIBS=OFF \ + -Dutf8_range_ENABLE_INSTALL=ON # Compile the code -cmake --build build --parallel +cmake --build .build --parallel + +# Install into .build/_install so that protobuf-config.cmake (along with +# absl and utf8_range configs) is generated for find_package(Protobuf CONFIG) +# used by downstream CMakeLists.txt. +# NOTE: .build/ is already in protobuf's .gitignore, so _install stays clean. +cmake --install .build --prefix .build/_install diff --git a/internal/options/options.go b/internal/options/options.go index df5f801a..b9046b22 100644 --- a/internal/options/options.go +++ b/internal/options/options.go @@ -1,10 +1,10 @@ package options import ( + "slices" "strings" "github.com/tableauio/tableau/proto/tableaupb" - "golang.org/x/exp/slices" "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" diff --git a/test/cpp-tableau-loader/CMakeLists.txt b/test/cpp-tableau-loader/CMakeLists.txt index 11a28231..00bd3a3d 100644 --- a/test/cpp-tableau-loader/CMakeLists.txt +++ b/test/cpp-tableau-loader/CMakeLists.txt @@ -31,11 +31,11 @@ endif() # - Linux: build/lib64/cmake/protobuf/ (via CMAKE_INSTALL_LIBDIR) # - Windows: build/cmake/ (MSVC uses "cmake" directly) # Setting CMAKE_PREFIX_PATH to the build dir allows CMake to search both layouts. -set(LOCAL_PROTOBUF_BUILD_DIR "${PROJECT_SOURCE_DIR}/../../third_party/_submodules/protobuf/cmake/build") +set(LOCAL_PROTOBUF_INSTALL_DIR "${PROJECT_SOURCE_DIR}/../../third_party/_submodules/protobuf/.build/_install") set(LOCAL_PROTOBUF_SRC_DIR "${PROJECT_SOURCE_DIR}/../../third_party/_submodules/protobuf/src") -if(EXISTS "${LOCAL_PROTOBUF_BUILD_DIR}" AND EXISTS "${LOCAL_PROTOBUF_SRC_DIR}") +if(EXISTS "${LOCAL_PROTOBUF_INSTALL_DIR}" AND EXISTS "${LOCAL_PROTOBUF_SRC_DIR}") message(STATUS "Found local protobuf submodule, using it preferentially.") - list(PREPEND CMAKE_PREFIX_PATH "${LOCAL_PROTOBUF_BUILD_DIR}") + list(PREPEND CMAKE_PREFIX_PATH "${LOCAL_PROTOBUF_INSTALL_DIR}") endif() # Use CONFIG mode explicitly to pick up protobuf's own protobuf-config.cmake diff --git a/test/cpp-tableau-loader/gen.bat b/test/cpp-tableau-loader/gen.bat index 1751c14c..59519cfb 100644 --- a/test/cpp-tableau-loader/gen.bat +++ b/test/cpp-tableau-loader/gen.bat @@ -8,8 +8,8 @@ cd /d "%repoRoot%" REM Allow overriding protoc via environment variable. REM Default to locally compiled protoc for local development; fallback to system protoc. if not defined PROTOC ( - if exist "%repoRoot%\third_party\_submodules\protobuf\cmake\build\protoc.exe" ( - set "PROTOC=%repoRoot%\third_party\_submodules\protobuf\cmake\build\protoc.exe" + if exist "%repoRoot%\third_party\_submodules\protobuf\.build\protoc.exe" ( + set "PROTOC=%repoRoot%\third_party\_submodules\protobuf\.build\protoc.exe" ) else ( where protoc >nul 2>nul if !errorlevel! equ 0 ( diff --git a/test/cpp-tableau-loader/gen.sh b/test/cpp-tableau-loader/gen.sh index 017757e3..350354e0 100755 --- a/test/cpp-tableau-loader/gen.sh +++ b/test/cpp-tableau-loader/gen.sh @@ -10,7 +10,7 @@ cd "$(git rev-parse --show-toplevel)" # Allow overriding protoc via environment variable. # Default to locally compiled protoc for local development; fallback to system protoc. -LOCAL_PROTOC="./third_party/_submodules/protobuf/cmake/build/protoc" +LOCAL_PROTOC="./third_party/_submodules/protobuf/.build/protoc" if [ -z "$PROTOC" ]; then if [ -x "$LOCAL_PROTOC" ]; then PROTOC="$LOCAL_PROTOC" diff --git a/test/cpp-tableau-loader/src/protoconf/hero_conf.pc.cc b/test/cpp-tableau-loader/src/protoconf/hero_conf.pc.cc index 3d5235a6..6813f67e 100644 --- a/test/cpp-tableau-loader/src/protoconf/hero_conf.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/hero_conf.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off // source: hero_conf.proto diff --git a/test/cpp-tableau-loader/src/protoconf/hero_conf.pc.h b/test/cpp-tableau-loader/src/protoconf/hero_conf.pc.h index 0092db80..b7a992ba 100644 --- a/test/cpp-tableau-loader/src/protoconf/hero_conf.pc.h +++ b/test/cpp-tableau-loader/src/protoconf/hero_conf.pc.h @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off // source: hero_conf.proto diff --git a/test/cpp-tableau-loader/src/protoconf/hub.pc.cc b/test/cpp-tableau-loader/src/protoconf/hub.pc.cc index 8cd60ff5..d188da73 100644 --- a/test/cpp-tableau-loader/src/protoconf/hub.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/hub.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #include "hub.pc.h" diff --git a/test/cpp-tableau-loader/src/protoconf/hub.pc.h b/test/cpp-tableau-loader/src/protoconf/hub.pc.h index 3dec0210..dfcbd7f5 100644 --- a/test/cpp-tableau-loader/src/protoconf/hub.pc.h +++ b/test/cpp-tableau-loader/src/protoconf/hub.pc.h @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #pragma once diff --git a/test/cpp-tableau-loader/src/protoconf/hub_shard0.pc.cc b/test/cpp-tableau-loader/src/protoconf/hub_shard0.pc.cc index a774e1c2..e4ca4f7f 100644 --- a/test/cpp-tableau-loader/src/protoconf/hub_shard0.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/hub_shard0.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #include "hub.pc.h" diff --git a/test/cpp-tableau-loader/src/protoconf/hub_shard1.pc.cc b/test/cpp-tableau-loader/src/protoconf/hub_shard1.pc.cc index aada2017..3f29a2d7 100644 --- a/test/cpp-tableau-loader/src/protoconf/hub_shard1.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/hub_shard1.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #include "hub.pc.h" diff --git a/test/cpp-tableau-loader/src/protoconf/index_conf.pc.cc b/test/cpp-tableau-loader/src/protoconf/index_conf.pc.cc index ef84941d..1f800df9 100644 --- a/test/cpp-tableau-loader/src/protoconf/index_conf.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/index_conf.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off // source: index_conf.proto diff --git a/test/cpp-tableau-loader/src/protoconf/index_conf.pc.h b/test/cpp-tableau-loader/src/protoconf/index_conf.pc.h index a9fa3e6c..f5f27050 100644 --- a/test/cpp-tableau-loader/src/protoconf/index_conf.pc.h +++ b/test/cpp-tableau-loader/src/protoconf/index_conf.pc.h @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off // source: index_conf.proto diff --git a/test/cpp-tableau-loader/src/protoconf/item_conf.pc.cc b/test/cpp-tableau-loader/src/protoconf/item_conf.pc.cc index 722a75e0..07323000 100644 --- a/test/cpp-tableau-loader/src/protoconf/item_conf.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/item_conf.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off // source: item_conf.proto diff --git a/test/cpp-tableau-loader/src/protoconf/item_conf.pc.h b/test/cpp-tableau-loader/src/protoconf/item_conf.pc.h index fd757f5a..45c810ac 100644 --- a/test/cpp-tableau-loader/src/protoconf/item_conf.pc.h +++ b/test/cpp-tableau-loader/src/protoconf/item_conf.pc.h @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off // source: item_conf.proto diff --git a/test/cpp-tableau-loader/src/protoconf/load.pc.cc b/test/cpp-tableau-loader/src/protoconf/load.pc.cc index ef258491..1ea2c273 100644 --- a/test/cpp-tableau-loader/src/protoconf/load.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/load.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #include "load.pc.h" diff --git a/test/cpp-tableau-loader/src/protoconf/load.pc.h b/test/cpp-tableau-loader/src/protoconf/load.pc.h index a8cbef6f..fdaf5e01 100644 --- a/test/cpp-tableau-loader/src/protoconf/load.pc.h +++ b/test/cpp-tableau-loader/src/protoconf/load.pc.h @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #pragma once diff --git a/test/cpp-tableau-loader/src/protoconf/logger.pc.cc b/test/cpp-tableau-loader/src/protoconf/logger.pc.cc index ca604ac9..11366f22 100644 --- a/test/cpp-tableau-loader/src/protoconf/logger.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/logger.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #include "logger.pc.h" diff --git a/test/cpp-tableau-loader/src/protoconf/logger.pc.h b/test/cpp-tableau-loader/src/protoconf/logger.pc.h index 2925cf94..703a64d1 100644 --- a/test/cpp-tableau-loader/src/protoconf/logger.pc.h +++ b/test/cpp-tableau-loader/src/protoconf/logger.pc.h @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #pragma once diff --git a/test/cpp-tableau-loader/src/protoconf/patch_conf.pc.cc b/test/cpp-tableau-loader/src/protoconf/patch_conf.pc.cc index e943a3d2..4c1545f3 100644 --- a/test/cpp-tableau-loader/src/protoconf/patch_conf.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/patch_conf.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off // source: patch_conf.proto diff --git a/test/cpp-tableau-loader/src/protoconf/patch_conf.pc.h b/test/cpp-tableau-loader/src/protoconf/patch_conf.pc.h index c761d655..b66f0cb5 100644 --- a/test/cpp-tableau-loader/src/protoconf/patch_conf.pc.h +++ b/test/cpp-tableau-loader/src/protoconf/patch_conf.pc.h @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off // source: patch_conf.proto diff --git a/test/cpp-tableau-loader/src/protoconf/scheduler.pc.cc b/test/cpp-tableau-loader/src/protoconf/scheduler.pc.cc index a102e525..63b7442e 100644 --- a/test/cpp-tableau-loader/src/protoconf/scheduler.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/scheduler.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #include "scheduler.pc.h" diff --git a/test/cpp-tableau-loader/src/protoconf/scheduler.pc.h b/test/cpp-tableau-loader/src/protoconf/scheduler.pc.h index 7b34521e..8bb16ed8 100644 --- a/test/cpp-tableau-loader/src/protoconf/scheduler.pc.h +++ b/test/cpp-tableau-loader/src/protoconf/scheduler.pc.h @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #pragma once diff --git a/test/cpp-tableau-loader/src/protoconf/test_conf.pc.cc b/test/cpp-tableau-loader/src/protoconf/test_conf.pc.cc index 4422fcdd..d1eb45f0 100644 --- a/test/cpp-tableau-loader/src/protoconf/test_conf.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/test_conf.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off // source: test_conf.proto diff --git a/test/cpp-tableau-loader/src/protoconf/test_conf.pc.h b/test/cpp-tableau-loader/src/protoconf/test_conf.pc.h index ecf62d94..aacf79bd 100644 --- a/test/cpp-tableau-loader/src/protoconf/test_conf.pc.h +++ b/test/cpp-tableau-loader/src/protoconf/test_conf.pc.h @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off // source: test_conf.proto diff --git a/test/cpp-tableau-loader/src/protoconf/util.pc.cc b/test/cpp-tableau-loader/src/protoconf/util.pc.cc index 61e04959..6e353458 100644 --- a/test/cpp-tableau-loader/src/protoconf/util.pc.cc +++ b/test/cpp-tableau-loader/src/protoconf/util.pc.cc @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #include "util.pc.h" diff --git a/test/cpp-tableau-loader/src/protoconf/util.pc.h b/test/cpp-tableau-loader/src/protoconf/util.pc.h index 92161188..d3a23a64 100644 --- a/test/cpp-tableau-loader/src/protoconf/util.pc.h +++ b/test/cpp-tableau-loader/src/protoconf/util.pc.h @@ -1,7 +1,7 @@ // Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-cpp-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // clang-format off #pragma once diff --git a/test/csharp-tableau-loader/Loader.csproj b/test/csharp-tableau-loader/Loader.csproj index 68dbf5e1..fc0c2e28 100644 --- a/test/csharp-tableau-loader/Loader.csproj +++ b/test/csharp-tableau-loader/Loader.csproj @@ -11,7 +11,7 @@ - + diff --git a/test/csharp-tableau-loader/gen.bat b/test/csharp-tableau-loader/gen.bat index 3a3d50f7..fc841422 100644 --- a/test/csharp-tableau-loader/gen.bat +++ b/test/csharp-tableau-loader/gen.bat @@ -8,8 +8,8 @@ cd /d "%repoRoot%" REM Allow overriding protoc via environment variable. REM Default to locally compiled protoc for local development; fallback to system protoc. if not defined PROTOC ( - if exist "%repoRoot%\third_party\_submodules\protobuf\cmake\build\protoc.exe" ( - set "PROTOC=%repoRoot%\third_party\_submodules\protobuf\cmake\build\protoc.exe" + if exist "%repoRoot%\third_party\_submodules\protobuf\.build\protoc.exe" ( + set "PROTOC=%repoRoot%\third_party\_submodules\protobuf\.build\protoc.exe" ) else ( where protoc >nul 2>nul if !errorlevel! equ 0 ( diff --git a/test/csharp-tableau-loader/gen.sh b/test/csharp-tableau-loader/gen.sh index 7e3d06a9..1cfe6cae 100755 --- a/test/csharp-tableau-loader/gen.sh +++ b/test/csharp-tableau-loader/gen.sh @@ -8,7 +8,7 @@ cd "$(git rev-parse --show-toplevel)" # Allow overriding protoc via environment variable. # Default to locally compiled protoc for local development; fallback to system protoc. -LOCAL_PROTOC="./third_party/_submodules/protobuf/cmake/build/protoc" +LOCAL_PROTOC="./third_party/_submodules/protobuf/.build/protoc" if [ -z "$PROTOC" ]; then if [ -x "$LOCAL_PROTOC" ]; then PROTOC="$LOCAL_PROTOC" diff --git a/test/csharp-tableau-loader/tableau/HeroConf.pc.cs b/test/csharp-tableau-loader/tableau/HeroConf.pc.cs index 576ea607..89501570 100644 --- a/test/csharp-tableau-loader/tableau/HeroConf.pc.cs +++ b/test/csharp-tableau-loader/tableau/HeroConf.pc.cs @@ -2,7 +2,7 @@ // Code generated by protoc-gen-csharp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-csharp-tableau-loader v0.1.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // source: hero_conf.proto // #nullable enable diff --git a/test/csharp-tableau-loader/tableau/Hub.pc.cs b/test/csharp-tableau-loader/tableau/Hub.pc.cs index a076b694..3767dcb9 100644 --- a/test/csharp-tableau-loader/tableau/Hub.pc.cs +++ b/test/csharp-tableau-loader/tableau/Hub.pc.cs @@ -2,7 +2,7 @@ // Code generated by protoc-gen-csharp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-csharp-tableau-loader v0.1.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // #nullable enable using System; diff --git a/test/csharp-tableau-loader/tableau/IndexConf.pc.cs b/test/csharp-tableau-loader/tableau/IndexConf.pc.cs index fab40217..03d94046 100644 --- a/test/csharp-tableau-loader/tableau/IndexConf.pc.cs +++ b/test/csharp-tableau-loader/tableau/IndexConf.pc.cs @@ -2,7 +2,7 @@ // Code generated by protoc-gen-csharp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-csharp-tableau-loader v0.1.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // source: index_conf.proto // #nullable enable diff --git a/test/csharp-tableau-loader/tableau/ItemConf.pc.cs b/test/csharp-tableau-loader/tableau/ItemConf.pc.cs index 19f884ef..9fd2361d 100644 --- a/test/csharp-tableau-loader/tableau/ItemConf.pc.cs +++ b/test/csharp-tableau-loader/tableau/ItemConf.pc.cs @@ -2,7 +2,7 @@ // Code generated by protoc-gen-csharp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-csharp-tableau-loader v0.1.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // source: item_conf.proto // #nullable enable diff --git a/test/csharp-tableau-loader/tableau/Load.pc.cs b/test/csharp-tableau-loader/tableau/Load.pc.cs index 463f9aa8..88e1a128 100644 --- a/test/csharp-tableau-loader/tableau/Load.pc.cs +++ b/test/csharp-tableau-loader/tableau/Load.pc.cs @@ -2,7 +2,7 @@ // Code generated by protoc-gen-csharp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-csharp-tableau-loader v0.1.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // #nullable enable using System; diff --git a/test/csharp-tableau-loader/tableau/PatchConf.pc.cs b/test/csharp-tableau-loader/tableau/PatchConf.pc.cs index 6290448b..294e2c82 100644 --- a/test/csharp-tableau-loader/tableau/PatchConf.pc.cs +++ b/test/csharp-tableau-loader/tableau/PatchConf.pc.cs @@ -2,7 +2,7 @@ // Code generated by protoc-gen-csharp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-csharp-tableau-loader v0.1.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // source: patch_conf.proto // #nullable enable diff --git a/test/csharp-tableau-loader/tableau/TestConf.pc.cs b/test/csharp-tableau-loader/tableau/TestConf.pc.cs index 577bf334..d0310720 100644 --- a/test/csharp-tableau-loader/tableau/TestConf.pc.cs +++ b/test/csharp-tableau-loader/tableau/TestConf.pc.cs @@ -2,7 +2,7 @@ // Code generated by protoc-gen-csharp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-csharp-tableau-loader v0.1.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // source: test_conf.proto // #nullable enable diff --git a/test/csharp-tableau-loader/tableau/Util.pc.cs b/test/csharp-tableau-loader/tableau/Util.pc.cs index c907729d..7d4c48d9 100644 --- a/test/csharp-tableau-loader/tableau/Util.pc.cs +++ b/test/csharp-tableau-loader/tableau/Util.pc.cs @@ -2,7 +2,7 @@ // Code generated by protoc-gen-csharp-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-csharp-tableau-loader v0.1.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // #nullable enable using System; diff --git a/test/go-tableau-loader/gen.bat b/test/go-tableau-loader/gen.bat index 2520760e..89b54dca 100644 --- a/test/go-tableau-loader/gen.bat +++ b/test/go-tableau-loader/gen.bat @@ -8,8 +8,8 @@ cd /d "%repoRoot%" REM Allow overriding protoc via environment variable. REM Default to locally compiled protoc for local development; fallback to system protoc. if not defined PROTOC ( - if exist "%repoRoot%\third_party\_submodules\protobuf\cmake\build\protoc.exe" ( - set "PROTOC=%repoRoot%\third_party\_submodules\protobuf\cmake\build\protoc.exe" + if exist "%repoRoot%\third_party\_submodules\protobuf\.build\protoc.exe" ( + set "PROTOC=%repoRoot%\third_party\_submodules\protobuf\.build\protoc.exe" ) else ( where protoc >nul 2>nul if !errorlevel! equ 0 ( diff --git a/test/go-tableau-loader/gen.sh b/test/go-tableau-loader/gen.sh index 0c74e757..c74e52b9 100755 --- a/test/go-tableau-loader/gen.sh +++ b/test/go-tableau-loader/gen.sh @@ -8,7 +8,7 @@ cd "$(git rev-parse --show-toplevel)" # Allow overriding protoc via environment variable. # Default to locally compiled protoc for local development; fallback to system protoc. -LOCAL_PROTOC="./third_party/_submodules/protobuf/cmake/build/protoc" +LOCAL_PROTOC="./third_party/_submodules/protobuf/.build/protoc" if [ -z "$PROTOC" ]; then if [ -x "$LOCAL_PROTOC" ]; then PROTOC="$LOCAL_PROTOC" diff --git a/test/go-tableau-loader/protoconf/loader/hero_conf.pc.go b/test/go-tableau-loader/protoconf/loader/hero_conf.pc.go index a47a64cc..a35ce3cc 100644 --- a/test/go-tableau-loader/protoconf/loader/hero_conf.pc.go +++ b/test/go-tableau-loader/protoconf/loader/hero_conf.pc.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-go-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // source: hero_conf.proto package loader diff --git a/test/go-tableau-loader/protoconf/loader/hub.pc.go b/test/go-tableau-loader/protoconf/loader/hub.pc.go index a4e2e86c..bea1f5a1 100644 --- a/test/go-tableau-loader/protoconf/loader/hub.pc.go +++ b/test/go-tableau-loader/protoconf/loader/hub.pc.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-go-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 package loader diff --git a/test/go-tableau-loader/protoconf/loader/index_conf.pc.go b/test/go-tableau-loader/protoconf/loader/index_conf.pc.go index 6ec07e40..f06ff161 100644 --- a/test/go-tableau-loader/protoconf/loader/index_conf.pc.go +++ b/test/go-tableau-loader/protoconf/loader/index_conf.pc.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-go-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // source: index_conf.proto package loader diff --git a/test/go-tableau-loader/protoconf/loader/item_conf.pc.go b/test/go-tableau-loader/protoconf/loader/item_conf.pc.go index 86b117d5..cbe8c53f 100644 --- a/test/go-tableau-loader/protoconf/loader/item_conf.pc.go +++ b/test/go-tableau-loader/protoconf/loader/item_conf.pc.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-go-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // source: item_conf.proto package loader diff --git a/test/go-tableau-loader/protoconf/loader/messager.pc.go b/test/go-tableau-loader/protoconf/loader/messager.pc.go index 4675c1c1..b14e8526 100644 --- a/test/go-tableau-loader/protoconf/loader/messager.pc.go +++ b/test/go-tableau-loader/protoconf/loader/messager.pc.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-go-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 package loader diff --git a/test/go-tableau-loader/protoconf/loader/messager_container.pc.go b/test/go-tableau-loader/protoconf/loader/messager_container.pc.go index a6e08fbe..dd57d708 100644 --- a/test/go-tableau-loader/protoconf/loader/messager_container.pc.go +++ b/test/go-tableau-loader/protoconf/loader/messager_container.pc.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-go-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 package loader diff --git a/test/go-tableau-loader/protoconf/loader/patch_conf.pc.go b/test/go-tableau-loader/protoconf/loader/patch_conf.pc.go index e75f0106..3e37ffcf 100644 --- a/test/go-tableau-loader/protoconf/loader/patch_conf.pc.go +++ b/test/go-tableau-loader/protoconf/loader/patch_conf.pc.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-go-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // source: patch_conf.proto package loader diff --git a/test/go-tableau-loader/protoconf/loader/test_conf.pc.go b/test/go-tableau-loader/protoconf/loader/test_conf.pc.go index f6e78a8f..e36755fe 100644 --- a/test/go-tableau-loader/protoconf/loader/test_conf.pc.go +++ b/test/go-tableau-loader/protoconf/loader/test_conf.pc.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-go-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 // source: test_conf.proto package loader diff --git a/test/go-tableau-loader/protoconf/loader/util.pc.go b/test/go-tableau-loader/protoconf/loader/util.pc.go index 92e9029a..c5e6bea4 100644 --- a/test/go-tableau-loader/protoconf/loader/util.pc.go +++ b/test/go-tableau-loader/protoconf/loader/util.pc.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-tableau-loader. DO NOT EDIT. // versions: // - protoc-gen-go-tableau-loader v0.11.0 -// - protoc v3.19.3 +// - protoc v6.32.0 package loader diff --git a/third_party/_submodules/protobuf b/third_party/_submodules/protobuf index cc7b1b53..4fbd1111 160000 --- a/third_party/_submodules/protobuf +++ b/third_party/_submodules/protobuf @@ -1 +1 @@ -Subproject commit cc7b1b53234cd7a8f50d90ac3933b240dcf4cd97 +Subproject commit 4fbd1111a292d04746c732573025e3251de0bb9c diff --git a/third_party/_submodules/tableau b/third_party/_submodules/tableau index 0d308e52..fe374083 160000 --- a/third_party/_submodules/tableau +++ b/third_party/_submodules/tableau @@ -1 +1 @@ -Subproject commit 0d308e52f7ca68ae770d7da40598ef84c7136fb3 +Subproject commit fe374083bb58a917c1937f3d602585ad3787da4d From d1a1267468bf5fa7e33236779bab5677dab09cdc Mon Sep 17 00:00:00 2001 From: Kybxd <627940450@qq.com> Date: Wed, 1 Apr 2026 11:32:25 +0800 Subject: [PATCH 2/4] ci: Support legacy protoc versions in CI matrix --- .github/workflows/testing-cpp.yml | 50 ++++++++++++++++++++++++++-- .github/workflows/testing-csharp.yml | 18 ++++++++-- .github/workflows/testing-go.yml | 18 ++++++++-- 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing-cpp.yml b/.github/workflows/testing-cpp.yml index e30cee18..3f1eee4f 100644 --- a/.github/workflows/testing-cpp.yml +++ b/.github/workflows/testing-cpp.yml @@ -19,16 +19,24 @@ jobs: include: - os: ubuntu-latest go-version: 1.24.x + protobuf_ref: "" init_script: bash init.sh gen_script: bash gen.sh run_loader: ./bin/loader - os: windows-latest go-version: 1.24.x + protobuf_ref: "" init_script: cmd /c init.bat gen_script: cmd /c gen.bat run_loader: .\bin\loader.exe + - os: ubuntu-latest + go-version: 1.24.x + protobuf_ref: "v3.19.3" + init_script: "" + gen_script: bash gen.sh + run_loader: ./bin/loader - name: test (${{ matrix.os }}) + name: test (${{ matrix.os }}${{ matrix.protobuf_ref && format(', protobuf {0}', matrix.protobuf_ref) || '' }}) runs-on: ${{ matrix.os }} timeout-minutes: 20 @@ -56,21 +64,59 @@ jobs: if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 + # --- Default protobuf (from submodule) --- - name: Get protobuf submodule hash + if: matrix.protobuf_ref == '' id: protobuf-hash shell: bash run: echo "hash=$(git ls-tree HEAD third_party/_submodules/protobuf | awk '{print $3}')" >> $GITHUB_OUTPUT - name: Cache protobuf install + if: matrix.protobuf_ref == '' id: cache-protobuf uses: actions/cache@v4 with: - path: third_party/_submodules/protobuf/.build/_install + path: | + third_party/_submodules/protobuf/.build/_install + third_party/_submodules/protobuf/.build/protoc + third_party/_submodules/protobuf/.build/protoc.exe key: protobuf-${{ runner.os }}-${{ steps.protobuf-hash.outputs.hash }}-${{ hashFiles('init.sh', 'init.bat') }} - name: Init submodules and build protobuf + if: matrix.protobuf_ref == '' run: ${{ matrix.init_script }} + # --- Legacy protobuf (switch submodule to specified ref) --- + - name: Switch protobuf submodule to ${{ matrix.protobuf_ref }} + if: matrix.protobuf_ref != '' + working-directory: third_party/_submodules/protobuf + run: | + git fetch --tags + git checkout ${{ matrix.protobuf_ref }} + git submodule update --init --recursive + + - name: Cache legacy protobuf install + if: matrix.protobuf_ref != '' + id: cache-protobuf-legacy + uses: actions/cache@v4 + with: + path: | + third_party/_submodules/protobuf/.build/_install + third_party/_submodules/protobuf/.build/protoc + key: protobuf-${{ runner.os }}-${{ matrix.protobuf_ref }} + + - name: Build legacy protobuf + if: matrix.protobuf_ref != '' && steps.cache-protobuf-legacy.outputs.cache-hit != 'true' + working-directory: third_party/_submodules/protobuf + run: | + # protobuf <= v3.x uses cmake/ subdirectory for CMake builds + cmake -S cmake -B .build -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=17 \ + -Dprotobuf_BUILD_TESTS=OFF + cmake --build .build --parallel + cmake --install .build --prefix .build/_install + - name: Generate protoconf working-directory: test/cpp-tableau-loader run: ${{ matrix.gen_script }} diff --git a/.github/workflows/testing-csharp.yml b/.github/workflows/testing-csharp.yml index db03d70c..1f89b475 100644 --- a/.github/workflows/testing-csharp.yml +++ b/.github/workflows/testing-csharp.yml @@ -19,12 +19,18 @@ jobs: include: - os: ubuntu-latest go-version: 1.24.x + protoc-version: "32.x" gen_script: bash gen.sh - os: windows-latest go-version: 1.24.x + protoc-version: "32.x" gen_script: cmd /c gen.bat + - os: ubuntu-latest + go-version: 1.24.x + protoc-version: "3.19.3" + gen_script: bash gen.sh - name: test (${{ matrix.os }}) + name: test (${{ matrix.os }}, protoc ${{ matrix.protoc-version }}) runs-on: ${{ matrix.os }} timeout-minutes: 10 @@ -46,9 +52,17 @@ jobs: dotnet-version: "8.0.x" - name: Install Protoc + if: "!startsWith(matrix.protoc-version, '3.')" uses: arduino/setup-protoc@v3 with: - version: "32.x" + version: ${{ matrix.protoc-version }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install Protoc (legacy) + if: startsWith(matrix.protoc-version, '3.') + uses: arduino/setup-protoc@v1 + with: + version: ${{ matrix.protoc-version }} repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Generate protoconf diff --git a/.github/workflows/testing-go.yml b/.github/workflows/testing-go.yml index 6e6aba39..7074fd9f 100644 --- a/.github/workflows/testing-go.yml +++ b/.github/workflows/testing-go.yml @@ -19,12 +19,18 @@ jobs: include: - os: ubuntu-latest go-version: 1.24.x + protoc-version: "32.x" gen_script: bash gen.sh - os: windows-latest go-version: 1.24.x + protoc-version: "32.x" gen_script: cmd /c gen.bat + - os: ubuntu-latest + go-version: 1.24.x + protoc-version: "3.19.3" + gen_script: bash gen.sh - name: test (${{ matrix.os }}) + name: test (${{ matrix.os }}, protoc ${{ matrix.protoc-version }}) runs-on: ${{ matrix.os }} timeout-minutes: 10 @@ -41,9 +47,17 @@ jobs: cache: true - name: Install Protoc + if: "!startsWith(matrix.protoc-version, '3.')" uses: arduino/setup-protoc@v3 with: - version: "32.x" + version: ${{ matrix.protoc-version }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install Protoc (legacy) + if: startsWith(matrix.protoc-version, '3.') + uses: arduino/setup-protoc@v1 + with: + version: ${{ matrix.protoc-version }} repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install protoc-gen-go From 7c5477e64aba0fa76fe6af872bbb876381ca4274 Mon Sep 17 00:00:00 2001 From: Kybxd <627940450@qq.com> Date: Wed, 1 Apr 2026 11:43:50 +0800 Subject: [PATCH 3/4] chore: Remove protobuf skip-build checks across scripts --- .github/workflows/testing-cpp.yml | 29 +---------------------------- init.bat | 6 ------ init.sh | 6 ------ 3 files changed, 1 insertion(+), 40 deletions(-) diff --git a/.github/workflows/testing-cpp.yml b/.github/workflows/testing-cpp.yml index 3f1eee4f..6ff01b96 100644 --- a/.github/workflows/testing-cpp.yml +++ b/.github/workflows/testing-cpp.yml @@ -65,23 +65,6 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 # --- Default protobuf (from submodule) --- - - name: Get protobuf submodule hash - if: matrix.protobuf_ref == '' - id: protobuf-hash - shell: bash - run: echo "hash=$(git ls-tree HEAD third_party/_submodules/protobuf | awk '{print $3}')" >> $GITHUB_OUTPUT - - - name: Cache protobuf install - if: matrix.protobuf_ref == '' - id: cache-protobuf - uses: actions/cache@v4 - with: - path: | - third_party/_submodules/protobuf/.build/_install - third_party/_submodules/protobuf/.build/protoc - third_party/_submodules/protobuf/.build/protoc.exe - key: protobuf-${{ runner.os }}-${{ steps.protobuf-hash.outputs.hash }}-${{ hashFiles('init.sh', 'init.bat') }} - - name: Init submodules and build protobuf if: matrix.protobuf_ref == '' run: ${{ matrix.init_script }} @@ -95,18 +78,8 @@ jobs: git checkout ${{ matrix.protobuf_ref }} git submodule update --init --recursive - - name: Cache legacy protobuf install - if: matrix.protobuf_ref != '' - id: cache-protobuf-legacy - uses: actions/cache@v4 - with: - path: | - third_party/_submodules/protobuf/.build/_install - third_party/_submodules/protobuf/.build/protoc - key: protobuf-${{ runner.os }}-${{ matrix.protobuf_ref }} - - name: Build legacy protobuf - if: matrix.protobuf_ref != '' && steps.cache-protobuf-legacy.outputs.cache-hit != 'true' + if: matrix.protobuf_ref != '' working-directory: third_party/_submodules/protobuf run: | # protobuf <= v3.x uses cmake/ subdirectory for CMake builds diff --git a/init.bat b/init.bat index 5c5e8023..16afd897 100644 --- a/init.bat +++ b/init.bat @@ -17,12 +17,6 @@ REM Build and install the C++ Protocol Buffer runtime and the Protocol Buffer co REM Refer: https://github.com/protocolbuffers/protobuf/blob/v32.0/cmake/README.md#cmake-configuration cd third_party\_submodules\protobuf -REM Skip build if already installed (e.g. restored from CI cache) -if exist ".build\_install" ( - echo Protobuf already installed at .build\_install, skipping build. - exit /b 0 -) - REM use Debug version REM - protobuf_MSVC_STATIC_RUNTIME defaults to ON, which uses static CRT (/MTd for Debug). REM Our project's CMakeLists.txt also sets static CRT to match. diff --git a/init.sh b/init.sh index 676e8f77..6220f608 100755 --- a/init.sh +++ b/init.sh @@ -15,12 +15,6 @@ git submodule update --init --recursive # Refer: https://github.com/protocolbuffers/protobuf/blob/v32.0/cmake/README.md#cmake-configuration cd third_party/_submodules/protobuf -# Skip build if already installed (e.g. restored from CI cache) -if [ -d ".build/_install" ]; then - echo "Protobuf already installed at .build/_install, skipping build." - exit 0 -fi - # use Debug version # - protobuf_MSVC_STATIC_RUNTIME defaults to ON, which uses static CRT (/MTd for Debug). # Our project's CMakeLists.txt also sets static CRT to match. From 353f6fbc60f9fa10486c07375068e3a7d504daea Mon Sep 17 00:00:00 2001 From: Kybxd <627940450@qq.com> Date: Wed, 1 Apr 2026 12:07:38 +0800 Subject: [PATCH 4/4] chore: Unify protobuf setup and CI across platforms --- .github/workflows/testing-cpp.yml | 40 +++++++------------ .github/workflows/testing-csharp.yml | 6 ++- .github/workflows/testing-go.yml | 6 ++- init.bat | 59 +++++++++++++++++++++------- init.sh | 55 +++++++++++++++++++------- 5 files changed, 110 insertions(+), 56 deletions(-) diff --git a/.github/workflows/testing-cpp.yml b/.github/workflows/testing-cpp.yml index 6ff01b96..146d4668 100644 --- a/.github/workflows/testing-cpp.yml +++ b/.github/workflows/testing-cpp.yml @@ -19,24 +19,34 @@ jobs: include: - os: ubuntu-latest go-version: 1.24.x + protobuf-version: "32.x" protobuf_ref: "" init_script: bash init.sh gen_script: bash gen.sh run_loader: ./bin/loader - os: windows-latest go-version: 1.24.x + protobuf-version: "32.x" protobuf_ref: "" init_script: cmd /c init.bat gen_script: cmd /c gen.bat run_loader: .\bin\loader.exe - os: ubuntu-latest go-version: 1.24.x + protobuf-version: "3.19.3" protobuf_ref: "v3.19.3" - init_script: "" + init_script: bash init.sh gen_script: bash gen.sh run_loader: ./bin/loader + - os: windows-latest + go-version: 1.24.x + protobuf-version: "3.19.3" + protobuf_ref: "v3.19.3" + init_script: cmd /c init.bat + gen_script: cmd /c gen.bat + run_loader: .\bin\loader.exe - name: test (${{ matrix.os }}${{ matrix.protobuf_ref && format(', protobuf {0}', matrix.protobuf_ref) || '' }}) + name: test (${{ matrix.os }}, protobuf ${{ matrix.protobuf-version }}) runs-on: ${{ matrix.os }} timeout-minutes: 20 @@ -64,31 +74,11 @@ jobs: if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 - # --- Default protobuf (from submodule) --- + # --- Init submodules and build protobuf --- - name: Init submodules and build protobuf - if: matrix.protobuf_ref == '' run: ${{ matrix.init_script }} - - # --- Legacy protobuf (switch submodule to specified ref) --- - - name: Switch protobuf submodule to ${{ matrix.protobuf_ref }} - if: matrix.protobuf_ref != '' - working-directory: third_party/_submodules/protobuf - run: | - git fetch --tags - git checkout ${{ matrix.protobuf_ref }} - git submodule update --init --recursive - - - name: Build legacy protobuf - if: matrix.protobuf_ref != '' - working-directory: third_party/_submodules/protobuf - run: | - # protobuf <= v3.x uses cmake/ subdirectory for CMake builds - cmake -S cmake -B .build -G Ninja \ - -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_CXX_STANDARD=17 \ - -Dprotobuf_BUILD_TESTS=OFF - cmake --build .build --parallel - cmake --install .build --prefix .build/_install + env: + PROTOBUF_REF: ${{ matrix.protobuf_ref }} - name: Generate protoconf working-directory: test/cpp-tableau-loader diff --git a/.github/workflows/testing-csharp.yml b/.github/workflows/testing-csharp.yml index 1f89b475..c099f9a5 100644 --- a/.github/workflows/testing-csharp.yml +++ b/.github/workflows/testing-csharp.yml @@ -29,8 +29,12 @@ jobs: go-version: 1.24.x protoc-version: "3.19.3" gen_script: bash gen.sh + - os: windows-latest + go-version: 1.24.x + protoc-version: "3.19.3" + gen_script: cmd /c gen.bat - name: test (${{ matrix.os }}, protoc ${{ matrix.protoc-version }}) + name: test (${{ matrix.os }}, protobuf ${{ matrix.protoc-version }}) runs-on: ${{ matrix.os }} timeout-minutes: 10 diff --git a/.github/workflows/testing-go.yml b/.github/workflows/testing-go.yml index 7074fd9f..95521ceb 100644 --- a/.github/workflows/testing-go.yml +++ b/.github/workflows/testing-go.yml @@ -29,8 +29,12 @@ jobs: go-version: 1.24.x protoc-version: "3.19.3" gen_script: bash gen.sh + - os: windows-latest + go-version: 1.24.x + protoc-version: "3.19.3" + gen_script: cmd /c gen.bat - name: test (${{ matrix.os }}, protoc ${{ matrix.protoc-version }}) + name: test (${{ matrix.os }}, protobuf ${{ matrix.protoc-version }}) runs-on: ${{ matrix.os }} timeout-minutes: 10 diff --git a/init.bat b/init.bat index 16afd897..f201f879 100644 --- a/init.bat +++ b/init.bat @@ -14,23 +14,52 @@ cd /d "%repoRoot%" git submodule update --init --recursive REM Build and install the C++ Protocol Buffer runtime and the Protocol Buffer compiler (protoc) -REM Refer: https://github.com/protocolbuffers/protobuf/blob/v32.0/cmake/README.md#cmake-configuration cd third_party\_submodules\protobuf -REM use Debug version -REM - protobuf_MSVC_STATIC_RUNTIME defaults to ON, which uses static CRT (/MTd for Debug). -REM Our project's CMakeLists.txt also sets static CRT to match. -REM - protobuf_WITH_ZLIB=OFF: disable ZLIB dependency to avoid ZLIB::ZLIB link requirement -REM in protobuf's exported CMake targets, which simplifies cross-platform builds. -REM - protobuf_BUILD_SHARED_LIBS=OFF: build static libraries explicitly. -cmake -S . -B .build -G Ninja ^ - -DCMAKE_BUILD_TYPE=Debug ^ - -DCMAKE_CXX_STANDARD=17 ^ - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ^ - -Dprotobuf_BUILD_TESTS=OFF ^ - -Dprotobuf_WITH_ZLIB=OFF ^ - -Dprotobuf_BUILD_SHARED_LIBS=OFF ^ - -Dutf8_range_ENABLE_INSTALL=ON +REM If PROTOBUF_REF is set, switch submodule to the specified ref +if not "%PROTOBUF_REF%"=="" ( + echo Switching protobuf submodule to %PROTOBUF_REF%... + git fetch --tags + git checkout %PROTOBUF_REF% + git submodule update --init --recursive +) + +REM Detect protobuf major version to determine cmake source directory and arguments. +for /f "tokens=*" %%v in ('git describe --tags --abbrev^=0 2^>nul') do set PROTOBUF_VERSION=%%v +if not defined PROTOBUF_VERSION set PROTOBUF_VERSION=unknown +echo Detected protobuf version: %PROTOBUF_VERSION% + +REM Extract major version number from tag (e.g., v3.19.3 -> 3, v32.0 -> 32) +set "VER_STR=%PROTOBUF_VERSION:~1%" +for /f "tokens=1 delims=." %%a in ("%VER_STR%") do set MAJOR_VERSION=%%a + +if %MAJOR_VERSION% LEQ 3 ( + REM Legacy protobuf (v3.x): CMakeLists.txt is in cmake/ subdirectory + echo Using legacy cmake\ subdirectory for protobuf %PROTOBUF_VERSION% + cmake -S cmake -B .build -G Ninja ^ + -DCMAKE_BUILD_TYPE=Debug ^ + -DCMAKE_CXX_STANDARD=17 ^ + -Dprotobuf_BUILD_TESTS=OFF ^ + -Dprotobuf_WITH_ZLIB=OFF ^ + -Dprotobuf_BUILD_SHARED_LIBS=OFF +) else ( + REM Modern protobuf (v4+/v21+/v32+): CMakeLists.txt is in root directory + REM Refer: https://github.com/protocolbuffers/protobuf/blob/v32.0/cmake/README.md#cmake-configuration + echo Using root CMakeLists.txt for protobuf %PROTOBUF_VERSION% + REM - protobuf_MSVC_STATIC_RUNTIME defaults to ON, which uses static CRT (/MTd for Debug). + REM Our project's CMakeLists.txt also sets static CRT to match. + REM - protobuf_WITH_ZLIB=OFF: disable ZLIB dependency to avoid ZLIB::ZLIB link requirement + REM in protobuf's exported CMake targets, which simplifies cross-platform builds. + REM - protobuf_BUILD_SHARED_LIBS=OFF: build static libraries explicitly. + cmake -S . -B .build -G Ninja ^ + -DCMAKE_BUILD_TYPE=Debug ^ + -DCMAKE_CXX_STANDARD=17 ^ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ^ + -Dprotobuf_BUILD_TESTS=OFF ^ + -Dprotobuf_WITH_ZLIB=OFF ^ + -Dprotobuf_BUILD_SHARED_LIBS=OFF ^ + -Dutf8_range_ENABLE_INSTALL=ON +) REM Compile the code cmake --build .build --parallel diff --git a/init.sh b/init.sh index 6220f608..d1053899 100755 --- a/init.sh +++ b/init.sh @@ -12,22 +12,49 @@ git submodule update --init --recursive # sudo apt-get install autoconf automake libtool curl make g++ unzip # Build and install the C++ Protocol Buffer runtime and the Protocol Buffer compiler (protoc) -# Refer: https://github.com/protocolbuffers/protobuf/blob/v32.0/cmake/README.md#cmake-configuration cd third_party/_submodules/protobuf -# use Debug version -# - protobuf_MSVC_STATIC_RUNTIME defaults to ON, which uses static CRT (/MTd for Debug). -# Our project's CMakeLists.txt also sets static CRT to match. -# - protobuf_WITH_ZLIB=OFF: disable ZLIB dependency to avoid ZLIB::ZLIB link requirement -# in protobuf's exported CMake targets, which simplifies cross-platform builds. -# - protobuf_BUILD_SHARED_LIBS=OFF: build static libraries explicitly. -cmake -S . -B .build -G Ninja \ - -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_CXX_STANDARD=17 \ - -Dprotobuf_BUILD_TESTS=OFF \ - -Dprotobuf_WITH_ZLIB=OFF \ - -Dprotobuf_BUILD_SHARED_LIBS=OFF \ - -Dutf8_range_ENABLE_INSTALL=ON +# If PROTOBUF_REF is set, switch submodule to the specified ref +if [ -n "${PROTOBUF_REF:-}" ]; then + echo "Switching protobuf submodule to ${PROTOBUF_REF}..." + git fetch --tags + git checkout "${PROTOBUF_REF}" + git submodule update --init --recursive +fi + +# Detect protobuf major version to determine cmake source directory and arguments. +# - protobuf v3.x uses cmake/ subdirectory for CMake builds with minimal options. +# - protobuf v4+ (v21+) and latest (v32+) use the root directory with additional options. +PROTOBUF_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "unknown") +echo "Detected protobuf version: ${PROTOBUF_VERSION}" + +# Extract major version number from tag (e.g., v3.19.3 -> 3, v32.0 -> 32) +MAJOR_VERSION=$(echo "${PROTOBUF_VERSION}" | sed 's/^v//' | cut -d. -f1) + +if [ "${MAJOR_VERSION}" -le 3 ] 2>/dev/null; then + # Legacy protobuf (v3.x): CMakeLists.txt is in cmake/ subdirectory + echo "Using legacy cmake/ subdirectory for protobuf ${PROTOBUF_VERSION}" + cmake -S cmake -B .build -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=17 \ + -Dprotobuf_BUILD_TESTS=OFF \ + -Dprotobuf_WITH_ZLIB=OFF \ + -Dprotobuf_BUILD_SHARED_LIBS=OFF +else + # Modern protobuf (v4+/v21+/v32+): CMakeLists.txt is in root directory + # Refer: https://github.com/protocolbuffers/protobuf/blob/v32.0/cmake/README.md#cmake-configuration + echo "Using root CMakeLists.txt for protobuf ${PROTOBUF_VERSION}" + # - protobuf_WITH_ZLIB=OFF: disable ZLIB dependency to avoid ZLIB::ZLIB link requirement + # in protobuf's exported CMake targets, which simplifies cross-platform builds. + # - protobuf_BUILD_SHARED_LIBS=OFF: build static libraries explicitly. + cmake -S . -B .build -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_STANDARD=17 \ + -Dprotobuf_BUILD_TESTS=OFF \ + -Dprotobuf_WITH_ZLIB=OFF \ + -Dprotobuf_BUILD_SHARED_LIBS=OFF \ + -Dutf8_range_ENABLE_INSTALL=ON +fi # Compile the code cmake --build .build --parallel