You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BuildAll.sh 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #!/bin/sh
  2. # cron doesn't seem to like doing this iself...
  3. . /etc/profile
  4. # Used for nightly.log to help diagnosing problems
  5. env
  6. # Path to WWW Directory
  7. WWWDIR="/home/dmdirc/www"
  8. # Path to trunk
  9. MYDIR="/home/dmdirc/google"
  10. # Path to scripts
  11. SCRIPTDIR="/home/dmdirc/scripts"
  12. # Path to ant binary
  13. ANT="/usr/bin/ant"
  14. # Path to git binary
  15. GIT="/usr/bin/git"
  16. # Path to jar binary
  17. JAR="/usr/bin/jar"
  18. cd ${MYDIR}
  19. if [ -d .git ]; then
  20. $GIT reset --hard
  21. $GIT checkout master
  22. $GIT pull
  23. GITREV=`$GIT describe`
  24. else
  25. echo "GIT Directory not found."
  26. exit 1;
  27. fi;
  28. export DMDIRC_GIT=${GITREV}
  29. # Archive old nightlies
  30. if [ `date +%d` = "01" ]; then
  31. echo "Archiving Last Months Nightlies"
  32. OLDDIR=${WWWDIR}/nightly/old/`date -d yesterday +%B%y | tr "[:upper:]" "[:lower:]"`
  33. mkdir -p ${OLDDIR}
  34. mv -fv ${WWWDIR}/nightly/*_`date -d yesterday +%Y%m`??_* ${OLDDIR}
  35. mv -fv ${WWWDIR}/nightly/*-`date -d yesterday +%Y%m`??_* ${OLDDIR}
  36. rm -Rf ${WWWDIR}/nightly/*_latest*
  37. fi
  38. # The date/git rev to add to the end of the file names of stuff
  39. FILEDATA=`date +%Y%m%d`_${GITREV}
  40. # Copy default settings from www to trunk for compile (if they exist)
  41. REVERTLIST=""
  42. if [ -e "${HOME}/www/updates/" ]; then
  43. for updatedir in `ls -1 src/com/dmdirc/config/defaults/`; do
  44. src="${HOME}/www/updates/${updatedir}"
  45. if [ -e ${src} ]; then
  46. REVERTLIST=${REVERTLIST}" src/com/dmdirc/config/defaults/${updatedir}/"
  47. cp -Rfv ${src}/* src/com/dmdirc/config/defaults/${updatedir}/
  48. fi;
  49. done
  50. fi;
  51. # Build plugins/jar
  52. $ANT -Dchannel=NIGHTLY -k clean jar
  53. # Now revert the trunk so as not to break updates.
  54. ${GIT} checkout src/com/dmdirc/config/defaults/;
  55. PHP=`which php`
  56. # Check if build failed
  57. if [ ! -e "$MYDIR/dist/DMDirc.jar" ]; then
  58. # Report failure
  59. echo "Build Failure."
  60. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  61. $PHP -q $SCRIPTDIR/nightly-failure.php
  62. fi
  63. else
  64. # Build installers
  65. # Delete all automatically added plugins from the jar to allow the installer
  66. # to add its own on a per-os basis
  67. unzip -l ${MYDIR}/dist/DMDirc.jar | grep " plugins/" | tr -s ' ' | cut -d ' ' -f 5- | xargs zip ${MYDIR}/dist/DMDirc.jar -d
  68. cd "${MYDIR}/installer"
  69. ./release.sh --jar "${MYDIR}/dist/DMDirc.jar" --opt "--extra ${FILEDATA}" trunk
  70. cd "${MYDIR}"
  71. if [ ! -e "${MYDIR}/installer/output/DMDirc-Setup-${FILEDATA}.exe" -o ! -e "${MYDIR}/installer/output/DMDirc-Setup-${FILEDATA}.run" -o ! -e "${MYDIR}/installer/output/DMDirc-${FILEDATA}.dmg" -o ! -e "${MYDIR}/installer/output/DMDirc-${FILEDATA}.jar" ]; then
  72. # Report failure
  73. echo "Installer Build Failure."
  74. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  75. export DMDIRC_INSTALLERFAILURE=true;
  76. export BAMBOO_BUILD;
  77. $PHP -q $SCRIPTDIR/nightly-failure.php
  78. fi
  79. fi;
  80. # Re-Add all plugins to the jar so that the nightly .jar has everything.
  81. $JAR -uvf "dist/DMDirc.jar" plugins
  82. # Submit plugins to addons site
  83. if [ -e "${HOME}/www/addons/submitplugin.php" ]; then
  84. for plugin in `ls plugins/*.jar`; do
  85. $PHP ${HOME}/www/addons/submitplugin.php $plugin
  86. done;
  87. fi;
  88. # Move installers/jar to nightlies site
  89. FILENAME=DMDirc_${FILEDATA}.jar
  90. mv "installer/output/DMDirc-Setup-${FILEDATA}.exe" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe"
  91. mv "installer/output/DMDirc-Setup-${FILEDATA}.run" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run"
  92. mv "installer/output/DMDirc-${FILEDATA}.dmg" "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg"
  93. rm -Rf "installer/output/DMDirc-${FILEDATA}.jar"
  94. cp dist/DMDirc.jar /home/dmdirc/www/nightly/$FILENAME
  95. if [ -e "${WWWDIR}/nightly/${FILENAME}" ]; then
  96. ln -sf ${WWWDIR}/nightly/${FILENAME} $WWWDIR/nightly/DMDirc_latest.jar
  97. fi;
  98. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" ]; then
  99. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" $WWWDIR/nightly/DMDirc-Setup_latest.run
  100. fi;
  101. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" ]; then
  102. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" $WWWDIR/nightly/DMDirc-Setup_latest.exe
  103. fi;
  104. if [ -e "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" ]; then
  105. ln -sf "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" $WWWDIR/nightly/DMDirc_latest.dmg
  106. fi;
  107. # Do normal reports
  108. if [ "${IS_BAMBOO}" == "" ]; then
  109. /bin/sh $MYDIR/DoReports.sh
  110. fi;
  111. fi
  112. $GIT checkout src/com/dmdirc/Main.java