由于没有简单的方法添加额外的 proto 文件,我们将不得不克隆一些仓库并将 proto 文件复制到我们的项目中

  1. protocolbuffers/protobuf - Protocol Buffers 的官方仓库。我们需要位于 src/google/protobuf 下的 protobuf 文件

» mkdir -p thirdparty && cd thirdparty
» git clone --depth 1 https://github.com/protocolbuffers/protobuf.git
  1. bentoml/bentoml - 我们需要 bentoml/grpc/ 下的 service.proto 来构建客户端;因此,我们将执行 稀疏检出 (sparse checkout) 以仅检出 bentoml/grpc 目录

» mkdir bentoml && pushd bentoml
» git init
» git remote add -f origin https://github.com/bentoml/BentoML.git
» git config core.sparseCheckout true
» cat <<EOT >|.git/info/sparse-checkout
src/bentoml/grpc
EOT
» git pull origin main && mv src/bentoml/grpc .
» popd