From a99f3bb2ace968ed1e5a34a11f53995636eac062 Mon Sep 17 00:00:00 2001 From: doronz Date: Thu, 21 Dec 2023 10:58:37 +0200 Subject: [PATCH] server: make `protobuf-c` into a git submodule --- .github/workflows/pull-request.yml | 6 ++++++ .github/workflows/python-publish.yml | 2 ++ .github/workflows/server-publish.yml | 2 ++ .gitignore | 4 +--- .gitmodules | 3 +++ README.md | 4 ++-- src/rpcserver/CMakeLists.txt | 13 +------------ src/rpcserver/protobuf-c | 1 + 8 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 .gitmodules create mode 160000 src/rpcserver/protobuf-c diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index dcd28a49..481aeb5c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -23,6 +23,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + submodules: recursive - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -74,6 +76,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + submodules: recursive - name: Run clang-format style. run: | if clang-format -n ../protos/*.proto *.h *.c | grep -q " code should be clang-formatted" ; then @@ -140,6 +144,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + submodules: recursive - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 80832a6a..4b8148a5 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -18,6 +18,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + submodules: recursive - name: Set up Python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/server-publish.yml b/.github/workflows/server-publish.yml index 0506e0ef..16f5da89 100644 --- a/.github/workflows/server-publish.yml +++ b/.github/workflows/server-publish.yml @@ -20,6 +20,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + submodules: recursive - if: matrix.os == 'ubuntu-latest' name: Build server on ubuntu diff --git a/.gitignore b/.gitignore index f50872df..760d16aa 100644 --- a/.gitignore +++ b/.gitignore @@ -49,7 +49,5 @@ _CodeSignature **/_version.py src/rpcserver/protos/ src/rpcclient/rpcclient/protos/ +src/rpcserver/build/ cmake-build-debug - -# Third party -src/rpcserver/protobuf-c/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..1d159297 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "src/rpcserver/protobuf-c"] + path = src/rpcserver/protobuf-c + url = https://github.com/protobuf-c/protobuf-c.git diff --git a/README.md b/README.md index b18e7b5c..ca5e3a1b 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ For macOS/iOS (Ensure that Xcode is installed): ```bash brew install protobuf protobuf-c python3 -m pip install mypy-protobuf protobuf grpcio-tools -git clone git@github.com:doronz88/rpc-project.git +git clone git@github.com:doronz88/rpc-project.git --recurse-submodules cd rpc-project make -C src/protos/ all cd src/rpcserver @@ -102,7 +102,7 @@ make ```bash sudo apt-get install -y protobuf-compiler libprotobuf-dev libprotoc-dev protobuf-c-compiler python3 -m pip mypy-protobuf protobuf grpcio-tools -git clone git@github.com:doronz88/rpc-project.git +git clone git@github.com:doronz88/rpc-project.git --recurse-submodules cd rpc-project make -C src/protos/ all cd src/rpcserver diff --git a/src/rpcserver/CMakeLists.txt b/src/rpcserver/CMakeLists.txt index be1db1ec..2ae08483 100644 --- a/src/rpcserver/CMakeLists.txt +++ b/src/rpcserver/CMakeLists.txt @@ -50,18 +50,7 @@ endif () ### Check if protobuf-c source not found and download if necessary if (NOT EXISTS ${CMAKE_SOURCE_DIR}/protobuf-c) - message(STATUS "protobuf-c not found, downloading...") - ExternalProject_Add( - protobuf-c-download - PREFIX "protobuf-c-download" - GIT_REPOSITORY https://github.com/protobuf-c/protobuf-c.git - GIT_TAG v1.5.0 - SOURCE_DIR ${CMAKE_SOURCE_DIR}/protobuf-c/ - # Disable all other steps - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - ) + message(FATAL " protobuf-c not found, please execute 'git submodule update --init --recursive'") endif () # Build protobuf-c after downloading set(LIBPROTO_C "${CMAKE_BINARY_DIR}/protobuf-c-build") diff --git a/src/rpcserver/protobuf-c b/src/rpcserver/protobuf-c new file mode 160000 index 00000000..8c201f6e --- /dev/null +++ b/src/rpcserver/protobuf-c @@ -0,0 +1 @@ +Subproject commit 8c201f6e47a53feaab773922a743091eb6c8972a