build.xml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. <property name="build.dist.libs" location="${build.dist}/libs"/>
  27. <path id="classpath">
  28. <fileset dir="${lib}">
  29. <include name="c3p0-0.9.1.2.jar"/>
  30. <include name="jython.jar"/>
  31. <include name="jython-engine.jar"/>
  32. <include name="javolution.jar"/>
  33. <include name="mysql-connector-java-5.1.5-bin.jar"/>
  34. <include name="mmocore.jar"/>
  35. </fileset>
  36. </path>
  37. <target name="verifyRequirements"
  38. description="Checks if the necessary requirements for building L2J are fulfilled">
  39. <available classname="javax.script.ScriptContext" property="JDK6.present"/>
  40. <fail unless="JDK6.present" message="JDK 6 or greater is required.">
  41. </fail>
  42. </target>
  43. <target name="init"
  44. depends="clean, verifyRequirements"
  45. description="Create the output directories.">
  46. <mkdir dir="${build}"/>
  47. <mkdir dir="${build.classes}"/>
  48. <mkdir dir="${build.dist}" />
  49. <mkdir dir="${build.dist.login}" />
  50. <mkdir dir="${build.dist.game}" />
  51. </target>
  52. <target name="compile"
  53. depends="version"
  54. description="Compile the source.">
  55. <javac destdir="${build.classes}"
  56. optimize="on"
  57. debug="on"
  58. source="1.6"
  59. target="1.6"
  60. nowarn="off">
  61. <src path="${src}"/>
  62. <classpath refid="classpath"/>
  63. </javac>
  64. </target>
  65. <target name="jar"
  66. depends="compile"
  67. description="Create the jar file">
  68. <jar destfile="${build}/l2jserver.jar">
  69. <fileset dir="${build.classes}"/>
  70. </jar>
  71. <copy todir="${build.dist.login}">
  72. <fileset dir="${build}">
  73. <include name="l2jserver.jar"/>
  74. </fileset>
  75. </copy>
  76. <copy todir="${build.dist.game}">
  77. <fileset dir="${build}">
  78. <include name="l2jserver.jar"/>
  79. </fileset>
  80. </copy>
  81. </target>
  82. <!--
  83. <target name="compile.gcj"
  84. depends="jar"
  85. description="Build machine executable binary">
  86. <exec dir="." executable="gcj" failifexecutionfails="false" os="linux:Linux:freebsd:FreeBSD" >
  87. <arg line="-O3 ${build.dist}/l2jserver.jar -o ${build.dist}/l2jserver - -main=net.sf.l2j.Server"/>
  88. </exec>
  89. </target>
  90. -->
  91. <target name="dist" depends="jar">
  92. <copy todir="${build.dist.login}">
  93. <fileset dir="${src}">
  94. <include name="log.cfg"/>
  95. <include name="banned_ip.cfg"/>
  96. <include name="console.cfg"/>
  97. </fileset>
  98. </copy>
  99. <copy todir="${build.dist.game}">
  100. <fileset dir="${src}">
  101. <include name="log.cfg"/>
  102. <include name="console.cfg"/>
  103. </fileset>
  104. </copy>
  105. <copy todir="${build.dist.libs}">
  106. <fileset dir="${src}/../lib">
  107. <include name="*.jar"/>
  108. </fileset>
  109. </copy>
  110. <copy todir="${build.dist}">
  111. <fileset dir="${basedir}">
  112. <include name="changes.txt"/>
  113. <include name="LICENSE.txt"/>
  114. <include name="README.txt"/>
  115. </fileset>
  116. </copy>
  117. <copy todir="${build.dist}">
  118. <fileset dir="${src}/../lib">
  119. <include name="*LICENSE*"/>
  120. </fileset>
  121. </copy>
  122. <copy todir="${build.dist.login}">
  123. <fileset dir="dist">
  124. <include name="startAccountManager.*"/>
  125. <include name="startSQLAccountManager.*"/>
  126. <include name="LoginServer_loop.sh"/>
  127. <include name="startLoginServer.*"/>
  128. <include name="RegisterGameServer.*"/>
  129. </fileset>
  130. </copy>
  131. <copy todir="${build.dist.game}">
  132. <fileset dir="dist">
  133. <include name="GameServer_loop.sh"/>
  134. <include name="startGameServer.*"/>
  135. <include name="hibernate.cfg.xml"/>
  136. </fileset>
  137. </copy>
  138. <fixcrlf srcdir="${build.dist.game}"
  139. eol="lf"
  140. eof="remove"
  141. includes="**/*.sh">
  142. </fixcrlf>
  143. <fixcrlf srcdir="${build.dist.login}"
  144. eol="lf"
  145. eof="remove"
  146. includes="**/*.sh">
  147. </fixcrlf>
  148. <fixcrlf srcdir="${build.dist.game}"
  149. eol="crlf"
  150. eof="remove"
  151. includes="**/*.bat">
  152. </fixcrlf>
  153. <fixcrlf srcdir="${build.dist.login}"
  154. eol="crlf"
  155. eof="remove"
  156. includes="**/*.bat">
  157. </fixcrlf>
  158. <mkdir dir="${build.dist.game}/log" />
  159. <mkdir dir="${build.dist.login}/log" />
  160. <mkdir dir="${build.dist.game}/config" />
  161. <mkdir dir="${build.dist.login}/config" />
  162. <copy todir="${build.dist.game}/config">
  163. <fileset dir="java/config">
  164. <include name="*.properties"/>
  165. <exclude name="loginserver.properties" />
  166. </fileset>
  167. </copy>
  168. <copy todir="${build.dist.login}/config">
  169. <fileset dir="java/config">
  170. <include name="loginserver.properties"/>
  171. <include name="telnet.properties"/>
  172. </fileset>
  173. </copy>
  174. <mkdir dir="${build.dist.game}/data" />
  175. <copy todir="${build.dist.game}/data">
  176. <fileset dir="data">
  177. <include name="*.csv"/>
  178. <include name="*.txt"/>
  179. </fileset>
  180. </copy>
  181. <mkdir dir="${build.dist.game}/data/geodata" />
  182. <copy todir="${build.dist.game}/data/geodata">
  183. <fileset dir="data/geodata">
  184. <include name="*.txt"/>
  185. <include name="*.l2j"/>
  186. </fileset>
  187. </copy>
  188. <mkdir dir="${build.dist.game}/data/pathnode" />
  189. <copy todir="${build.dist.game}/data/pathnode">
  190. <fileset dir="data/pathnode">
  191. <include name="*.txt"/>
  192. <include name="*.pn"/>
  193. </fileset>
  194. </copy>
  195. <zip destfile="${build}/l2j-server.zip"
  196. basedir="${build.dist}" />
  197. </target>
  198. <target name="version"
  199. depends="init"
  200. description="Create l2j-version.properties file">
  201. <tstamp>
  202. <format property="build.tstamp"
  203. pattern="yyyyMMdd_HHmm"/>
  204. </tstamp>
  205. <exec dir="." executable="svnversion" outputproperty="l2j.revision"
  206. failifexecutionfails="false">
  207. <arg line="-n ."/>
  208. </exec>
  209. <concat destfile="${build.dist.game}/config/l2j-version.properties">
  210. version=${l2j.revision}
  211. builddate=${build.tstamp}
  212. detailed info:
  213. </concat>
  214. <concat destfile="${build.dist.game}/config/l2j-version.properties" append="true">
  215. <filelist dir="${src}/../.svn/" files="entries"/>
  216. <filterchain>
  217. <prefixlines prefix=" "/>
  218. <headfilter lines="8" skip="4"/>
  219. <tokenfilter>
  220. <ignoreblank/>
  221. </tokenfilter>
  222. </filterchain>
  223. </concat>
  224. </target>
  225. <target name="clean"
  226. description="Remove the output directories">
  227. <delete dir="${build}"/>
  228. </target>
  229. </project>