選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

BuildAll.sh 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. # Substitute the version string
  26. awk '{gsub(/String VERSION = "SVN"/,"String VERSION = \"Nightly - SVN Rev: '${SVNREV}'\"");print}' src/com/dmdirc/Main.java > src/com/dmdirc/Main.java.tmp
  27. mv src/com/dmdirc/Main.java.tmp src/com/dmdirc/Main.java
  28. # Substitute the update channel
  29. awk '{gsub(/UpdateChannel UPDATE_CHANNEL = UpdateChannel.NONE/,"UpdateChannel UPDATE_CHANNEL = UpdateChannel.NIGHTLY");print}' src/com/dmdirc/Main.java > src/com/dmdirc/Main.java.tmp
  30. mv src/com/dmdirc/Main.java.tmp src/com/dmdirc/Main.java
  31. # Archive old nightlies
  32. if [ `date +%d` = "01" ]; then
  33. echo "Archiving Last Months 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/svn prefix to add to the end of the file names of stuff
  41. FILEDATA=`date +%Y%m%d`_${SVNREV}
  42. # Copy default settings from www to trunk for compile (if they exist)
  43. REVERTLIST=""
  44. if [ -e "${HOME}/www/updates/" ]; then
  45. for updatedir in `ls -1 src/com/dmdirc/config/defaults/`; do
  46. src="${HOME}/www/updates/${updatedir}"
  47. if [ -e ${src} ]; then
  48. REVERTLIST=${REVERTLIST}" src/com/dmdirc/config/defaults/${updatedir}/"
  49. cp -Rfv ${src}/* src/com/dmdirc/config/defaults/${updatedir}/
  50. fi;
  51. done
  52. fi;
  53. # Build plugins/jar
  54. $ANT -k clean jar
  55. # Now revert the trunk so as not to break updates.
  56. for updatedir in ${REVERTLIST}; do
  57. ${SVN} revert ${updatedir}/*
  58. done;
  59. PHP=`which php`
  60. if [ "${BAMBOO_INSTALL}" != "" -a -e "${BAMBOO}" ]; then
  61. export BAMBOO_DIR=${BAMBOO};
  62. export BAMBOO_BUILD=`ls -cr1 ${BAMBOO} | tail -n 1 | awk -F. '{print $1}'`
  63. echo "This is Bamboo build "${BAMBOO_BUILD};
  64. fi
  65. # Check if build failed
  66. if [ ! -e "$MYDIR/dist/DMDirc.jar" ]; then
  67. # Report failure
  68. echo "Build Failure."
  69. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  70. $PHP -q $SCRIPTDIR/nightly-failure.php
  71. fi
  72. else
  73. # Build installers
  74. cd "${MYDIR}/installer"
  75. ./release.sh --jar "${MYDIR}/dist/DMDirc.jar" --opt "--tag ${FILEDATA}" trunk
  76. cd "${MYDIR}"
  77. 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
  78. # Report failure
  79. echo "Installer Build Failure."
  80. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  81. export DMDIRC_INSTALLERFAILURE=true;
  82. export BAMBOO_BUILD;
  83. $PHP -q $SCRIPTDIR/nightly-failure.php
  84. fi
  85. fi;
  86. # Add plugins to jar
  87. $JAR -uvf "dist/DMDirc.jar" plugins
  88. # Submit plugins to addons site
  89. if [ -e "${HOME}/www/addons/submitplugin.php" ]; then
  90. for plugin in `ls plugins/*.jar`; do
  91. $PHP ${HOME}/www/addons/submitplugin.php $plugin
  92. done;
  93. fi;
  94. # Move installers/jar to nightlies site
  95. FILENAME=DMDirc_${FILEDATA}.jar
  96. mv "installer/output/DMDirc-Setup-${FILEDATA}.exe" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe"
  97. mv "installer/output/DMDirc-Setup-${FILEDATA}.run" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run"
  98. mv "installer/output/DMDirc-${FILEDATA}.dmg" "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg"
  99. rm -Rf "installer/output/DMDirc-${FILEDATA}.jar"
  100. cp dist/DMDirc.jar /home/dmdirc/www/nightly/$FILENAME
  101. if [ -e "${WWWDIR}/nightly/${FILENAME}" ]; then
  102. ln -sf ${WWWDIR}/nightly/${FILENAME} $WWWDIR/nightly/DMDirc_latest.jar
  103. fi;
  104. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" ]; then
  105. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" $WWWDIR/nightly/DMDirc-Setup_latest.run
  106. fi;
  107. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" ]; then
  108. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" $WWWDIR/nightly/DMDirc-Setup_latest.exe
  109. fi;
  110. if [ -e "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" ]; then
  111. ln -sf "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" $WWWDIR/nightly/DMDirc_latest.dmg
  112. fi;
  113. # Do normal reports
  114. if [ "${IS_BAMBOO}" == "" ]; then
  115. /bin/sh $MYDIR/DoReports.sh
  116. fi;
  117. fi
  118. $SVN revert src/com/dmdirc/Main.java