install.android.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 remove platforms/android/WeexFrameworkWrapper/wxframework, please check file permissions. \033[0m"
  10. echo -e "\033[33m3 -> cannot remove platforms/android/WeexFrameworkWrapper/sdk, please check file permissions. \033[0m"
  11. echo -e "\033[33m4 -> cannot remove platforms/android/WeexFrameworkWrapper/nexus, please check file permissions. \033[0m"
  12. echo -e "\033[33m5 -> cannot remove platforms/android/WeexFrameworkWrapper/ErosPluginAmap, please check file permissions. \033[0m"
  13. echo -e "\033[33m6 -> failed run: git clone https://github.com/bmfe/WeexErosFramework.git. \033[0m"
  14. echo -e "\033[33m7 -> failed run: git clone https://github.com/bmfe/WeexSDK.git. \033[0m"
  15. echo -e "\033[33m8 -> failed run: git clone https://github.com/bmfe/eros-nexus.git. \033[0m"
  16. echo -e "\033[33m9 -> failed run: git clone https://github.com/bmfe/eros-plugin-android-amap.git. \033[0m"
  17. exit 1
  18. }
  19. cd platforms/android/WeexFrameworkWrapper/ || \
  20. error_exit 1
  21. echo -e "$eros_prefix Enter android project"
  22. if [ -e wxframework/ ] || [ -e sdk/ ] || [ -e nexus/ ] || [ -e ErosPluginAmap/ ]
  23. then
  24. echo -e "$eros_prefix mwxframework, sdk ,nexus or ErosPluginAmap has been existed, remove old sdk."
  25. rm -rf wxframework/ || error_exit 2
  26. rm -rf sdk/ || error_exit 3
  27. rm -rf nexus/ || error_exit 4
  28. rm -rf ErosPluginAmap/ || error_exit 5
  29. else
  30. echo -e "$eros_prefix No eros devDependencies, we will start to clone new sdk..."
  31. fi
  32. echo -e "$eros_prefix \033[36mMay spend a lot of time, please wait patiently. \033[0m"
  33. git clone https://github.com/bmfe/WeexErosFramework.git wxframework --depth=1 -q || \
  34. error_exit 6
  35. echo -e "$eros_prefix Eros wxframework clone done."
  36. git clone https://github.com/bmfe/WeexSDK.git sdk --depth=1 -q || \
  37. error_exit 7
  38. echo -e "$eros_prefix Weex sdk clone done."
  39. git clone https://github.com/bmfe/eros-nexus.git nexus --depth=1 -q || \
  40. error_exit 8
  41. echo -e "$eros_prefix Eros nexus clone done."
  42. git clone https://github.com/bmfe/eros-plugin-android-amap.git ErosPluginAmap --depth=1 -q || \
  43. error_exit 9
  44. echo -e "$eros_prefix Eros ErosPluginAmap clone done."
  45. echo ""
  46. echo -e "$eros_prefix \033[32mAndroid sdk has been installed, enjoy it! \033[0m"