2
0

circle 1.3 KB

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