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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. # Build plugins/jar
  43. $ANT -Dchannel=NIGHTLY -k clean jar
  44. PHP=`which php`
  45. # Check if build failed
  46. if [ ! -e "$MYDIR/dist/DMDirc.jar" ]; then
  47. # Report failure
  48. echo "Build failure"
  49. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  50. $PHP -q $SCRIPTDIR/nightly-failure.php
  51. fi
  52. else
  53. # Build installers
  54. # Delete all automatically added plugins from the jar to allow the installer
  55. # to add its own on a per-os basis
  56. unzip -l ${MYDIR}/dist/DMDirc.jar | grep " plugins/" | tr -s ' ' | cut -d ' ' -f 5- | xargs zip ${MYDIR}/dist/DMDirc.jar -d
  57. cd "${MYDIR}/installer"
  58. ./release.sh --jar "${MYDIR}/dist/DMDirc.jar" --opt "--extra ${FILEDATA}" trunk
  59. cd "${MYDIR}"
  60. 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
  61. # Report failure
  62. echo "Installer build failure."
  63. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  64. export DMDIRC_INSTALLERFAILURE=true;
  65. export BAMBOO_BUILD;
  66. $PHP -q $SCRIPTDIR/nightly-failure.php
  67. fi
  68. fi;
  69. # Re-add all plugins to the jar so that the nightly .jar has everything.
  70. $JAR -uvf "dist/DMDirc.jar" plugins
  71. # Submit plugins to addons site
  72. if [ -e "${HOME}/www/addons/submitplugin.php" ]; then
  73. for plugin in `ls plugins/*.jar`; do
  74. $PHP ${HOME}/www/addons/submitplugin.php $plugin
  75. done;
  76. fi;
  77. # Move installers/jar to nightlies site
  78. FILENAME=DMDirc_${FILEDATA}.jar
  79. mv "installer/output/DMDirc-Setup-${FILEDATA}.exe" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe"
  80. mv "installer/output/DMDirc-Setup-${FILEDATA}.run" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run"
  81. mv "installer/output/DMDirc-${FILEDATA}.dmg" "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg"
  82. rm -Rf "installer/output/DMDirc-${FILEDATA}.jar"
  83. cp dist/DMDirc.jar /home/dmdirc/www/nightly/$FILENAME
  84. if [ -e "${WWWDIR}/nightly/${FILENAME}" ]; then
  85. ln -sf ${WWWDIR}/nightly/${FILENAME} $WWWDIR/nightly/DMDirc_latest.jar
  86. fi;
  87. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" ]; then
  88. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" $WWWDIR/nightly/DMDirc-Setup_latest.run
  89. fi;
  90. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" ]; then
  91. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" $WWWDIR/nightly/DMDirc-Setup_latest.exe
  92. fi;
  93. if [ -e "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" ]; then
  94. ln -sf "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" $WWWDIR/nightly/DMDirc_latest.dmg
  95. fi;
  96. # Update Launchers
  97. cd ${MYDIR}/launcher
  98. sh ${MYDIR}/launcher/createUpdate.sh
  99. # Do normal reports
  100. if [ "${IS_BAMBOO}" == "" ]; then
  101. /bin/sh $MYDIR/DoReports.sh
  102. fi;
  103. fi