paddle 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. set -e
  3. pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
  4. bold() {
  5. echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
  6. }
  7. clean() {
  8. bold "paddle clean"
  9. rm -rf "./third_party/src/paddle"
  10. }
  11. sync() {
  12. bold "paddle sync"
  13. [ -d "./third_party/src/paddle" ] || git clone --quiet --recursive https://github.com/PaddlePaddle/Paddle.git "./third_party/src/paddle"
  14. pushd "./third_party/src/paddle" > /dev/null
  15. git pull --quiet --prune
  16. git submodule sync --quiet
  17. git submodule update --quiet --init --recursive
  18. popd > /dev/null
  19. }
  20. schema() {
  21. bold "paddle schema"
  22. [[ $(grep -U $'\x0D' ./src/paddle-proto.js) ]] && crlf=1
  23. npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r paddle -o ./src/paddle-proto.js ./third_party/src/paddle/paddle/fluid/framework/framework.proto
  24. if [[ -n ${crlf} ]]; then
  25. unix2dos --quiet --newfile ./src/paddle-proto.js ./src/paddle-proto.js
  26. fi
  27. }
  28. while [ "$#" != 0 ]; do
  29. command="$1" && shift
  30. case "${command}" in
  31. "clean") clean;;
  32. "sync") sync;;
  33. "schema") schema;;
  34. esac
  35. done