build.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="L2J_Server" default="dist" basedir=".">
  3. <description>
  4. This script will build the L2J server.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  16. 02111-1307, USA.
  17. http://www.gnu.org/copyleft/gpl.html
  18. </description>
  19. <property name="src" location="java"/>
  20. <property name="lib" location="lib"/>
  21. <property name="build" location="build"/>
  22. <property name="build.classes" location="${build}/classes"/>
  23. <property name="build.dist" location="${build}/dist"/>
  24. <property name="build.dist.login" location="${build.dist}/login"/>
  25. <property name="build.dist.game" location="${build.dist}/gameserver"/>
  26. <path id="classpath">
  27. <fileset dir="${lib}">
  28. <include name="c3p0-0.9.1.jar"/>
  29. <include name="bsf.jar"/>
  30. <include name="bsh-2.0b4.jar"/>
  31. <include name="commons-logging-1.1.jar"/>
  32. <include name="jython.jar"/>
  33. <include name="javolution.jar"/>
  34. <include name="mysql-connector-java-5.0.4-bin.jar"/>
  35. </fileset>
  36. </path>
  37. <target name="init"
  38. depends="clean"
  39. description="Create the output directories.">
  40. <mkdir dir="${build}"/>
  41. <mkdir dir="${build.classes}"/>
  42. <mkdir dir="${build.dist}" />
  43. <mkdir dir="${build.dist.login}" />
  44. <mkdir dir="${build.dist.game}" />
  45. </target>
  46. <target name="compile"
  47. depends="version"
  48. description="Compile the source.">
  49. <javac destdir="${build.classes}"
  50. optimize="on"
  51. debug="on"
  52. source="1.5"
  53. target="1.5"
  54. nowarn="off">
  55. <src path="${src}"/>
  56. <classpath refid="classpath"/>
  57. </javac>
  58. </target>
  59. <target name="jar"
  60. depends="compile"
  61. description="Create the jar file">
  62. <jar destfile="${build}/l2jserver.jar">
  63. <fileset dir="${build.classes}"/>
  64. <manifest>
  65. <attribute name="Main-Class" value="net.sf.l2j.Server"/>
  66. <attribute name="Class-Path" value=". bsf.jar bsh-2.0b4.jar commons-logging-1.1.jar c3p0-0.9.1.jar jython.jar mysql-connector-java-5.0.4-bin.jar javolution.jar"/>
  67. </manifest>
  68. </jar>
  69. <copy todir="${build.dist.login}">
  70. <fileset dir="${build}">
  71. <include name="l2jserver.jar"/>
  72. </fileset>
  73. </copy>
  74. <copy todir="${build.dist.game}">
  75. <fileset dir="${build}">
  76. <include name="l2jserver.jar"/>
  77. </fileset>
  78. </copy>
  79. </target>
  80. <target name="compile.gcj"
  81. depends="jar"
  82. description="Build machine executable binary">
  83. <exec dir="." executable="gcj" failifexecutionfails="false" os="linux:Linux:freebsd:FreeBSD" >
  84. <arg line="-O3 ${build.dist}/l2jserver.jar -o ${build.dist}/l2jserver --main=net.sf.l2j.Server"/>
  85. </exec>
  86. </target>
  87. <target name="dist" depends="jar">
  88. <copy todir="${build.dist.login}">
  89. <fileset dir="${src}">
  90. <include name="log.cfg"/>
  91. <include name="banned_ip.cfg"/>
  92. <include name="console.cfg"/>
  93. </fileset>
  94. </copy>
  95. <copy todir="${build.dist.game}">
  96. <fileset dir="${src}">
  97. <include name="log.cfg"/>
  98. <include name="console.cfg"/>
  99. </fileset>
  100. </copy>
  101. <copy todir="${build.dist.login}">
  102. <fileset dir="${src}/../lib">
  103. <include name="c3p0-0.9.1.jar"/>
  104. <include name="mysql-connector-java-5.0.4-bin.jar"/>
  105. <include name="javolution.jar"/>
  106. </fileset>
  107. </copy>
  108. <copy todir="${build.dist.game}">
  109. <fileset dir="${src}/../lib">
  110. <include name="*.jar"/>
  111. </fileset>
  112. </copy>
  113. <copy todir="${build.dist}">
  114. <fileset dir="${basedir}">
  115. <include name="changes.txt"/>
  116. <include name="LICENSE.txt"/>
  117. <include name="README.txt"/>
  118. </fileset>
  119. </copy>
  120. <copy todir="${build.dist}">
  121. <fileset dir="${src}/../lib">
  122. <include name="*LICENSE*"/>
  123. </fileset>
  124. </copy>
  125. <copy todir="${build.dist.login}">
  126. <fileset dir="dist">
  127. <include name="startAccountManager.*"/>
  128. <include name="startSQLAccountManager.*"/>
  129. <include name="LoginServer_loop.sh"/>
  130. <include name="startLoginServer.*"/>
  131. <include name="RegisterGameServer.*"/>
  132. </fileset>
  133. </copy>
  134. <copy todir="${build.dist.game}">
  135. <fileset dir="dist">
  136. <include name="GameServer_loop.sh"/>
  137. <include name="startGameServer.*"/>
  138. <include name="hibernate.cfg.xml"/>
  139. </fileset>
  140. </copy>
  141. <fixcrlf srcdir="${build.dist.game}"
  142. eol="lf"
  143. eof="remove"
  144. includes="**/*.sh">
  145. </fixcrlf>
  146. <fixcrlf srcdir="${build.dist.login}"
  147. eol="lf"
  148. eof="remove"
  149. includes="**/*.sh">
  150. </fixcrlf>
  151. <fixcrlf srcdir="${build.dist.game}"
  152. eol="crlf"
  153. eof="remove"
  154. includes="**/*.bat">
  155. </fixcrlf>
  156. <fixcrlf srcdir="${build.dist.login}"
  157. eol="crlf"
  158. eof="remove"
  159. includes="**/*.bat">
  160. </fixcrlf>
  161. <mkdir dir="${build.dist.game}/log" />
  162. <mkdir dir="${build.dist.login}/log" />
  163. <mkdir dir="${build.dist.game}/hibernate-mapping" />
  164. <mkdir dir="${build.dist.game}/config" />
  165. <mkdir dir="${build.dist.login}/config" />
  166. <copy todir="${build.dist.game}/config">
  167. <fileset dir="java/config">
  168. <include name="*.properties"/>
  169. <exclude name="loginserver.properties" />
  170. </fileset>
  171. </copy>
  172. <copy todir="${build.dist.login}/config">
  173. <fileset dir="java/config">
  174. <include name="loginserver.properties"/>
  175. <include name="telnet.properties"/>
  176. </fileset>
  177. </copy>
  178. <mkdir dir="${build.dist.game}/data" />
  179. <copy todir="${build.dist.game}/data">
  180. <fileset dir="data">
  181. <include name="*.csv"/>
  182. <include name="*.txt"/>
  183. </fileset>
  184. </copy>
  185. <mkdir dir="${build.dist.game}/data/geodata" />
  186. <copy todir="${build.dist.game}/data/geodata">
  187. <fileset dir="data/geodata">
  188. <include name="*.txt"/>
  189. <include name="*.l2j"/>
  190. </fileset>
  191. </copy>
  192. <mkdir dir="${build.dist.game}/data/pathnode" />
  193. <copy todir="${build.dist.game}/data/pathnode">
  194. <fileset dir="data/pathnode">
  195. <include name="*.txt"/>
  196. <include name="*.pn"/>
  197. </fileset>
  198. </copy>
  199. <zip destfile="${build}/l2j-server.zip"
  200. basedir="${build.dist}" />
  201. </target>
  202. <target name="version"
  203. depends="init"
  204. description="Create l2j-version.properties file">
  205. <tstamp>
  206. <format property="build.tstamp"
  207. pattern="yyyyMMdd_HHmm"/>
  208. </tstamp>
  209. <exec dir="." executable="svnversion" outputproperty="l2j.revision"
  210. failifexecutionfails="false">
  211. <arg line="-n ."/>
  212. </exec>
  213. <concat destfile="${build.dist.game}/config/l2j-version.properties">
  214. version=${l2j.revision}
  215. builddate=${build.tstamp}
  216. Detailed Info:
  217. </concat>
  218. <concat destfile="${build.dist.game}/config/l2j-version.properties" append="true">
  219. <filelist dir="${src}/../.svn/" files="entries"/>
  220. <filterchain>
  221. <headfilter lines="5" skip="4"/>
  222. </filterchain>
  223. </concat>
  224. </target>
  225. <target name="clean"
  226. description="Remove the output directories">
  227. <delete dir="${build}"/>
  228. </target>
  229. </project>