build.xml 8.7 KB

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