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

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