2
0

megengine 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. set -e
  3. pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
  4. clean() {
  5. echo "megengine clean"
  6. rm -rf ./third_party/source/megengine
  7. }
  8. sync() {
  9. echo "megengine sync"
  10. mkdir -p "./third_party/source/megengine/src/serialization/fbs"
  11. curl --silent --show-error --location --output "./third_party/source/megengine/src/serialization/fbs/dtype.fbs" "https://github.com/MegEngine/MegEngine/raw/master/ci/compatibility/fbs/V2-backup/dtype.fbs"
  12. curl --silent --show-error --location --output "./third_party/source/megengine/src/serialization/fbs/mgb_opr_param_defs.fbs" "https://github.com/MegEngine/MegEngine/raw/master/ci/compatibility/fbs/V2-backup/mgb_opr_param_defs.fbs"
  13. curl --silent --show-error --location --output "./third_party/source/megengine/src/serialization/fbs/mgb_cpp_opr.fbs" "https://github.com/MegEngine/MegEngine/raw/master/ci/compatibility/fbs/V2-backup/mgb_cpp_opr.fbs"
  14. curl --silent --show-error --location --output "./third_party/source/megengine/src/serialization/fbs/opr_param_defs.fbs" "https://github.com/MegEngine/MegEngine/raw/master/ci/compatibility/fbs/V2-backup/opr_param_defs.fbs"
  15. curl --silent --show-error --location --output "./third_party/source/megengine/src/serialization/fbs/schema_v2.fbs" "https://github.com/MegEngine/MegEngine/raw/master/ci/compatibility/fbs/V2-backup/schema_v2.fbs"
  16. }
  17. schema() {
  18. echo "megengine schema"
  19. [[ $(grep -U $'\x0D' ./source/megengine-schema.js) ]] && crlf=1
  20. node ./tools/flatc.js --root megengine --out ./source/megengine-schema.js ./third_party/source/megengine/src/serialization/fbs/schema_v2.fbs
  21. if [[ -n ${crlf} ]]; then
  22. unix2dos --quiet --newfile ./source/megengine-schema.js ./source/megengine-schema.js
  23. fi
  24. }
  25. metadata() {
  26. echo "megengine metadata"
  27. if [[ $(grep -U $'\x0D' ./source/megengine-metadata.json) ]]; then crlf=1; else crlf=; fi
  28. node ./tools/megengine-script.js
  29. if [[ -n ${crlf} ]]; then
  30. unix2dos --quiet --newfile ./source/megengine-metadata.json ./source/megengine-metadata.json
  31. fi
  32. }
  33. while [ "$#" != 0 ]; do
  34. command="$1" && shift
  35. case "${command}" in
  36. "clean") clean;;
  37. "sync") sync;;
  38. "schema") schema;;
  39. "metadata") metadata;;
  40. esac
  41. done