gradlew-all.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/sh
  2. # Shell主目录;
  3. SHELL_HOME="/home/data/ApkAutoCompile/shell"
  4. # 源码主目录;
  5. SRC_HOME="/home/data/ApkAutoCompile/cacheAndroidSrc"
  6. # 日志文件;
  7. if [ ! -d '/home/data/ApkAutoCompile/shell/log' ];then
  8. mkdir '/home/data/ApkAutoCompile/shell/log'
  9. fi
  10. #LOG_FILE="/home/data/ApkAutoCompile/shell/log/gradlewall-$(date '+%d-%H%M%S').log"
  11. LOG_FILE="/home/data/ApkAutoCompile/shell/log/gradlewall.log"
  12. function updateAll()
  13. {
  14. # 遍历源码主目录;
  15. for folder in $(ls ${SRC_HOME})
  16. do
  17. APK_SRC_DIR="${SRC_HOME}/${folder}"
  18. if [ -d ${APK_SRC_DIR}/.svn ];then
  19. echo -e "\r\n\r\n======================>开始更新:${APK_SRC_DIR}<======================"
  20. svn up ${APK_SRC_DIR}
  21. if [ -f ${APK_SRC_DIR}/update_modules.sh ];then
  22. echo -e "===========>has update_modules<==========="
  23. cd ${APK_SRC_DIR}
  24. chmod 777 update_modules.sh
  25. ./update_modules.sh
  26. fi
  27. echo -e "======================>更新完成:${APK_SRC_DIR}<======================\r\n\r\n"
  28. else
  29. echo -e "${APK_SRC_DIR} \t\t不是svn目录\r\n\r\n"
  30. fi
  31. done
  32. }
  33. function compileAll()
  34. {
  35. cd ${SHELL_HOME}
  36. for folder in $(ls ${SRC_HOME})
  37. do
  38. APK_SRC_DIR="${SRC_HOME}/${folder}"
  39. if [ -d ${APK_SRC_DIR}/.svn ];then
  40. echo -e "\r\n\r\n======================>开始编译: ${APK_SRC_DIR}<======================"
  41. ./gradlew.sh ${APK_SRC_DIR} 1
  42. echo -e "======================>完成编译: ${APK_SRC_DIR}<======================\r\n\r\n"
  43. fi
  44. done
  45. }
  46. function main()
  47. {
  48. # 更新全部apk
  49. updateAll
  50. # 编译全部apk
  51. compileAll
  52. echo -e "\r\nmain end."
  53. }
  54. main 2>&1 | tee ${LOG_FILE}