paddle 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. set -e
  3. root=$(cd $(dirname ${0})/..; pwd)
  4. node_modules=${root}/node_modules
  5. src=${root}/src
  6. tools=${root}/tools
  7. third_party=${root}/third_party
  8. identifier=paddle
  9. virtualenv=${root}/build/virtualenv/${identifier}
  10. bold() {
  11. echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
  12. }
  13. git_sync () {
  14. mkdir -p "${third_party}"
  15. if [ -d "${third_party}/${1}" ]; then
  16. git -C "${third_party}/${1}" fetch -p --quiet
  17. git -C "${third_party}/${1}" reset --quiet --hard origin/$(git -C "${third_party}/${1}" rev-parse --abbrev-ref HEAD)
  18. else
  19. git -C "${third_party}" clone --quiet --recursive ${2} ${1}
  20. fi
  21. }
  22. clean() {
  23. bold "paddle clean"
  24. rm -rf ${third_party}/paddle
  25. }
  26. sync() {
  27. bold "paddle sync"
  28. git_sync paddle https://github.com/PaddlePaddle/Paddle.git
  29. }
  30. schema() {
  31. bold "paddle schema"
  32. ${node_modules}/protobufjs/bin/pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --keep-case -r paddle -o ${src}/paddle-proto.js ${third_party}/${identifier}/paddle/fluid/framework/framework.proto
  33. }
  34. while [ "$#" != 0 ]; do
  35. command="$1" && shift
  36. case "${command}" in
  37. "clean") clean;;
  38. "sync") sync;;
  39. "install") install;;
  40. "schema") schema;;
  41. esac
  42. done