Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
go-version: "1.23.x"

- name: Download dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
go-version: "1.23.x"

- name: Download dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
go-version: "1.23.x"

- name: Download dependencies
run: |
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/testing-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
go-version: [1.23.x]
protobuf-version: ["32.0", "3.19.3"]
include:
- os: ubuntu-latest
go-version: 1.21.x
init_script: bash init.sh
gen_script: bash gen.sh
run_loader: ./bin/loader
- os: windows-latest
go-version: 1.21.x
init_script: cmd /c init.bat
gen_script: cmd /c gen.bat
run_loader: .\bin\loader.exe

name: test (${{ matrix.os }})
name: test (${{ matrix.os }}, protobuf ${{ matrix.protobuf-version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 10
timeout-minutes: 20

steps:
- name: Checkout Code
Expand Down Expand Up @@ -58,6 +59,8 @@ jobs:

- name: Init submodules and build protobuf
run: ${{ matrix.init_script }}
env:
PROTOBUF_REF: v${{ matrix.protobuf-version }}

- name: Generate protoconf
working-directory: test/cpp-tableau-loader
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/testing-csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
go-version: [1.23.x]
protobuf-version: ["32.0", "3.19.3"]
include:
- os: ubuntu-latest
go-version: 1.21.x
gen_script: bash gen.sh
- os: windows-latest
go-version: 1.21.x
gen_script: cmd /c gen.bat

name: test (${{ matrix.os }})
name: test (${{ matrix.os }}, protobuf ${{ matrix.protobuf-version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 10

Expand All @@ -46,9 +47,17 @@ jobs:
dotnet-version: "8.0.x"

- name: Install Protoc
if: "!startsWith(matrix.protobuf-version, '3.')"
uses: arduino/setup-protoc@v3
with:
version: ${{ matrix.protobuf-version }}
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Protoc (legacy)
if: startsWith(matrix.protobuf-version, '3.')
uses: arduino/setup-protoc@v1
with:
version: "3.19.3"
version: ${{ matrix.protobuf-version }}
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Generate protoconf
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/testing-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
go-version: [1.23.x]
protobuf-version: ["32.0", "3.19.3"]
include:
- os: ubuntu-latest
go-version: 1.21.x
gen_script: bash gen.sh
- os: windows-latest
go-version: 1.21.x
gen_script: cmd /c gen.bat

name: test (${{ matrix.os }})
name: test (${{ matrix.os }}, protobuf ${{ matrix.protobuf-version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 10

Expand All @@ -41,13 +42,21 @@ jobs:
cache: true

- name: Install Protoc
if: "!startsWith(matrix.protobuf-version, '3.')"
uses: arduino/setup-protoc@v3
with:
version: ${{ matrix.protobuf-version }}
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Protoc (legacy)
if: startsWith(matrix.protobuf-version, '3.')
uses: arduino/setup-protoc@v1
with:
version: "3.19.3"
version: ${{ matrix.protobuf-version }}
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
Expand Down
5 changes: 4 additions & 1 deletion cmd/protoc-gen-cpp-tableau-loader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion cmd/protoc-gen-csharp-tableau-loader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion cmd/protoc-gen-go-tableau-loader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module github.com/tableauio/loader

go 1.21
go 1.23

require (
github.com/aymanbagabas/go-udiff v0.2.0
github.com/iancoleman/strcase v0.3.0
github.com/stretchr/testify v1.10.0
github.com/tableauio/tableau v0.15.1
google.golang.org/protobuf v1.34.2
google.golang.org/protobuf v1.36.11
)

require (
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,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=
Expand Down Expand Up @@ -66,8 +66,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=
Expand Down
70 changes: 54 additions & 16 deletions init.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,61 @@ 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 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
cd third_party\_submodules\protobuf

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 ^
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 ^
-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
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
65 changes: 50 additions & 15 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,55 @@ 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
# 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
cd third_party/_submodules/protobuf

# 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
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
Loading
Loading