Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

makeJar.sh 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. #!/bin/sh
  2. #
  3. # This script generates a jar file for a release version of DMDirc
  4. #
  5. # DMDirc - Open Source IRC Client
  6. # Copyright (c) 2006-2008 Chris Smith, Shane Mc Cormack, Gregory Holmes
  7. #
  8. # Permission is hereby granted, free of charge, to any person obtaining a copy
  9. # of this software and associated documentation files (the "Software"), to deal
  10. # in the Software without restriction, including without limitation the rights
  11. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. # copies of the Software, and to permit persons to whom the Software is
  13. # furnished to do so, subject to the following conditions:
  14. #
  15. # The above copyright notice and this permission notice shall be included in
  16. # all copies or substantial portions of the Software.
  17. #
  18. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  24. # SOFTWARE.
  25. # Final Name of the file (without file extention)
  26. FILENAME=DMDirc
  27. # full name of the file to output to
  28. RUNNAME="${PWD}/${FILENAME}.jar"
  29. # Go!
  30. echo "-----------"
  31. if [ -e "${RUNNAME}" ]; then
  32. echo "Removing existing file"
  33. rm -Rf ${RUNNAME}
  34. fi
  35. showHelp() {
  36. echo "This will generate a DMDirc jar file for any system with java on it."
  37. echo "The following command line arguments are known:"
  38. echo "---------------------"
  39. echo "-h, --help Help information"
  40. echo "-r, --release <version> Generate a file based on an svn tag (or branch with -b aswell)"
  41. echo "-b, --branch Release in -r is a branch "
  42. echo "-p, --plugins <plugins> What plugins to add to the jar file"
  43. echo "-c, --compile Recompile the .jar file (otherwise use the existing file from dist/)"
  44. echo " --jar <file> use <file> as DMDirc.jar (ie just add the plugins to it and rename)"
  45. echo " --current Use the current folder as the base for the build"
  46. echo "-t, --tag <tag> Tag to add to final name to distinguish this build from a standard build"
  47. echo "-k, --keep Keep the existing source tree when compiling"
  48. echo " (don't svn update beforehand)"
  49. echo "---------------------"
  50. exit 0;
  51. }
  52. # Check for some CLI params
  53. compileJar="false"
  54. updateSVN="true"
  55. isRelease=""
  56. finalTag=""
  57. BRANCH="0"
  58. plugins=""
  59. location="../../../"
  60. jarfile=""
  61. current=""
  62. jre=""
  63. jrename="jre" # Filename for JRE without the .bin
  64. while test -n "$1"; do
  65. case "$1" in
  66. --plugins|-p)
  67. shift
  68. plugins=${1}
  69. ;;
  70. --jar)
  71. shift
  72. jarfile=${1}
  73. ;;
  74. --current)
  75. location="../../"
  76. current="1"
  77. ;;
  78. --compile|-c)
  79. compileJar="true"
  80. ;;
  81. --release|-r)
  82. shift
  83. isRelease=${1}
  84. ;;
  85. --tag|-t)
  86. shift
  87. finalTag=${1}
  88. RUNNAME="${PWD}/${FILENAME}-${1}.jar"
  89. ;;
  90. --keep|-k)
  91. updateSVN="false"
  92. ;;
  93. --help|-h)
  94. showHelp;
  95. ;;
  96. --branch|-b)
  97. BRANCH="1"
  98. ;;
  99. esac
  100. shift
  101. done
  102. if [ "" = "${current}" ]; then
  103. jarPath="${location}trunk"
  104. else
  105. jarPath="${location}"
  106. fi
  107. if [ "${isRelease}" != "" ]; then
  108. if [ "${BRANCH}" != "0" ]; then
  109. if [ -e "${location}/${isRelease}" ]; then
  110. jarPath="${location}/${isRelease}"
  111. else
  112. echo "Branch "${isRelease}" not found."
  113. exit 1;
  114. fi
  115. else
  116. if [ -e "${location}/${isRelease}" ]; then
  117. jarPath="${location}/${isRelease}"
  118. else
  119. echo "Tag "${isRelease}" not found."
  120. exit 1;
  121. fi
  122. fi
  123. fi
  124. if [ "" = "${jarfile}" ]; then
  125. jarfile=${jarPath}"/dist/DMDirc.jar"
  126. if [ ! -e ${jarPath}"/dist/DMDirc.jar" -o "${compileJar}" = "true" ]; then
  127. echo "Creating jar.."
  128. OLDPWD=${PWD}
  129. cd ${jarPath}
  130. if [ "${updateSVN}" = "true" ]; then
  131. svn update
  132. fi
  133. ant clean jar
  134. if [ ! -e "dist/DMDirc.jar" ]; then
  135. echo "There was an error creating the .jar file. Aborting."
  136. exit 1;
  137. fi;
  138. cd ${OLDPWD}
  139. fi;
  140. elif [ ! -e "${jarfile}" ]; then
  141. echo "Requested Jar file (${jarfile}) does not exist."
  142. exit 1;
  143. fi;
  144. echo "Copying jar (${jarfile}).."
  145. cp ${jarfile} ${RUNNAME}
  146. echo "Adding plugins to jar"
  147. ln -sf ${jarPath}"/plugins"
  148. pluginList=""
  149. for plugin in ${plugins}; do
  150. pluginList=${pluginList}" plugins/${plugin}"
  151. done
  152. jar -uvf "${RUNNAME}" ${pluginList}
  153. rm -Rf plugins;
  154. if [ "${isRelease}" != "" ]; then
  155. if [ "${BRANCH}" = "1" ]; then
  156. isRelease=branch-${isRelease}
  157. fi;
  158. if [ "" != "${finalTag}" ]; then
  159. finalTag="-${finalTag}"
  160. fi;
  161. finalname=DMDirc-${isRelease}${finalTag}.jar
  162. else
  163. finalname=${RUNNAME##*/}
  164. fi;
  165. mv ${RUNNAME} ../output/${finalname}
  166. echo "-----------"
  167. echo "Done."
  168. echo "-----------"
  169. # and Done \o
  170. exit 0;