executorch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. set -e
  3. pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
  4. case "${OSTYPE}" in
  5. msys*) python="winpty python";;
  6. *) python="python";;
  7. esac
  8. clean() {
  9. echo "executorch clean"
  10. rm -rf "./third_party/source/executorch"
  11. }
  12. sync() {
  13. echo "executorch sync"
  14. mkdir -p "./third_party/source/executorch/schema"
  15. curl --silent --location --output "./third_party/source/executorch/schema/scalar_type.fbs" "https://github.com/pytorch/executorch/raw/main/schema/scalar_type.fbs"
  16. curl --silent --location --output "./third_party/source/executorch/schema/program.fbs" "https://github.com/pytorch/executorch/raw/main/schema/program.fbs"
  17. }
  18. schema() {
  19. echo "executorch schema"
  20. [[ $(grep -U $'\x0D' ./source/executorch-schema.js) ]] && crlf=1
  21. node ./tools/flatc.js --root torch --out ./source/executorch-schema.js ./third_party/source/executorch/schema/program.fbs
  22. if [[ -n ${crlf} ]]; then
  23. unix2dos --quiet --newfile ./source/executorch-schema.js ./source/executorch-schema.js
  24. fi
  25. }
  26. while [ "$#" != 0 ]; do
  27. command="$1" && shift
  28. case "${command}" in
  29. "clean") clean;;
  30. "sync") sync;;
  31. "schema") schema;;
  32. esac
  33. done