Files
wehub-resource-sync 7254f7b4d1
Build / Build (macos-latest) (push) Waiting to run
Build / Build (ubuntu-latest) (push) Waiting to run
Build / Build (windows-latest) (push) Waiting to run
Build / Analyze (javascript) (push) Waiting to run
Build / Analyze (python) (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 12:37:45 +08:00

44 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
set -e
pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
src_dir=./third_party/source/paddle
clean() {
echo "paddle clean"
rm -rf "${src_dir}"
}
sync() {
echo "paddle sync"
mkdir -p "${src_dir}/paddle/paddle/fluid/framework"
curl --silent --show-error --location --output "${src_dir}/paddle/paddle/fluid/framework/framework.proto" "https://github.com/PaddlePaddle/Paddle/raw/develop/paddle/fluid/framework/framework.proto"
mkdir -p "${src_dir}/paddle-lite/lite/model_parser/flatbuffers"
curl --silent --show-error --location --output "${src_dir}/paddle-lite/lite/model_parser/flatbuffers/framework.fbs" "https://github.com/PaddlePaddle/Paddle-Lite/raw/develop/lite/model_parser/flatbuffers/framework.fbs"
curl --silent --show-error --location --output "${src_dir}/paddle-lite/lite/model_parser/flatbuffers/param.fbs" "https://github.com/PaddlePaddle/Paddle-Lite/raw/develop/lite/model_parser/flatbuffers/param.fbs"
}
schema() {
echo "paddle schema"
[[ $(grep -U $'\x0D' ./source/paddle-proto.js) ]] && crlf=1
node ./tools/protoc.js --binary --root paddle --text --out ./source/paddle-proto.js ${src_dir}/paddle/paddle/fluid/framework/framework.proto
if [[ -n ${crlf} ]]; then
unix2dos --quiet --newfile ./source/paddle-proto.js ./source/paddle-proto.js
fi
[[ $(grep -U $'\x0D' ./source/paddle-schema.js) ]] && crlf=1
node ./tools/flatc.js --text --root paddlelite --out ./source/paddle-schema.js ${src_dir}/paddle-lite/lite/model_parser/flatbuffers/param.fbs
if [[ -n ${crlf} ]]; then
unix2dos --quiet --newfile ./source/paddle-schema.js ./source/paddle-schema.js
fi
}
while [ "$#" != 0 ]; do
command="$1" && shift
case "${command}" in
"clean") clean;;
"sync") sync;;
"schema") schema;;
esac
done