build.xml 8.5 KB

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