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.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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-2011 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 "-p, --plugins <plugins> What plugins to add to the jar file"
  41. echo "-c, --compile Recompile the .jar file (otherwise use the existing file from dist/)"
  42. echo " --jar <file> use <file> as DMDirc.jar (ie just add the plugins to it and rename)"
  43. echo " --current Use the current folder as the base for the build"
  44. echo "-e, --extra <tag> Tag to add to final name to distinguish this build from a standard build"
  45. echo " --channel [channel] Channel to pass to ant (if not passed, 'NONE', if passed without a value, 'STABLE')"
  46. echo "---------------------"
  47. exit 0;
  48. }
  49. # Check for some CLI params
  50. compileJar="false"
  51. isRelease=""
  52. finalTag=""
  53. BRANCH="0"
  54. plugins=""
  55. location="../../"
  56. current="1"
  57. jarfile=""
  58. jre=""
  59. jrename="jre" # Filename for JRE without the .bin
  60. TAGGED=""
  61. CHANNEL="NONE"
  62. while test -n "$1"; do
  63. case "$1" in
  64. --plugins|-p)
  65. shift
  66. plugins=${1}
  67. ;;
  68. --jar)
  69. shift
  70. jarfile=${1}
  71. ;;
  72. --current)
  73. location="../../"
  74. current="1"
  75. ;;
  76. --compile|-c)
  77. compileJar="true"
  78. ;;
  79. --release|-r)
  80. shift
  81. isRelease=${1}
  82. ;;
  83. --extra|-e)
  84. shift
  85. finalTag=${1}
  86. RUNNAME="${PWD}/${FILENAME}-${1}.jar"
  87. ;;
  88. --help|-h)
  89. showHelp;
  90. ;;
  91. --branch|-b)
  92. BRANCH="1"
  93. ;;
  94. --tag|-t)
  95. TAGGED=`git describe --tags`
  96. TAGGED=${TAGGED%%-*}
  97. ;;
  98. --channel)
  99. PASSEDPARAM=`echo "${2}" | grep -v ^-`
  100. if [ "${PASSEDPARAM}" != "" ]; then
  101. shift
  102. CHANNEL=${PASSEDPARAM};
  103. else
  104. CHANNEL="STABLE";
  105. fi;
  106. ;;
  107. esac
  108. shift
  109. done
  110. if [ "" = "${current}" ]; then
  111. jarPath="${location}trunk"
  112. else
  113. jarPath="${location}"
  114. fi
  115. if [ "" = "${jarfile}" ]; then
  116. jarfile=${jarPath}"/dist/DMDirc.jar"
  117. if [ ! -e ${jarPath}"/dist/DMDirc.jar" -o "${compileJar}" = "true" ]; then
  118. echo "Creating jar.."
  119. OLDPWD=${PWD}
  120. cd ${jarPath}
  121. ant -Dchannel=${CHANNEL} clean jar
  122. if [ ! -e "dist/DMDirc.jar" ]; then
  123. echo "There was an error creating the .jar file. Aborting."
  124. exit 1;
  125. fi;
  126. cd ${OLDPWD}
  127. fi;
  128. elif [ ! -e "${jarfile}" ]; then
  129. echo "Requested Jar file (${jarfile}) does not exist."
  130. exit 1;
  131. fi;
  132. echo "Copying jar (${jarfile} -> ${RUNNAME}).."
  133. cp ${jarfile} ${RUNNAME}
  134. # Remove plugins added by createAllPluginJar
  135. zip -d ${RUNNAME} plugins plugins/*
  136. if [ "${plugins}" != "" ]; then
  137. echo "Adding plugins to jar"
  138. ln -sf ${jarPath}"/plugins"
  139. pluginList=""
  140. for plugin in ${plugins}; do
  141. pluginList=${pluginList}" plugins/${plugin}"
  142. done
  143. jar -uvf "${RUNNAME}" ${pluginList}
  144. ../../updateBundledPlugins.sh ${RUNNAME};
  145. rm -Rf plugins;
  146. fi;
  147. doRename=0
  148. if [ "${TAGGED}" != "" ]; then
  149. doRename=1
  150. fi;
  151. if [ ${doRename} -eq 1 ]; then
  152. if [ "${TAGGED}" = "" ]; then
  153. isRelease=branch-${isRelease}
  154. else
  155. isRelease=${TAGGED}
  156. fi;
  157. if [ "" != "${finalTag}" ]; then
  158. finalTag="-${finalTag}"
  159. fi;
  160. finalname=DMDirc-${isRelease}${finalTag}.jar
  161. else
  162. finalname=${RUNNAME##*/}
  163. fi;
  164. mv ${RUNNAME} ../output/${finalname}
  165. echo "-----------"
  166. echo "Done."
  167. echo "-----------"
  168. # and Done \o
  169. exit 0;