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

53 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
set -e
pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
clean() {
echo "mindspore clean"
rm -rf "./third_party/source/mindspore"
}
sync() {
echo "mindspore sync"
mkdir -p "./third_party/source/mindspore/mindspore/lite/schema/"
curl --silent --show-error --location --output "./third_party/source/mindspore/mindspore/lite/schema/model.fbs" "https://github.com/mindspore-ai/mindspore/raw/master/mindspore/lite/schema/model.fbs"
curl --silent --show-error --location --output "./third_party/source/mindspore/mindspore/lite/schema/ops.fbs" "https://github.com/mindspore-ai/mindspore/raw/master/mindspore/lite/schema/ops.fbs"
curl --silent --show-error --location --output "./third_party/source/mindspore/mindspore/lite/schema/ops_types.fbs" "https://github.com/mindspore-ai/mindspore/raw/master/mindspore/lite/schema/ops_types.fbs"
mkdir -p "./third_party/source/mindspore/mindspore/core/proto/"
curl --silent --show-error --location --output "./third_party/source/mindspore/mindspore/core/proto/mind_ir.proto" "https://github.com/mindspore-ai/mindspore/raw/master/mindspore/core/proto/mind_ir.proto"
}
schema() {
echo "mindspore schema"
[[ $(grep -U $'\x0D' ./source/mslite-schema.js) ]] && crlf=1
node ./tools/flatc.js --text --root mslite --out ./source/mslite-schema.js ./third_party/source/mindspore/mindspore/lite/schema/model.fbs
if [[ -n ${crlf} ]]; then
unix2dos --quiet --newfile ./source/mslite-schema.js ./source/mslite-schema.js
fi
[[ $(grep -U $'\x0D' ./source/mindir-proto.js) ]] && crlf2=1
node ./tools/protoc.js --binary --text --root mindir --out ./source/mindir-proto.js ./third_party/source/mindspore/mindspore/core/proto/mind_ir.proto
if [[ -n ${crlf2} ]]; then
unix2dos --quiet --newfile ./source/mindir-proto.js ./source/mindir-proto.js
fi
}
metadata() {
echo "mindspore metadata"
[[ $(grep -U $'\x0D' ./source/mslite-metadata.json) ]] && crlf=1
node ./tools/mslite-script.js
if [[ -n ${crlf} ]]; then
unix2dos --quiet --newfile ./source/mslite-metadata.json ./source/mslite-metadata.json
fi
}
while [ "$#" != 0 ]; do
command="$1" && shift
case "${command}" in
"clean") clean;;
"sync") sync;;
"schema") schema;;
"metadata") metadata;;
esac
done