update.android.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. eros_prefix="[\033[34meros\033[0m]"
  3. function error_exit {
  4. echo "--------------------------------------------"
  5. echo -e "\033[31m Error code is $1 \033[0m" 1>&2
  6. echo ""
  7. echo " Code tips: "
  8. echo -e "\033[33m1 -> platforms/android/WeexFrameworkWrapper/ is not existed. \033[0m"
  9. echo -e "\033[33m2 -> cannot cannot git pull platforms/android/WeexFrameworkWrapper/wxframework, you can try a manual operation. \033[0m"
  10. echo -e "\033[33m3 -> cannot cannot git pull platforms/android/WeexFrameworkWrapper/sdk, you can try a manual operation. \033[0m"
  11. echo -e "\033[33m4 -> cannot cannot git pull platforms/android/WeexFrameworkWrapper/nexus, you can try a manual operation. \033[0m"
  12. echo -e "\033[33m5 -> cannot cannot git pull platforms/android/WeexFrameworkWrapper/ErosPluginAmap, you can try a manual operation. \033[0m"
  13. exit 1
  14. }
  15. cd platforms/android/WeexFrameworkWrapper/ || \
  16. error_exit 1
  17. echo -e "$eros_prefix Enter android project"
  18. if [ -e wxframework/ ] || [ -e sdk/ ] || [ -e nexus/ ] || [ -e ErosPluginAmap/ ]
  19. then
  20. echo -e "$eros_prefix Start to updating."
  21. cd wxframework/ && git pull || error_exit 2
  22. cd ../sdk/ && git pull || error_exit 3
  23. cd ../nexus/ && git pull || error_exit 4
  24. cd ../ErosPluginAmap/ && git pull || error_exit 5
  25. cd ..
  26. echo -e "$eros_prefix \033[32mAndroid sdk has been updated, enjoy it! \033[0m"
  27. else
  28. echo -e "$eros_prefix No wxframework, sdk or bmwidget file, make sure you had been run eros install."
  29. fi