Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

BuildAll.sh 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 svn binary
  15. SVN="/usr/bin/svn"
  16. # Path to jar binary
  17. JAR="/usr/bin/jar"
  18. # Where are the bamboo log files?
  19. BAMBOO=/home/dmdirc/Bamboo/xml-data/builds/DMDIRC-NIGHTLY/download-data/build_logs/
  20. cd ${MYDIR}
  21. $SVN update
  22. SVNREV=`$SVN info | grep Revision`
  23. SVNREV=${SVNREV##*: }
  24. export DMDIRC_SVN=${SVNREV}
  25. # Archive old nightlies
  26. if [ `date +%d` = "01" ]; then
  27. echo "Archiving Last Months Nightlies"
  28. OLDDIR=${WWWDIR}/nightly/old/`date -d yesterday +%B%y | tr "[:upper:]" "[:lower:]"`
  29. mkdir -p ${OLDDIR}
  30. mv -fv ${WWWDIR}/nightly/*_`date -d yesterday +%Y%m`??_* ${OLDDIR}
  31. mv -fv ${WWWDIR}/nightly/*-`date -d yesterday +%Y%m`??_* ${OLDDIR}
  32. rm -Rf ${WWWDIR}/nightly/*_latest*
  33. fi
  34. # The date/svn prefix to add to the end of the file names of stuff
  35. FILEDATA=`date +%Y%m%d`_${SVNREV}
  36. # Copy default settings from www to trunk for compile (if they exist)
  37. REVERTLIST=""
  38. if [ -e "${HOME}/www/updates/" ]; then
  39. for updatedir in `ls -1 src/com/dmdirc/config/defaults/`; do
  40. src="${HOME}/www/updates/${updatedir}"
  41. if [ -e ${src} ]; then
  42. REVERTLIST=${REVERTLIST}" src/com/dmdirc/config/defaults/${updatedir}/"
  43. cp -Rfv ${src}/* src/com/dmdirc/config/defaults/${updatedir}/
  44. fi;
  45. done
  46. fi;
  47. # Build plugins/jar
  48. $ANT -Dchannel=NIGHTLY -k clean jar
  49. # Now revert the trunk so as not to break updates.
  50. for updatedir in ${REVERTLIST}; do
  51. ${SVN} revert ${updatedir}/*
  52. done;
  53. PHP=`which php`
  54. if [ "${BAMBOO_INSTALL}" != "" -a -e "${BAMBOO}" ]; then
  55. export BAMBOO_DIR=${BAMBOO};
  56. export BAMBOO_BUILD=`ls -cr1 ${BAMBOO} | tail -n 1 | awk -F. '{print $1}'`
  57. echo "This is Bamboo build "${BAMBOO_BUILD};
  58. fi
  59. # Check if build failed
  60. if [ ! -e "$MYDIR/dist/DMDirc.jar" ]; then
  61. # Report failure
  62. echo "Build Failure."
  63. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  64. $PHP -q $SCRIPTDIR/nightly-failure.php
  65. fi
  66. else
  67. # Build installers
  68. # Delete all automatically added plugins from the jar to allow the installer
  69. # to add its own on a per-os basis
  70. unzip -l ${MYDIR}/dist/DMDirc.jar | grep " plugins/" | tr -s ' ' | cut -d ' ' -f 5- | xargs zip ${MYDIR}/dist/DMDirc.jar -d
  71. cd "${MYDIR}/installer"
  72. ./release.sh --jar "${MYDIR}/dist/DMDirc.jar" --opt "--extra ${FILEDATA}" trunk
  73. cd "${MYDIR}"
  74. 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
  75. # Report failure
  76. echo "Installer Build Failure."
  77. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  78. export DMDIRC_INSTALLERFAILURE=true;
  79. export BAMBOO_BUILD;
  80. $PHP -q $SCRIPTDIR/nightly-failure.php
  81. fi
  82. fi;
  83. # Re-Add all plugins to the jar so that the nightly .jar has everything.
  84. $JAR -uvf "dist/DMDirc.jar" plugins
  85. # Submit plugins to addons site
  86. if [ -e "${HOME}/www/addons/submitplugin.php" ]; then
  87. for plugin in `ls plugins/*.jar`; do
  88. $PHP ${HOME}/www/addons/submitplugin.php $plugin
  89. done;
  90. fi;
  91. # Move installers/jar to nightlies site
  92. FILENAME=DMDirc_${FILEDATA}.jar
  93. mv "installer/output/DMDirc-Setup-${FILEDATA}.exe" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe"
  94. mv "installer/output/DMDirc-Setup-${FILEDATA}.run" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run"
  95. mv "installer/output/DMDirc-${FILEDATA}.dmg" "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg"
  96. rm -Rf "installer/output/DMDirc-${FILEDATA}.jar"
  97. cp dist/DMDirc.jar /home/dmdirc/www/nightly/$FILENAME
  98. if [ -e "${WWWDIR}/nightly/${FILENAME}" ]; then
  99. ln -sf ${WWWDIR}/nightly/${FILENAME} $WWWDIR/nightly/DMDirc_latest.jar
  100. fi;
  101. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" ]; then
  102. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" $WWWDIR/nightly/DMDirc-Setup_latest.run
  103. fi;
  104. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" ]; then
  105. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" $WWWDIR/nightly/DMDirc-Setup_latest.exe
  106. fi;
  107. if [ -e "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" ]; then
  108. ln -sf "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" $WWWDIR/nightly/DMDirc_latest.dmg
  109. fi;
  110. # Do normal reports
  111. if [ "${IS_BAMBOO}" == "" ]; then
  112. /bin/sh $MYDIR/DoReports.sh
  113. fi;
  114. fi
  115. $SVN revert src/com/dmdirc/Main.java