setup_env.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash -e
  2. #Repository
  3. ActionBarSherlockRepo="https://github.com/JakeWharton/ActionBarSherlock.git"
  4. #Directory for actionbarsherlock
  5. DIRECTORY="actionbarsherlock"
  6. #Commit for version 4.2 of actionbar sherlock
  7. COMMIT="90939dc3925ffaaa0de269bbbe1b35e274968ea1"
  8. function initDefault {
  9. git submodule init
  10. git submodule update
  11. android update lib-project -p owncloud-android-library
  12. android update project -p .
  13. android update project -p oc_jb_workaround
  14. android update test-project -p tests -m ..
  15. }
  16. function initForAnt {
  17. #If the directory exists the script has already been executed
  18. if [ ! -d "$DIRECTORY" ]; then
  19. #Gets the owncloud-android-library
  20. git submodule init
  21. git submodule update
  22. #Clones the actionbarsherlock and checks-out the right release (4.2.0)
  23. git clone $ActionBarSherlockRepo $DIRECTORY
  24. cd $DIRECTORY
  25. git checkout $COMMIT
  26. cd ../
  27. #As default it updates the ant scripts
  28. android update project -p "$DIRECTORY"/library -n ActionBarSherlock --target android-19
  29. android update lib-project -p owncloud-android-library
  30. android update project -p .
  31. android update project -p oc_jb_workaround
  32. cp third_party/android-support-library/android-support-v4.jar actionbarsherlock/library/libs/android-support-v4.jar
  33. android update test-project -p tests -m ..
  34. fi
  35. }
  36. #No args
  37. if [ $# -lt 1 ]; then
  38. echo "No args found"
  39. echo "Usage : $0 [gradle | maven | ant]"
  40. exit
  41. fi
  42. #checking args
  43. case "$1" in
  44. "ant")
  45. echo "Creating Ant environment"
  46. initForAnt
  47. ;;
  48. "gradle") echo "Creating gradle environment"
  49. initDefault
  50. ;;
  51. "maven") echo "Creating maven environment"
  52. initDefault
  53. ;;
  54. *) echo "Argument not recognized"
  55. echo "Usage : $0 [gradle | maven | ant]"
  56. ;;
  57. esac
  58. exit