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

38 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set -e
pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
clean() {
echo "caffe clean"
rm -rf "./third_party/source/caffe"
}
sync() {
echo "caffe sync"
mkdir -p "./third_party/source/caffe/src/caffe/proto"
curl --silent --show-error --location --output "./third_party/source/caffe/src/caffe/proto/caffe.proto" "https://github.com/BVLC/caffe/raw/master/src/caffe/proto/caffe.proto"
}
schema() {
echo "caffe schema"
[[ $(grep -U $'\x0D' ./source/caffe-proto.js) ]] && crlf=1
temp=$(mktemp -d)
node ./tools/caffe-script.js ./third_party/source/caffe/src/caffe/proto/caffe.proto ${temp}/caffe.proto
node ./tools/protoc.js --binary --text --root caffe --out ./source/caffe-proto.js ${temp}/caffe.proto
rm -rf ${temp}
if [[ -n ${crlf} ]]; then
unix2dos --quiet --newfile ./source/caffe-proto.js ./source/caffe-proto.js
fi
}
while [ "$#" != 0 ]; do
command="$1" && shift
case "${command}" in
"clean") clean;;
"sync") sync;;
"schema") schema;;
esac
done