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.

release.sh 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. #!/bin/sh
  2. # Jar names of plugins to add to ALL installers. (* means all)
  3. plugins="dcc.jar dns.jar identd.jar lagdisplay.jar logging.jar systray.jar timeplugin.jar osdplugin.jar"
  4. # Additional Jar names of plugins to add to only Windows installers. (* means all)
  5. plugins_windows=""
  6. # Additional Jar names of plugins to add to only linux installers. (* means all)
  7. plugins_linux=""
  8. # Additional Jar names of plugins to add to only osx installers. (* means all)
  9. plugins_osx=""
  10. showHelp() {
  11. echo "This will generate the different DMDirc installers."
  12. echo "Usage: ${0} [params] <release>"
  13. echo "Release can be either 'trunk', 'this', a valid tag, or a branch (if -b is passed)"
  14. echo "The following params are known:"
  15. echo "---------------------"
  16. echo "-b, --branch <release> is a branch"
  17. echo " --jar <file> Use <file> instead of compiling a jar."
  18. echo " --fulljar <file> Use <file> instead of compiling a jar, and don't run makeJar on it."
  19. echo " --jre Include a jre in the installers."
  20. echo " --jre64 Include a 64bit jre in the installers."
  21. echo " --target <target> Build only a specific target. <target> should be one of 'windows', 'linux' or 'osx'."
  22. echo "-p, --plugins <plugins> Plugins to add to all the jars."
  23. echo "-pl, --plugins-linux <plugins> Plugins to linux installer."
  24. echo "-pw, --plugins-windows <plugins> Plugins to windows installer."
  25. echo "-po --plugins-osx <plugins> Plugins to osx installer."
  26. echo "-h, --help Help information"
  27. echo "-o, --opt <options> Additional options to pass to the make*Installer.sh files"
  28. echo " --upload Try to upload to google code when done (Only works on tags)"
  29. echo "---------------------"
  30. exit 0;
  31. }
  32. # Check for some CLI params
  33. LAST=""
  34. OPT=""
  35. BRANCH=""
  36. JARFILE=""
  37. JRE=""
  38. FULLJAR=""
  39. BUILDTARGET=""
  40. UPLOAD="0"
  41. TAG="0"
  42. while test -n "$1"; do
  43. LAST=${1}
  44. case "$1" in
  45. --plugins|-p)
  46. shift
  47. plugins="${1}"
  48. ;;
  49. --target)
  50. shift
  51. BUILDTARGET="${1}"
  52. ;;
  53. --jar)
  54. shift
  55. JARFILE="--jar ${1} "
  56. ;;
  57. --fulljar)
  58. shift
  59. JARFILE="--jar ${1} "
  60. FULLJAR="1"
  61. ;;
  62. --jre|--jre64)
  63. JRE="${1} "
  64. ;;
  65. --plugins-linux|-pl)
  66. shift
  67. plugins_linux="${1}"
  68. ;;
  69. --plugins-windows|-pw)
  70. shift
  71. plugins_windows="${1}"
  72. ;;
  73. --plugins-osx|-po)
  74. shift
  75. plugins_osx="${1}"
  76. ;;
  77. --opt|-o)
  78. shift
  79. OPT="${1} "
  80. ;;
  81. --help|-h)
  82. showHelp;
  83. ;;
  84. --upload)
  85. UPLOAD="1";
  86. ;;
  87. --branch|-b)
  88. BRANCH="-b "
  89. ;;
  90. esac
  91. shift
  92. done
  93. if [ "${plugins}" = "*" -o "${plugins_linux}" = "*" -o "${plugins_windows}" = "*" -o "${plugins_osx}" = "*" ]; then
  94. echo "Something is all.";
  95. allPlugins=""
  96. for thisfile in `ls -1 ../plugins/*.jar`; do
  97. allPlugins=${allPlugins}" ${thisfile##*/}"
  98. done
  99. if [ "${plugins}" = "*" ]; then plugins=${allPlugins}; fi
  100. if [ "${plugins_linux}" = "*" ]; then plugins_linux=${allPlugins}; fi
  101. if [ "${plugins_windows}" = "*" ]; then plugins_windows=${allPlugins}; fi
  102. if [ "${plugins_osx}" = "*" ]; then plugins_osx=${allPlugins}; fi
  103. fi;
  104. VERSION=""
  105. if [ "${LAST}" != "" ]; then
  106. if [ "${LAST}" = "trunk" ]; then
  107. VERSION="Trunk"
  108. RELEASE=""
  109. elif [ "${LAST}" = "this" ]; then
  110. # Work out what type of build this is!
  111. thisDIR=${PWD}
  112. cd ..
  113. tempDIR=${PWD##*/}
  114. if [ "${tempDIR}" = "trunk" ]; then
  115. VERSION="Trunk"
  116. echo "This is a trunk release.";
  117. else
  118. echo "This is not a trunk release.";
  119. VERSION=${tempDIR}
  120. cd ..
  121. tempDIR=${PWD##*/}
  122. if [ "${tempDIR}" = "tags" ]; then
  123. echo "Release of tag "${version}
  124. RELEASE="-r "${VERSION}
  125. TAG="1"
  126. elif [ "${tempDIR}" = "branches" ]; then
  127. echo "Release of branch "${version}
  128. BRANCH="-b "
  129. RELEASE="-r "${VERSION}
  130. else
  131. VERSION="Unknown"
  132. echo "Unknown release target - Building as trunk build"
  133. OPT="--current ${OPT}"
  134. fi
  135. fi;
  136. cd ${thisDIR}
  137. elif [ "${BRANCH}" != "" -a ! -e "../../branches/"${LAST} ]; then
  138. echo "Branch '"${LAST}"' not found."
  139. exit 1;
  140. elif [ "${BRANCH}" = "" -a ! -e "../../tags/"${LAST} ]; then
  141. echo "Tag '"${LAST}"' not found."
  142. exit 1;
  143. else
  144. RELEASE="-r "${LAST}
  145. fi
  146. else
  147. echo "Usage: ${0} [params] <release>"
  148. echo "Release can be either 'this', 'trunk' or a valid tag. (see ${0} --help for further information)"
  149. exit 1;
  150. fi
  151. JAR=`which jar`
  152. JAVAC=`which javac`
  153. # OSX Users might have a non 1.6 javac, look specifically for it.
  154. if [ -e "/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/javac" ]; then
  155. JAVAC="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/javac"
  156. elif [ -e "/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/javac" ]; then
  157. JAVAC="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/javac"
  158. fi;
  159. THISDIR=${PWD}
  160. echo "================================================================"
  161. echo "Removing existing releases from output directory"
  162. echo "================================================================"
  163. rm -Rf output/*.run output/*.exe output/*.dmg
  164. # Copy default settings from www to trunk for compile (if they exist, and we are
  165. # building a new jar)
  166. REVERTLIST=""
  167. if [ "" = "${JARFILE}" ]; then
  168. if [ -e "${HOME}/www/updates/" ]; then
  169. echo "================================================================"
  170. echo "Applying settings update to this source"
  171. echo "================================================================"
  172. for updatedir in `ls -1 ../src/com/dmdirc/config/defaults/`; do
  173. src="${HOME}/www/updates/${updatedir}"
  174. if [ -e ${src} ]; then
  175. REVERTLIST=${REVERTLIST}" ../src/com/dmdirc/config/defaults/${updatedir}/"
  176. cp -Rfv ${src}/* ../src/com/dmdirc/config/defaults/${updatedir}/
  177. fi;
  178. done
  179. fi;
  180. fi;
  181. if [ "" = "${FULLJAR}" ]; then
  182. echo "================================================================"
  183. echo "Building Release Jar"
  184. echo "================================================================"
  185. cd jar
  186. ./makeJar.sh ${OPT}${JARFILE}${JRE}-c -k -s ${BRANCH}${RELEASE} -p "${plugins}"
  187. RESULT=${?}
  188. cd ${THISDIR}
  189. if [ ${RESULT} -eq 0 ]; then
  190. JARNAME=`ls -1tr output | grep jar$ | tail -n 1`
  191. JARFILE="--jar ../output/${JARNAME} "
  192. else
  193. echo "Failed to build release jar, aborting."
  194. exit 1;
  195. fi;
  196. fi;
  197. if [ "linux" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
  198. echo "================================================================"
  199. echo "Building linux installer"
  200. echo "================================================================"
  201. cd linux
  202. ./makeInstallerLinux.sh ${OPT}${JARFILE}${JRE}-k ${BRANCH}${RELEASE} -p "${plugins_linux}"
  203. cd ${THISDIR}
  204. fi;
  205. if [ "windows" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
  206. echo "================================================================"
  207. echo "Building Windows installer"
  208. echo "================================================================"
  209. cd windows
  210. ./makeInstallerWindows.sh ${OPT}${JARFILE}${JRE}-k -s ${BRANCH}${RELEASE} -p "${plugins_windows}"
  211. cd ${THISDIR}
  212. fi;
  213. if [ "osx" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
  214. echo "================================================================"
  215. echo "Building OSX Bundle"
  216. echo "================================================================"
  217. cd osx
  218. ./makeInstallerOSX.sh ${OPT}${JARFILE}-k -s ${BRANCH}${RELEASE} -p "${plugins_osx}"
  219. cd ${THISDIR}
  220. fi;
  221. echo "================================================================"
  222. echo "Clean Up"
  223. echo "================================================================"
  224. # Now revert the trunk so as not to break updates.
  225. for updatedir in ${REVERTLIST}; do
  226. SVN=`which svn`
  227. ${SVN} revert ${updatedir}/*
  228. done;
  229. if [ "1" = "${UPLOAD}" -a "1" = "${TAG}" ]; then
  230. echo "================================================================"
  231. echo "Uploading to GoogleCode"
  232. echo "================================================================"
  233. cd gcode
  234. sh uploads_release.sh -v ${VERSION}
  235. else
  236. echo "Not uploading to GoogleCode"
  237. fi;
  238. echo "================================================================"
  239. echo "Release ready - see output folder"
  240. echo "================================================================"
  241. exit 0;