Advertisement
Guest User

build-Script-i9300-jenkins-PA

a guest
Oct 11th, 2013
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.54 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. export USE_CCACHE=1
  4.  
  5. # get current path
  6. reldir=/var/lib/jenkins/workspace/pa43-modded
  7. cd $reldir
  8. DIR=`pwd`
  9.  
  10. # Colorize and add text parameters
  11. red=$(tput setaf 1)             #  red
  12. grn=$(tput setaf 2)             #  green
  13. cya=$(tput setaf 6)             #  cyan
  14. txtbld=$(tput bold)             # Bold
  15. bldred=${txtbld}$(tput setaf 1) #  red
  16. bldgrn=${txtbld}$(tput setaf 2) #  green
  17. bldblu=${txtbld}$(tput setaf 4) #  blue
  18. bldcya=${txtbld}$(tput setaf 6) #  cyan
  19. txtrst=$(tput sgr0)             # Reset
  20.  
  21. THREADS="16"
  22. DEVICE="i9300"
  23. EXTRAS="clean"
  24.  
  25. # get current version
  26. MAJOR=$(cat $DIR/vendor/pa/config/pa_common.mk | grep 'PA_VERSION_MAJOR = *' | sed  's/PA_VERSION_MAJOR = //g')
  27. MINOR=$(cat $DIR/vendor/pa/config/pa_common.mk | grep 'PA_VERSION_MINOR = *' | sed  's/PA_VERSION_MINOR = //g')
  28. MAINTENANCE=$(cat $DIR/vendor/pa/config/pa_common.mk | grep 'PA_VERSION_MAINTENANCE = *' | sed  's/PA_VERSION_MAINTENANCE = //g')
  29. VERSION=$MAJOR.$MINOR$MAINTENANCE
  30.  
  31. # if we have not extras, reduce parameter index by 1
  32. if [ "$EXTRAS" == "true" ] || [ "$EXTRAS" == "false" ]
  33. then
  34.    SYNC="$2"
  35.    UPLOAD="$3"
  36. else
  37.    SYNC="$3"
  38.    UPLOAD="$4"
  39. fi
  40.  
  41. # get time of startup
  42. res1=$(date +%s.%N)
  43.  
  44. # we don't allow scrollback buffer
  45. echo -e '\0033\0143'
  46. clear
  47.  
  48. echo -e "${cya}Building ${bldcya}ParanoidAndroid v$VERSION ${txtrst}";
  49.  
  50. echo -e "${cya}"
  51. ./vendor/pa/tools/getdevicetree.py $DEVICE
  52. echo -e "${txtrst}"
  53.  
  54. # decide what command to execute
  55. case "$EXTRAS" in
  56.    threads)
  57.        echo -e "${bldblu}Please write desired threads followed by [ENTER] ${txtrst}"
  58.        read threads
  59.        THREADS=$threads;;
  60.    clean)
  61.        echo -e ""
  62.        echo -e "${bldblu}Cleaning intermediates and output files ${txtrst}"
  63.        make clean > /dev/null;;
  64. esac
  65.  
  66. # sync with latest sources
  67. echo -e ""
  68. if [ "$SYNC" == "true" ]
  69. then
  70.    echo -e "${bldblu}Fetching latest sources ${txtrst}"
  71.    repo sync -j"$THREADS"
  72.    echo -e ""
  73. fi
  74.  
  75. # java setup
  76. # echo -e "${bldblu}Setting up java ${txtrst}"
  77. # . vendor/pa/tools/setupjava.sh
  78. # echo -e ""
  79.  
  80. # setup environment
  81. echo -e "${bldblu}Setting up environment ${txtrst}"
  82. . build/envsetup.sh
  83.  
  84. # lunch device
  85. echo -e ""
  86. echo -e "${bldblu}Lunching device ${txtrst}"
  87. lunch "pa_$DEVICE-userdebug";
  88.  
  89. echo -e ""
  90. echo -e "${bldblu}Starting compilation ${txtrst}"
  91.  
  92. # start compilation
  93. mka bacon
  94. echo -e ""
  95.  
  96. # finished? get elapsed time
  97. res2=$(date +%s.%N)
  98. echo "${bldgrn}Total time elapsed: ${txtrst}${grn}$(echo "($res2 - $res1) / 60"|bc ) minutes ($(echo "$res2 - $res1"|bc ) seconds) ${txtrst}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement