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 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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/working/nightly"
  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. $GIT submodule init
  24. $GIT submodule update
  25. GITREV=`$GIT describe`
  26. else
  27. echo "GIT Directory not found."
  28. exit 1;
  29. fi;
  30. export DMDIRC_GIT=${GITREV}
  31. # Archive old nightlies
  32. if [ `date +%d` = "01" ]; then
  33. echo "Archiving last month's nightlies..."
  34. OLDDIR=${WWWDIR}/nightly/old/`date -d yesterday +%B%y | tr "[:upper:]" "[:lower:]"`
  35. mkdir -p ${OLDDIR}
  36. mv -fv ${WWWDIR}/nightly/*_`date -d yesterday +%Y%m`??_* ${OLDDIR}
  37. mv -fv ${WWWDIR}/nightly/*-`date -d yesterday +%Y%m`??_* ${OLDDIR}
  38. rm -Rf ${WWWDIR}/nightly/*_latest*
  39. fi
  40. # The date/git rev to add to the end of the file names of stuff
  41. FILEDATA=`date +%Y%m%d`_${GITREV}
  42. # Force rebuild of plugins.
  43. export REBUILDPLUGINS="true"
  44. # Build plugins/jar
  45. $ANT -Dchannel=NIGHTLY -k clean jar
  46. PHP=`which php`
  47. # Check if build failed
  48. if [ ! -e "$MYDIR/dist/DMDirc.jar" ]; then
  49. # Report failure
  50. echo "Build failure"
  51. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  52. $PHP -q $SCRIPTDIR/nightly-failure.php
  53. fi
  54. else
  55. # Build installers
  56. # Delete all automatically added plugins from the jar to allow the installer
  57. # to add its own on a per-os basis
  58. unzip -l ${MYDIR}/dist/DMDirc.jar | grep " plugins/" | tr -s ' ' | cut -d ' ' -f 5- | xargs zip ${MYDIR}/dist/DMDirc.jar -d
  59. cd "${MYDIR}/installer"
  60. ./release.sh --jar "${MYDIR}/dist/DMDirc.jar" --opt "--extra ${FILEDATA}" trunk
  61. cd "${MYDIR}"
  62. 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
  63. # Report failure
  64. echo "Installer build failure."
  65. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  66. export DMDIRC_INSTALLERFAILURE=true;
  67. export BAMBOO_BUILD;
  68. $PHP -q $SCRIPTDIR/nightly-failure.php
  69. fi
  70. fi;
  71. # Re-add all plugins to the jar so that the nightly .jar has everything.
  72. $JAR -uvf "dist/DMDirc.jar" plugins
  73. # Submit plugins to addons site
  74. if [ -e "${HOME}/www/addons/submitplugin.php" ]; then
  75. for plugin in `ls plugins/*.jar`; do
  76. $PHP ${HOME}/www/addons/submitplugin.php $plugin
  77. done;
  78. fi;
  79. # Move installers/jar to nightlies site
  80. FILENAME=DMDirc_${FILEDATA}.jar
  81. mv "installer/output/DMDirc-Setup-${FILEDATA}.exe" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe"
  82. mv "installer/output/DMDirc-Setup-${FILEDATA}.run" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run"
  83. mv "installer/output/DMDirc-${FILEDATA}.dmg" "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg"
  84. rm -Rf "installer/output/DMDirc-${FILEDATA}.jar"
  85. cp dist/DMDirc.jar /home/dmdirc/www/nightly/$FILENAME
  86. if [ -e "${WWWDIR}/nightly/${FILENAME}" ]; then
  87. ln -sf ${WWWDIR}/nightly/${FILENAME} $WWWDIR/nightly/DMDirc_latest.jar
  88. fi;
  89. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" ]; then
  90. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" $WWWDIR/nightly/DMDirc-Setup_latest.run
  91. fi;
  92. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" ]; then
  93. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" $WWWDIR/nightly/DMDirc-Setup_latest.exe
  94. fi;
  95. if [ -e "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" ]; then
  96. ln -sf "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" $WWWDIR/nightly/DMDirc_latest.dmg
  97. fi;
  98. # Update Launchers
  99. cd ${MYDIR}/launcher
  100. sh ${MYDIR}/launcher/createUpdate.sh
  101. # Do normal reports
  102. if [ "${IS_BAMBOO}" == "" ]; then
  103. /bin/sh $MYDIR/DoReports.sh
  104. fi;
  105. fi