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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. #!/bin/sh
  2. # Jar names of plugins to add to ALL installers. (* means all)
  3. plugins="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. # OSX doesn't use the installer
  165. # and neither does anything else now,
  166. #if [ "osx" != "${BUILDTARGET}" ]; then
  167. # echo "================================================================"
  168. # echo "Building Installer JAR "
  169. # echo "================================================================"
  170. # mkdir -p installer_temp/build
  171. # cd installer_temp
  172. # ln -sf ../../src/com
  173. # ln -sf ../../src/net
  174. # # I don't know why, but -d doesn't nicely put ALL generated class files here,
  175. # # just those that were in the dir of the java file that was requested for compile
  176. # # So we specify each of the different ones we want built into the jar file here.
  177. # FILELIST="com/dmdirc/installer/*.java"
  178. # FILELIST=${FILELIST}" com/dmdirc/installer/cliparser/*.java"
  179. # FILELIST=${FILELIST}" com/dmdirc/ui/swing/dialogs/wizard/*.java"
  180. # FILELIST=${FILELIST}" com/dmdirc/ui/interfaces/MainWindow.java"
  181. # FILELIST=${FILELIST}" com/dmdirc/ui/swing/MainFrame.java"
  182. # FILELIST=${FILELIST}" com/dmdirc/ui/swing/UIUtilities.java"
  183. # FILELIST=${FILELIST}" com/dmdirc/ui/swing/UIUtilities.java"
  184. # FILELIST=${FILELIST}" com/dmdirc/ui/swing/components/StandardDialog.java"
  185. # FILELIST=${FILELIST}" com/dmdirc/util/ListenerList.java"
  186. # FILELIST=${FILELIST}" com/dmdirc/util/WeakMapList.java"
  187. # FILELIST=${FILELIST}" com/dmdirc/util/MapList.java"
  188. # FILELIST=${FILELIST}" com/dmdirc/ui/swing/components/EtchedLineBorder.java"
  189. # FILELIST=${FILELIST}" com/dmdirc/util/EquatableWeakReference.java"
  190. # FILELIST=${FILELIST}" com/dmdirc/ui/swing/components/JWrappingLabel.java"
  191. # FILELIST=${FILELIST}" com/dmdirc/util/WeakList.java"
  192. # FILELIST=${FILELIST}" net/miginfocom/layout/*.java"
  193. # FILELIST=${FILELIST}" net/miginfocom/swing/*.java"
  194. #
  195. # ${JAVAC} -d ./build ${FILELIST}
  196. #
  197. # if [ $? -ne 0 ]; then
  198. # echo "================================================================"
  199. # echo "Building installer failed."
  200. # echo "================================================================"
  201. # cd ${THISDIR}
  202. # rm -Rf installer_temp
  203. # exit 1;
  204. # fi
  205. #
  206. # cd build
  207. # echo "Manifest-Version: 1.0" > manifest.txt
  208. # echo "Created-By: DMDirc Installer" >> manifest.txt
  209. # echo "Main-Class: com.dmdirc.installer.Main" >> manifest.txt
  210. # echo "Class-Path: " >> manifest.txt
  211. # echo "" >> manifest.txt
  212. # ${JAR} cmf manifest.txt installer.jar com net
  213. # if [ $? -ne 0 ]; then
  214. # echo "================================================================"
  215. # echo "Building installer failed."
  216. # echo "================================================================"
  217. # cd ${THISDIR}
  218. # rm -Rf installer_temp
  219. # exit 1;
  220. # else
  221. # rm -Rf ${THISDIR}/common/installer.jar
  222. # mv installer.jar ${THISDIR}/common/installer.jar
  223. # fi
  224. #
  225. # cd ${THISDIR}
  226. # rm -Rf installer_temp
  227. #fi;
  228. # Copy default settings from www to trunk for compile (if they exist, and we are
  229. # building a new jar)
  230. REVERTLIST=""
  231. if [ "" = "${JARFILE}" ]; then
  232. if [ -e "${HOME}/www/updates/" ]; then
  233. echo "================================================================"
  234. echo "Applying settings update to this source"
  235. echo "================================================================"
  236. for updatedir in `ls -1 ../src/com/dmdirc/config/defaults/`; do
  237. src="${HOME}/www/updates/${updatedir}"
  238. if [ -e ${src} ]; then
  239. REVERTLIST=${REVERTLIST}" ../src/com/dmdirc/config/defaults/${updatedir}/"
  240. cp -Rfv ${src}/* ../src/com/dmdirc/config/defaults/${updatedir}/
  241. fi;
  242. done
  243. fi;
  244. fi;
  245. if [ "" = "${FULLJAR}" ]; then
  246. echo "================================================================"
  247. echo "Building Release Jar"
  248. echo "================================================================"
  249. cd jar
  250. ./makeJar.sh ${OPT}${JARFILE}${JRE}-c -k -s ${BRANCH}${RELEASE} -p "${plugins}"
  251. RESULT=${?}
  252. cd ${THISDIR}
  253. if [ ${RESULT} -eq 0 ]; then
  254. JARNAME=`ls -1tr output | grep jar$ | tail -n 1`
  255. JARFILE="--jar ../output/${JARNAME} "
  256. else
  257. echo "Failed to build release jar, aborting."
  258. exit 1;
  259. fi;
  260. fi;
  261. if [ "linux" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
  262. echo "================================================================"
  263. echo "Building linux installer"
  264. echo "================================================================"
  265. cd linux
  266. ./makeInstallerLinux.sh ${OPT}${JARFILE}${JRE}-k ${BRANCH}${RELEASE} -p "${plugins_linux}"
  267. cd ${THISDIR}
  268. fi;
  269. if [ "windows" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
  270. echo "================================================================"
  271. echo "Building Windows installer"
  272. echo "================================================================"
  273. cd windows
  274. ./makeInstallerWindows.sh ${OPT}${JARFILE}${JRE}-k -s ${BRANCH}${RELEASE} -p "${plugins_windows}"
  275. cd ${THISDIR}
  276. fi;
  277. if [ "osx" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
  278. echo "================================================================"
  279. echo "Building OSX Bundle"
  280. echo "================================================================"
  281. cd osx
  282. ./makeInstallerOSX.sh ${OPT}${JARFILE}-k -s ${BRANCH}${RELEASE} -p "${plugins_osx}"
  283. cd ${THISDIR}
  284. fi;
  285. #MD5BIN=`which md5sum`
  286. #if [ "${MD5BIN}" != "" ]; then
  287. # echo "================================================================"
  288. # echo "Creating MD5SUM files"
  289. # echo "================================================================"
  290. # cd output
  291. # for outputFile in *; do
  292. # if [ "${outputFile##*.}" != "md5" ]; then
  293. # if [ -e "${outputFile}.md5" ]; then
  294. # rm -f "${outputFile}.md5"
  295. # fi
  296. # ${MD5BIN} "${outputFile}" > "${outputFile}.md5"
  297. # fi
  298. # done
  299. # cd ${THISDIR}
  300. #fi
  301. echo "================================================================"
  302. echo "Clean Up"
  303. echo "================================================================"
  304. # Now revert the trunk so as not to break updates.
  305. for updatedir in ${REVERTLIST}; do
  306. SVN=`which svn`
  307. ${SVN} revert ${updatedir}/*
  308. done;
  309. if [ "1" = "${UPLOAD}" && "1" = "${TAG}" ]; then
  310. echo "================================================================"
  311. echo "Uploading to GoogleCode"
  312. echo "================================================================"
  313. cd gcode
  314. sh uploads_release.sh -v ${VERSION}
  315. else
  316. echo "Not uploading to GoogleCode"
  317. fi;
  318. echo "================================================================"
  319. echo "Release ready - see output folder"
  320. echo "================================================================"
  321. exit 0;